{{- range $componentInstance, $config := .Values.components }} {{- if ($config.enabled | default false) }} {{- $componentName := $config.name | default $componentInstance }} --- apiVersion: helm.toolkit.fluxcd.io/v2beta2 kind: HelmRelease metadata: name: "{{ $.Release.Name }}-{{ $componentInstance }}" spec: chart: spec: sourceRef: {{- toYaml $.Values.commons.helm.chart.sourceRef | nindent 8 }} chart: "./{{ $componentName }}" reconcileStrategy: "Revision" releaseName: "{{ $.Release.Name }}-{{ $componentInstance }}" targetNamespace: "{{ ($config.namespace | default (dict)).name | default (dict) | default $.Release.Namespace }}" install: {{- toYaml $.Values.commons.helm.release.install | nindent 4 }} test: {{- toYaml $.Values.commons.helm.release.test | nindent 4 }} upgrade: {{- toYaml $.Values.commons.helm.release.upgrade | nindent 4 }} driftDetection: {{- toYaml $.Values.commons.helm.release.driftDetection | nindent 4 }} interval: {{ $.Values.componentCommons.helm.release.interval }} valuesFrom: - kind: ConfigMap name: "{{ $.Release.Name }}-{{ $componentInstance }}-init" optional: true valuesKey: init targetPath: init.version {{- with $.Values.componentCommons.helm.release.valuesFrom }} {{- toYaml . | nindent 4 }} {{- end }} {{- with $config.valuesFrom }} {{- toYaml . | nindent 4 }} {{- end }} values: {{- $config.values | default (dict) | mergeOverwrite (dict "commons" $.Values.commons "global" $.Values.global "init" (dict "namespace" $.Release.Namespace)) | toYaml | nindent 4 }} {{- end }} {{- end }}