Do not set KONG_PLUGINS if no plugins are configured.
Release 2.35.1.
Which issue this PR fixes
Cannot override KONG_PLUGINS with a reference under env or a value loaded from a ConfigMap in envFrom.
Special notes for your reviewer:
Previously, the plugins helper would set KONG_PLUGINS to its default value (bundled) if no plugins were configured. There's no need for this (it just mirrors the upstream kong.conf default), but the template (maybe) needed to return something to not send KONG_PLUGINS="" (dunno if this actually tells the plugins loader to load nothing or if it defaults to bundled anyway, but whatever).
This change conditions automatic population on the presence of anything under the plugins value: if there are no plugins, it sets nothing and the proxy uses its native defaults.
Helm (rather, Sprig) has a rather pernicious claim that the mergeOverwrite function uses its highest-precedence merge value, but this isn't actually true: it relies on mergo, which has a more Go-like understanding of types and doesn't allow you to override with non-like types. Sprig uses a "oops, didn't actually merge? who cares! fail silently." approach, so if the lower-priority input is a different type ("bundled" is a string, and a valueFrom is a map[string]interface{}), it actually gives up and uses the lower-priority value.
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
[x] PR is based off the current tip of the main branch.
[x] Changes are documented under the "Unreleased" header in CHANGELOG.md
[x] New or modified sections of values.yaml are documented in the README.md
What this PR does / why we need it:
Do not set KONG_PLUGINS if no plugins are configured.
Release 2.35.1.
Which issue this PR fixes
Cannot override KONG_PLUGINS with a reference under
env
or a value loaded from a ConfigMap in envFrom.Special notes for your reviewer:
Previously, the plugins helper would set
KONG_PLUGINS
to its default value (bundled
) if no plugins were configured. There's no need for this (it just mirrors the upstream kong.conf default), but the template (maybe) needed to return something to not sendKONG_PLUGINS=""
(dunno if this actually tells the plugins loader to load nothing or if it defaults to bundled anyway, but whatever).This change conditions automatic population on the presence of anything under the
plugins
value: if there are no plugins, it sets nothing and the proxy uses its native defaults.Helm (rather, Sprig) has a rather pernicious claim that the
mergeOverwrite
function uses its highest-precedence merge value, but this isn't actually true: it relies on mergo, which has a more Go-like understanding of types and doesn't allow you to override with non-like types. Sprig uses a "oops, didn't actually merge? who cares! fail silently." approach, so if the lower-priority input is a different type ("bundled"
is a string, and avalueFrom
is amap[string]interface{}
), it actually gives up and uses the lower-priority value.Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
main
branch.