Helm conditionally install subchart

后端 未结 2 1064
醉梦人生
醉梦人生 2020-12-17 15:56

Is there a way to conditionally install a helm subchart based on global values.yaml? I\'ve all my internal services and components as subcharts, and one of them is a message

相关标签:
2条回答
  • 2020-12-17 16:33

    I've found out the answer:

    In requirements.yaml, add:

    dependencies:
    - name: api
      condition: api.enabled
    - name: messagequeue
      condition: messagequeue.enabled
    

    and in values.yaml, add

    api:
      enabled: true    
    messagequeue:
      enabled: false
    

    Now during installation, pass the values to enabled or disable the messagequeue as follows:

    helm install --dry-run --debug website\ --set messagequeue.enabled=true
    

    or

    helm install --dry-run --debug website\ --set messagequeue.enabled=false
    
    0 讨论(0)
  • 2020-12-17 16:38

    I would propose this (ugly) workaround as answer borrowed from @sgandon: https://github.com/helm/helm/issues/3742#issuecomment-383095917

    dependencies: - name: mobi-postgresql version: 1.0.1 repository: "@mobi" alias: postgresql - name: oraclepdb version: 0.0.1 repository: "file://subcharts/oraclepdb" condition: oraclepdb.enabled

    Then you can use the practice Chart dependencies to manage subcharts as dependencies via helm dep update and helm dep build.

    It's not beautiful as long as this bug is not fixed.

    0 讨论(0)
提交回复
热议问题