Is there a way to move boilerplate YAML from subchart templates to the parent _helpers.tpl or values.yaml ?
helm project
MyHelmApp
│
├── Chart.yaml
├── values.yaml
├── templates
│ ├── _helpers.tpl
│ ├── configmap.yaml
│ └── app-ingress-rules.yaml
│
└── charts
│
├── app1
│ ├── Chart.yaml
│ ├── templates
│ │ ├── _helpers.tpl
│ │ ├── deployment.yaml
│ │ └── service.yaml
│ └── values.yaml
├── app2
│ ├── Chart.yaml
│ ├── templates
│ │ ├── _helpers.tpl
│ │ ├── deployment.yaml
│ │ └── service.yaml
│ └── values.yaml
└── app3
├── Chart.yaml
├── templates
│ ├── _helpers.tpl
│ ├── deployment.yaml
│ └── service.yaml
└── values.yaml
To elaborate: I have 3 app subcharts and they each have boilerplate YAML in their templates. The values in those templates are defined in the parent chart's values.yaml, and the variable paths are identical. For instance:
app1, app2, and app3 deployment.yaml's all contain...
livenessProbe:
httpGet:
path: {{ .Values.health.livenessProbe.path }}
port: {{ .Values.health.livenessProbe.port }}
initialDelaySeconds: {{ .Values.health.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.health.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.health.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.health.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.health.readinessProbe.failureThreshold }}
readinessProbe:
tcpSocket:
port: {{ .Values.health.readinessProbe.port }}
initialDelaySeconds: {{ .Values.health.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.health.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.health.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.health.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.health.readinessProbe.failureThreshold }}
values.yaml (in the parent chart)
app1:
health:
livenessProbe:
path: /system_health
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
readinessProbe:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
app2:
health:
livenessProbe:
path: /system_health
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
readinessProbe:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
(etc)
Back to the question: I'd like to grab what's identical in the subchart templates and move it to one centralized place like the parent chart's _helpers.tpl or values.yaml; is this possible? Can you provide an example of how you'd do this?