Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting arrays of maps with --set #4508

Closed
boosh opened this issue Aug 22, 2018 · 4 comments
Closed

Setting arrays of maps with --set #4508

boosh opened this issue Aug 22, 2018 · 4 comments

Comments

@boosh
Copy link

boosh commented Aug 22, 2018

Output of helm version:

Client: &version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"f38e43b221d08850172a9a4ea785a86a3ffa3b3a", GitTreeState:"clean", BuildDate:"2017-10-12T00:45:05Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.): Minikube/any

I've got a similar issue as in #1987 which was closed. I keep coming across charts where I need to set lists of maps on the command line, generally to configure TLS ingresses. E.g. Keycloak:

  ingress:
    tls: []
    # - hosts:
    #     - keycloak.example.com
#   secretName: tls-keycloak

How can these be set on the command line? I need to dynamically set the host name depending on my environment but so far can't find a way to do it. I don't want to have to create a values-<env>.yaml file for every environment I install in because apart from this most settings can be set on the command line and I want my charts to be portable (e.g. use the same chart for multiple clients, with the domain name parameterised).

I've tried all of the following but they all fail:

helm lint --set keycloak.tls.hosts={keycloak.localhost}
helm lint --set keycloak.tls[0].hosts={keycloak.localhost}
helm lint --set keycloak.tls={hosts={keycloak.localhost}}

This is quite a common requirement, specifically to dynamically configure ingress TLS. Is it possible to do this? If not, please add it.

Thanks

@moikot
Copy link

moikot commented Aug 25, 2018

How about this:
helm lint --set keycloak.tls[0].hosts[0]=keycloak.localhost ?

@boosh
Copy link
Author

boosh commented Aug 25, 2018

No, I get the same error:

panic: interface conversion: interface {} is map[string]interface {}, not []interface {}

goroutine 1 [running]:
k8s.io/helm/pkg/strvals.(*parser).key(0xc4201b4860, 0xc420432780, 0xc4209f9278, 0x7) ... (truncated)

@jascott1
Copy link
Contributor

Hi @boosh

Looking at the values file, you are missing ingress key in your set path. So it would be more like keycloak.ingress.tls[0].hosts[0] or similar.

@idursun
Copy link

idursun commented Feb 5, 2020

@boosh If you are using zsh, then you need to escape square brackets like \[0\].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants