Is it possible to disable chart located in charts folder in kubernetes?

12/5/2017

I have a subchart in charts/ directory. I would like to disable it for some deployments.

Is it possible somehow? Currently i see the only way to add condition to all templates like below:

deployment.yaml

{{- if .Values.isDev }}
deployment code
{{- end }}

service.yaml

{{- if .Values.isDev }}
service code
{{- end }}
-- avasin
kubernetes
kubernetes-helm

2 Answers

12/20/2018

Also, for current version of Helm (2.12 at this time), it is also possible to write a requirements.yaml in which one can specify not only remote charts for Helm to download, but also Charts inside the charts folder. In this requirements.yaml one can specify a condition field for each dependency. This field is the path for a parent's Value.

So, for instance, given this requirements.yaml:

dependencies:
  - name: one-dep
    version: 0.1.0
    condition: one-dep.enabled
  - name: another-dep
    version: 0.1.0
    condition: another-dep.enabled

Your values.yaml could have:

one-dep:
  enabled: true

another-dep:
  enabled: false

This will result in Helm only including one-dep chart. It's worth noting that if the path specified in the condition does not exist, it defaults to true.

Here's the link to the doc

-- Bardiel W. Thirtytwo
Source: StackOverflow

12/5/2017

As a general rule of thumb I always have

{{- if .Values.enabled }}
...
{{- end }}

in every file in every subchart. Depending on situation the default value will be either true for regular components or false for dev related, or simply false for everything if I want to enable these in completely selective manner. A typical values for deployment for this approach looks like ie.:

api:
  enabled: true
  database:
    host: mysql-dev

mysql:
  enabled: false

mysql-dev:
  enabled: true
-- Radek 'Goblin' Pieczonka
Source: StackOverflow