How to pass variables to helm install --set parameters

1/2/2020

I want to know if it is possible to pass variables to an helm install command's set parameter. Below is an example of what I'm looking to achieve.

appgw_name = "myappgateway"
export appgw_name
helm install applicationgw application-gateway-kubernetes-ingress/ingress-azure --set appgw.name=$appgw_name

I'm executing the above two lines as a shell script and when I try to execute them I get the below error:

Error: execution error at (ingress-azure/templates/configmap.yaml): Please either provide appgw.applicationGatewayID or appgw.name.

-- vishal.k
kubernetes
kubernetes-helm
kubernetes-ingress

2 Answers

1/2/2020

The parameter will be resolved by your shell. If you write these directly from the command line you need to either export the env variable or execute then together in one line.

Try this:

export appgw_name="myappgateway"
helm install applicationgw application-gateway-kubernetes-ingress/ingress-azure --set appgw.name=${appgw_name}
-- RafaƂ Leszko
Source: StackOverflow

1/3/2020

Solved it. Was just a few spacings that had to be altered. The issue was with bash and had nothing to do with helm. So this is how I finally declared the variables export appgw_name="myappgateway" Just removed all the spaces and that's it. It worked like charm.

-- vishal.k
Source: StackOverflow