fix(base): components name and instance

This commit is contained in:
WrenIX 2023-12-20 01:04:41 +01:00
parent ae8d77589c
commit 80c394710e
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
2 changed files with 8 additions and 7 deletions

View file

@ -1,19 +1,19 @@
{{- range $name, $config := .Values.components }} {{- range $componentInstance, $config := .Values.components }}
{{- if ($config.enabled | default false) }} {{- if ($config.enabled | default false) }}
{{- $name = $config.name | default $name }} {{- $componentName := $config.name | default $componentInstance }}
--- ---
apiVersion: helm.toolkit.fluxcd.io/v2beta1 apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease kind: HelmRelease
metadata: metadata:
name: "{{ $.Release.Name }}-{{ $name }}" name: "{{ $.Release.Name }}-{{ $componentInstance }}"
spec: spec:
chart: chart:
spec: spec:
sourceRef: sourceRef:
{{- toYaml $.Values.commons.helm.chart.sourceRef | nindent 8 }} {{- toYaml $.Values.commons.helm.chart.sourceRef | nindent 8 }}
chart: "./{{ $name }}" chart: "./{{ $componentName }}"
reconcileStrategy: "Revision" reconcileStrategy: "Revision"
releaseName: "{{ $.Release.Name }}-{{ $name }}" releaseName: "{{ $.Release.Name }}-{{ $componentInstance }}"
targetNamespace: "{{ ($config.namespace | default (dict)).name | default (dict) | default $.Release.Namespace }}" targetNamespace: "{{ ($config.namespace | default (dict)).name | default (dict) | default $.Release.Namespace }}"
install: install:
{{- toYaml $.Values.commons.helm.release.install | nindent 4 }} {{- toYaml $.Values.commons.helm.release.install | nindent 4 }}
@ -21,10 +21,10 @@ spec:
{{- toYaml $.Values.commons.helm.release.test | nindent 4 }} {{- toYaml $.Values.commons.helm.release.test | nindent 4 }}
upgrade: upgrade:
{{- toYaml $.Values.commons.helm.release.upgrade | nindent 4 }} {{- toYaml $.Values.commons.helm.release.upgrade | nindent 4 }}
interval: 5m interval: {{ $.Values.componentCommons.helm.release.interval }}
valuesFrom: valuesFrom:
- kind: ConfigMap - kind: ConfigMap
name: "{{ $.Release.Name }}-{{ $name }}-init" name: "{{ $.Release.Name }}-{{ $componentInstance }}-init"
optional: true optional: true
valuesKey: init valuesKey: init
targetPath: init.version targetPath: init.version

View file

@ -13,6 +13,7 @@ commons:
componentCommons: componentCommons:
helm: helm:
release: release:
interval: 10m
valuesFrom: [] valuesFrom: []
components: {} components: {}