Hey,
if I use the example provided in the README.md, helmfile throws an panic stacktrace:
$ helmfile sync
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 1 [running]:
github.com/roboll/helmfile/pkg/state.markExcludedReleases(0xc00031c840, 0x1, 0x1, 0x30a58f0, 0x0, 0x0, 0xc000596150, 0xc000058c00, 0x346be98, 0x0, ...)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/state/state.go:1338 +0xa5d
github.com/roboll/helmfile/pkg/state.(*HelmState).SelectReleasesWithOverrides(0xc00050afc0, 0xc00031c000, 0x0, 0x0, 0xc00031c000, 0x98)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/state/state.go:1295 +0xb9
github.com/roboll/helmfile/pkg/state.(*HelmState).GetSelectedReleasesWithOverrides(0xc00050afc0, 0xc00031c000, 0x1, 0x1, 0x4, 0x101959e)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/state/state.go:1353 +0x43
github.com/roboll/helmfile/pkg/app.(*App).sync(0xc000333d40, 0xc0005960f0, 0x26a2fa0, 0xc0004c52b0, 0x30, 0x20370c0, 0xc000333e01, 0xc0005960f0)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:992 +0xc0
github.com/roboll/helmfile/pkg/app.(*App).Sync.func1(0xc0005960f0, 0xc0005960f0, 0x26b1a40, 0xc000472080, 0x0)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:187 +0x46
github.com/roboll/helmfile/pkg/app.(*App).ForEachState.func1(0xc00050afc0, 0xc00050afc0, 0x0, 0x0, 0xc00050ad80)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:566 +0xbb
github.com/roboll/helmfile/pkg/app.(*App).visitStates.func1(0x213bb31, 0xd, 0xc0003302a0, 0x8, 0x0, 0x0)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:513 +0x7ee
github.com/roboll/helmfile/pkg/app.(*App).visitStateFiles.func1(0x0, 0x21304d5)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:359 +0x9d
github.com/roboll/helmfile/pkg/app.(*App).within(0xc000333d40, 0x21304d5, 0x1, 0xc00063e500, 0xc00063e4c0, 0x2)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:301 +0x602
github.com/roboll/helmfile/pkg/app.(*App).visitStateFiles(0xc000333d40, 0x0, 0x0, 0x30a58f0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:353 +0x2f2
github.com/roboll/helmfile/pkg/app.(*App).visitStates(0xc000333d40, 0x0, 0x0, 0x30a58f0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:435 +0x10b
github.com/roboll/helmfile/pkg/app.(*App).visitStatesWithSelectorsAndRemoteSupport(0xc000333d40, 0x0, 0x0, 0xc00063e7e8, 0x0, 0x0, 0x0, 0x10, 0xc0004c52b0)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:682 +0x45c
github.com/roboll/helmfile/pkg/app.(*App).ForEachState(0xc000333d40, 0xc00063e850, 0x0, 0x0, 0x0, 0x21118c0, 0xc0004c52b0)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:562 +0xb2
github.com/roboll/helmfile/pkg/app.(*App).Sync(0xc000333d40, 0x26a2fa0, 0xc0004c52b0, 0xc0004c52b0, 0xc0003f7040)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/pkg/app/app.go:186 +0x79
main.main.func7(0xc000333d40, 0xc0001f6c60, 0x0, 0xc0004c52a0, 0x0)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/main.go:315 +0x6d
main.action.func1(0xc0001f6c60, 0x0, 0xc0001f6c60)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/main.go:675 +0xd4
github.com/urfave/cli.HandleAction(0x1ec4300, 0xc0004c4e10, 0xc0001f6c60, 0xc00037f000, 0x0)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/.brew_home/go/pkg/mod/github.com/urfave/[email protected]/app.go:490 +0xc8
github.com/urfave/cli.Command.Run(0x21318fb, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2175660, 0x43, 0x0, ...)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/.brew_home/go/pkg/mod/github.com/urfave/[email protected]/command.go:210 +0x9e8
github.com/urfave/cli.(*App).Run(0xc000198000, 0xc0001a2020, 0x2, 0x2, 0x0, 0x0)
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/.brew_home/go/pkg/mod/github.com/urfave/[email protected]/app.go:255 +0x741
main.main()
/private/tmp/helmfile-20200427-11322-19c9vnv/helmfile-0.114.0/main.go:487 +0x33e4
This can be reproduced with the following helmfile:
repositories:
- name: stable
url: https://kubernetes-charts.storage.googleapis.com
releases:
- name: vault
namespace: vault
createNamespace: true
chart: roboll/vault-secret-manager
version: ~1.24.1
condition: vault.enabled
values:
- address: https://vault.example.com
Tested with v0.114.0
Pass value for the condition vault.enabled via --state-values-file to install/skip based on the condition. With the state values file option, the command would be helmfile --state-values-file values.yaml sync. The contents of the state values file values.yaml to install vault are:-
vault:
enabled: true
This can also be achieved by specifying the values for the condition vault.enabled in environments. We could execute helmfile sync itself using the below helmfile.yaml with the condition in the default environment:-
repositories:
- name: roboll
url: http://roboll.io/charts
environments:
default:
values:
- vault:
enabled: true
releases:
- name: vault
namespace: vault
createNamespace: true
chart: roboll/vault-secret-manager
version: ~1.24.1
condition: vault.enabled
values:
- address: https://vault.example.com
Hi,
I'm also struggling with this a bit; it turns out that the condition MUST be named <something>.enabled. I was trying with <something>.managed instead.
conditionSplit := strings.Split(r.Condition, ".")
if len(conditionSplit) != 2 {
return nil, fmt.Errorf("Condition value must be in the form 'foo.enabled' where 'foo' can be modified as necessary")
}
if values[conditionSplit[0]].(map[string]interface{})["enabled"] == true {
conditionMatch = true
}
Would it not make sense to use 'conditionSplit[1]' instead of hardcoded 'enabled' ?
Also, why must there be two elements to the name and not1 or 3?
Thanks
same issue here.
would it be possible to evaluate the given values files for the release instead of having another separate values file?
same issue here trying to use condition:
nil/not existing should be same as false not crash/force the value to be defined in each and every environment
Most helpful comment
would it be possible to evaluate the given values files for the release instead of having another separate values file?