相关Github问题: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
在以下方法中设置值时,如何使用helm实现上述配置?
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
您可以如下定义多行环境变量,
read -d '' conf << EOF
if ($http_x_azure_fdid !~* "55ce4ed1-4b06-4bf1-b40e-4638452104da" ) {
return 403;
}
EOF
一旦定义了环境变量,请将其引用到helm--set-string controller.config.server-snippet=
arg中,如下所示,
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