Dolev Shoval
Dolev Shoval

Reputation: 11

Helm CLI - Can't add/override new env var via --set command

I'm trying to config my Selenium Grid (chart) via Helm cli (can't override values.yaml at this level.. have to use helm cli"), and i need to add the next env var: SE_NODE_MAX_SESSIONS=5 I tried to command this: --set chromeNode.replicas=5 \ --set chromeNode.extraEnvironmentVariables='["SE_NODE_MAX_SESSIONS"="5"]' \ but it doesn't work..

Error: UPGRADE FAILED: error validating "": error validating data: ValidationError(Deployment.spec.template.spec.containers[0].env): invalid type for io.k8s.api.core.v1.Container.env: got "string", expected "array"

what is the right way to add/override this env var?

--set chromeNode.extraEnvironmentVariables='["SE_NODE_MAX_SESSIONS"="5"]' \ expecting for sucessfull deployment

Link for chart: https://github.com/SeleniumHQ/docker-selenium/tree/trunk/charts/selenium-grid

Upvotes: 1

Views: 432

Answers (2)

Alberto P.
Alberto P.

Reputation: 88

Looking at the Chart you linked, the value chromeNode.extraEnvironmentalVariables calls for a Kubernetes classic array of envs with its classic structure [ name: env_name, value: env_value ].

According to the Helm Official Documentation, you have two possible solutions.

If you have Helm >= 2.5 you can use the flat array technique using this notation in your command line:

helm install --set chromeNode.extraEnvironmentVariables[0].name="SE_NODE_MAX_SESSIONS" --set chromeNode.extraEnvironmentVariables[0].value=5

Clearly, the downside is that you have to pick an array index value arbitrarily.

If you have Helm >=3.0 you can use the --set-json option and notate everything in JSON as per the official documentations suggest.

helm install --set-json 'chromeNode.extraEnvironmentVariables=[{"name":"SE_NODE_MAX_SESSIONS","value":"5"}]'

A belate response but a response anyway.

Upvotes: 2

Reda E.
Reda E.

Reputation: 878

Try out with:

--set chromeNode.extraEnvironmentVariables."SE_NODE_MAX_SESSIONS"="5"

Upvotes: 0

Related Questions