Skip to content

Commit

Permalink
feat(conf): enable reuseport on all listeners
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Schmid <[email protected]>
  • Loading branch information
jschmid1 committed Jan 18, 2024
1 parent ccfac55 commit 4feb561
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/feat-reuseport-on-listeners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: add `reuseport` option to listeners
type: feature
scope: Configuration
6 changes: 3 additions & 3 deletions kong.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
# HYBRID MODE CONTROL PLANE
#------------------------------------------------------------------------------

#cluster_listen = 0.0.0.0:8005
#cluster_listen = 0.0.0.0:8005 reuseport
# Comma-separated list of addresses and ports on
# which the cluster control plane server should listen
# for data plane connections.
Expand Down Expand Up @@ -731,7 +731,7 @@

#mem_cache_size = 128m # Size of each of the two shared memory caches
# for traditional mode database entities
# and runtime data, `kong_core_cache` and
# and runtime data, `kong_core_cache` and
# `kong_cache`.
#
# The accepted units are `k` and `m`, with a minimum
Expand Down Expand Up @@ -1910,7 +1910,7 @@

# The Admin GUI for Kong Gateway.

#admin_gui_listen = 0.0.0.0:8002, 0.0.0.0:8445 ssl
#admin_gui_listen = 0.0.0.0:8002 reuseport, 0.0.0.0:8445 ssl reuseport
# Kong Manager Listeners
#
# Comma-separated list of addresses and ports on which
Expand Down
4 changes: 2 additions & 2 deletions kong/templates/kong_defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ node_id = NONE
proxy_listen = 0.0.0.0:8000 reuseport backlog=16384, 0.0.0.0:8443 http2 ssl reuseport backlog=16384
stream_listen = off
admin_listen = 127.0.0.1:8001 reuseport backlog=16384, 127.0.0.1:8444 http2 ssl reuseport backlog=16384
admin_gui_listen = 0.0.0.0:8002, 0.0.0.0:8445 ssl
admin_gui_listen = 0.0.0.0:8002 reuseport, 0.0.0.0:8445 ssl reuseport
status_listen = 127.0.0.1:8007 reuseport backlog=16384
cluster_listen = 0.0.0.0:8005
cluster_listen = 0.0.0.0:8005 reuseport
cluster_control_plane = 127.0.0.1:8005
cluster_cert = NONE
cluster_cert_key = NONE
Expand Down
7 changes: 4 additions & 3 deletions spec/01-unit/03-conf_loader_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ describe("Configuration loader", function()
assert.equal("eventual", conf.worker_consistency)
assert.same({"127.0.0.1:8001 reuseport backlog=16384", "127.0.0.1:8444 http2 ssl reuseport backlog=16384"}, conf.admin_listen)
assert.same({"0.0.0.0:8000 reuseport backlog=16384", "0.0.0.0:8443 http2 ssl reuseport backlog=16384"}, conf.proxy_listen)
assert.same({"0.0.0.0:8002", "0.0.0.0:8445 ssl"}, conf.admin_gui_listen)
assert.same({"0.0.0.0:8002 reuseport", "0.0.0.0:8445 ssl reuseport"}, conf.admin_gui_listen)
assert.same({"0.0.0.0:8005 reuseport"}, conf.cluster_listen)
assert.equal("/", conf.admin_gui_path)
assert.equal("logs/admin_gui_access.log", conf.admin_gui_access_log)
assert.equal("logs/admin_gui_error.log", conf.admin_gui_error_log)
Expand Down Expand Up @@ -175,13 +176,13 @@ describe("Configuration loader", function()
assert.equal(8002, conf.admin_gui_listeners[1].port)
assert.equal(false, conf.admin_gui_listeners[1].ssl)
assert.equal(false, conf.admin_gui_listeners[1].http2)
assert.equal("0.0.0.0:8002", conf.admin_gui_listeners[1].listener)
assert.equal("0.0.0.0:8002 reuseport", conf.admin_gui_listeners[1].listener)

assert.equal("0.0.0.0", conf.admin_gui_listeners[2].ip)
assert.equal(8445, conf.admin_gui_listeners[2].port)
assert.equal(true, conf.admin_gui_listeners[2].ssl)
assert.equal(false, conf.admin_gui_listeners[2].http2)
assert.equal("0.0.0.0:8445 ssl", conf.admin_gui_listeners[2].listener)
assert.equal("0.0.0.0:8445 ssl reuseport", conf.admin_gui_listeners[2].listener)

assert.equal("0.0.0.0", conf.proxy_listeners[1].ip)
assert.equal(8000, conf.proxy_listeners[1].port)
Expand Down

0 comments on commit 4feb561

Please sign in to comment.