-
Notifications
You must be signed in to change notification settings - Fork 610
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When KIC is running in dbless mode, fields in kongPlugin.Config
with null
value will be omitted when sending configuration to kong:
https://github.com/Kong/kubernetes-ingress-controller/blob/1a45c0c10ef1f4c26fe63a8e3a0ab866fe7a6c01/internal/dataplane/sendconfig/inmemory.go#L52-53
The code was first introduced in PR #484.
If KIC is running in db mode, null values could be present in Kong.
This will make users unable to explicitly configure fields of plugins to null
, which is meaningful in some plugins. For example, datadog
plugin would use null
in host, to load host from env variables. If KIC is running in dbless mode, and the config.host
is set to null
, the field is omitted and Kong will treat host
as not specified and fill in a default value localhost
.
Expected Behavior
When I explicitly specify some fields of KongPlugin.Config
to null
, the null
value of the field should be passed to kong.
Steps To Reproduce
1. create a KongPlugin:
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: datadog
namespace: default
annotations:
kubernetes.io/ingress.class: kong
plugin: datadog
config:
host: null
port: 8125
2. Create an ingress with annotation: konghq.com/plugins: "datadog"
3. call /plugins admin API, and the `config.host` becomes `localhost`.
Kong Ingress Controller version
v2.9.3
Kubernetes version
v1.26.3
Anything else?
https://github.com/Kong/kubernetes-ingress-controller/pull/484/files firstly introduces the cleanup of null
fields in Dec 2019 and first released in KIC v0.7.0. The comment tells us Kong will return error when fields with null
are present in config. Please help me to know more about the context at that time.