NGINX Ingress controller version: 0.16.2
Kubernetes version (use kubectl version): v1.12.3
Environment:
uname -a): 4.15.0-42-genericWhat happened: I want to set multiple headers in the hide-headers ConfigMap option as documented at https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#hide-headers. Looking in the nginx template, I see that HideHeaders is expanded using range, which means it's expecting that HideHeaders would be a list (which makes sense). But the ConfigMap only allows a string for the hide-headers option, and emits an error if you try to make it an array: Invalid value: "The edited file failed validation": ValidationError(ConfigMap.data.hide-headers): invalid type for io.k8s.api.core.v1.ConfigMap.data: got "array", expected
What you expected to happen: Array values should be accepted in the ConfigMap, and if that's not possible, then a delimiter should be allowed (e.g. space, comma, semicolon) and the template should split the string into an array when processing.
How to reproduce it (as minimally and precisely as possible):
Edit the ingress ConfigMap, and create a key under data:
data:
hide-headers:
- Some-Header
- Some-Other-Header
Kubernetes will kick this back with an error about Array being an unexpected type. Fine. So what about this:
data:
hide-headers: "Some-Header Some-Other-Header"
In this case, the template gets expanded incorrectly and nginx kicks back an error:
2019/01/11 17:23:28 [emerg] 11940#11940: invalid number of arguments in "proxy_hide_header" directive in /tmp/nginx-cfg625314691:209
nginx: [emerg] invalid number of arguments in "proxy_hide_header" directive in /tmp/nginx-cfg625314691:209
Closing. Configmaps only allow strings. For that reason the correct format is:
data:
hide-headers: Some-Header,Some-Other-Header
Most helpful comment
Closing. Configmaps only allow strings. For that reason the correct format is: