Skip to content

Commit 828a898

Browse files
author
Travis Raines
authored
feat(config) add "kic" configuration for reporting (Kong#5765)
* feat(config) add "kic" setting Add a "kic" setting to kong.conf. This is a boolean indicating whether the instance is managed by the Kong Ingress Controller. It is not documented and not included in kong.conf.default, as users should not set it directly. Kubernetes tooling will set it automatically if appropriate. * feat(reports) send KIC usage Add ingress controller usage setting to anonymous reports.
1 parent 4a11569 commit 828a898

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

kong/conf_loader.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ local CONF_INFERENCES = {
397397
cluster_control_plane = { typ = "string", },
398398
cluster_cert = { typ = "string" },
399399
cluster_cert_key = { typ = "string" },
400+
kic = { typ = "boolean" },
400401
}
401402

402403

kong/reports.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ local function configure_ping(kong_conf)
336336

337337
add_immutable_value("database", kong_conf.database)
338338
add_immutable_value("role", kong_conf.role)
339+
add_immutable_value("kic", kong_conf.kic)
339340
add_immutable_value("_admin", #kong_conf.admin_listeners > 0 and 1 or 0)
340341
add_immutable_value("_proxy", #kong_conf.proxy_listeners > 0 and 1 or 0)
341342
add_immutable_value("_stream", #kong_conf.stream_listeners > 0 and 1 or 0)

kong/templates/kong_defaults.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,5 @@ lua_package_path = ./?.lua;./?/init.lua;
120120
lua_package_cpath = NONE
121121
122122
role = traditional
123+
kic = off
123124
]]

spec/01-unit/11-reports_spec.lua

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,32 @@ describe("reports", function()
170170
end)
171171
end)
172172

173+
describe("sends 'kic'", function()
174+
it("default (off)", function()
175+
local conf = assert(conf_loader(nil))
176+
reports.configure_ping(conf)
177+
178+
local thread = helpers.tcp_server(8189)
179+
reports.send_ping("127.0.0.1", 8189)
180+
181+
local _, res = assert(thread:join())
182+
assert._matches("kic=false", res, nil, true)
183+
end)
184+
185+
it("enabled", function()
186+
local conf = assert(conf_loader(nil, {
187+
kic = "on",
188+
}))
189+
reports.configure_ping(conf)
190+
191+
local thread = helpers.tcp_server(8189)
192+
reports.send_ping("127.0.0.1", 8189)
193+
194+
local _, res = assert(thread:join())
195+
assert.matches("kic=true", res, nil, true)
196+
end)
197+
end)
198+
173199
describe("sends '_admin' for 'admin_listen'", function()
174200
it("off", function()
175201
local conf = assert(conf_loader(nil, {

0 commit comments

Comments
 (0)