Search code examples
kubernetes-helm

How to add multiple conditions check in global Charts file in Helm


I want to install a chart only if my both conditions are satisfied. Basically I want to use and condition here. I've tried multiple permutations but none of them seems to be working. What I want should look something like this.

- name: chart-test
  version: 0.1.0
  condition: global.test1.enabled and global.test2.enabled

If test1 is enabled and test2 is enabled then only chart-test should be installed. If any one of them is set to false then it shouldn't.


Solution

  • The Helm condition: and tags: controls don't allow Boolean logic at all, and effectively only allow "or" combinations. That is, you could write

    condition: global.test1.enabled, global.test2.enabled
    

    and it would install the dependency if either value is set; but this is the only syntax Helm supports, and there's no way to only install the dependency if both are set.