Related Github Issue : https://github.com/kubernetes/ingress-nginx/issues/6519
apiVersion: v1
data:
server-snippet: |
if ($http_x_azure_fdid !~* "55ce4ed1-4b06-4bf1-b40e-4638452104da" ) {
return 403;
}
use-forwarded-headers: "true"
kind: ConfigMap
How to achieve the above config using helm when setting the values in the following approach?
helm upgrade --install nginx-ingress-controller ingress-nginx/ingress-nginx \
--namespace "${namespace}" \
--version "${chart_version}" \
--set controller.replicaCount="${replicas}" \
--set-string controller.config.use-forwarded-headers=true \
--set-string controller.config.server-snippet=<?> \
--debug
You can define a multiline environment variable as below,
read -d '' conf << EOF
if ($http_x_azure_fdid !~* "55ce4ed1-4b06-4bf1-b40e-4638452104da" ) {
return 403;
}
EOF
Once the environment variable is defined, refer it in the helm --set-string controller.config.server-snippet=
arg as below,
helm upgrade --install nginx-ingress-controller ingress-nginx/ingress-nginx \
--namespace "${namespace}" \
--version "${chart_version}" \
--set controller.replicaCount="${replicas}" \
--set-string controller.config.use-forwarded-headers=true \
--set-string controller.config.server-snippet=$conf \
--debug