How to set Helm Chart dependencies with KOTS Boolean config

Helm allows you to conditionally include dependency charts using the dependencies.condition field in your Chart.yaml:

# parentchart/Chart.yaml
dependencies:
  - name: subchart1
    version: 0.1.0
    condition: global.subchart1.enabled

The condition field expects a boolean value (true or false). When Helm encounters non-boolean values, it will generate a warning during template rendering or installation:

Warning: Condition path 'global.subchart1.enabled' for chart subchart1 returned non-bool value

Important: Even with this warning, Helm will still evaluate the condition using Go template truthiness rules:

  • Empty string ""false (chart excluded)
  • Any non-empty string → true (chart included, even "false" or "0")

This can lead to unexpected behavior where charts are included when you expect them to be excluded.

Mapping KOTS Config Values to Boolean Conditions

KOTS boolean configuration options return string values "0" or "1" rather than true boolean values. To properly map these to Helm’s boolean expectations, use the ConfigOptionEquals template function:

apiVersion: kots.io/v1beta2
kind: HelmChart
metadata:
  name: <chart>
spec:
  chart:
    name: <chart>
    chartVersion: 0.1.0
  helmUpgradeFlags:
    - --debug
  values:
    global:
      subchart1:
        enabled: repl{{ ConfigOptionEquals "subchart1_enabled" "1" }}

Why This Approach Works

  • ConfigOptionEquals "subchart1_enabled" "1" returns a proper boolean (true or false)
  • This eliminates the Helm warning about non-boolean values
  • The chart inclusion behavior becomes predictable and matches user expectations

You can also use other KOTS template functions for other config values:

# For dropdown configs  
enabled: repl{{ ConfigOptionEquals "deployment_mode" "full" }}

By using proper boolean conversion, you ensure reliable chart dependency behavior and eliminate confusing warning messages.