Update helmrelease

This commit is contained in:
Nikolai Rodionov 2024-05-04 17:30:57 +02:00
parent 726f2e98cf
commit c520ba3a5c
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
2 changed files with 28 additions and 24 deletions

View File

@ -1,17 +1,17 @@
{{- if .Values.config.plain }} {{- if .Values.config.raw }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: Secret
metadata: metadata:
name: {{ include "helmrelease.fullname" . }}-config name: {{ include "helmrelease.fullname" . }}-raw-config
labels: labels:
{{- include "helmrelease.labels" $ | nindent 4 }} {{- include "helmrelease.labels" $ | nindent 4 }}
data: stringData:
config: |- config: |-
{{- .Values.config | toYaml | nindent 6 }} {{- .Values.config.raw | toYaml | nindent 6 }}
{{- end }} {{- end }}
{{- if .Values.config.sensitive }} {{- if .Values.config.pretty }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
@ -20,8 +20,9 @@ metadata:
labels: labels:
{{- include "helmrelease.labels" $ | nindent 4 }} {{- include "helmrelease.labels" $ | nindent 4 }}
stringData: stringData:
config: |- {{- range .Values.config.pretty }}
{{- .Values.config | toYaml | nindent 6 }} {{ .key }}: {{ .value }}
{{- end }}
{{- end }} {{- end }}
--- ---
@ -33,7 +34,8 @@ metadata:
{{- include "helmrelease.labels" $ | nindent 4 }} {{- include "helmrelease.labels" $ | nindent 4 }}
spec: spec:
interval: 5m interval: 5m
url: {{ .Values.helm.repo }} url: {{ .Values.helm.repo.url }}
type: {{ .Values.helm.repo.type }}
--- ---
apiVersion: helm.toolkit.fluxcd.io/v2beta2 apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease kind: HelmRelease
@ -63,16 +65,17 @@ spec:
enable: true enable: true
driftDetection: driftDetection:
mode: enabled mode: enabled
{{- if or .Values.config.plain .Values.config.sensitive }} {{- if or .Values.config.pretty .Values.config.raw }}
valuesFrom: valuesFrom:
{{- if .Values.config.plain }} {{- if .Values.config.raw }}
- kind: ConfigMap - kind: Secret
name: {{ include "helmrelease.fullname" . }}-config name: {{ include "helmrelease.fullname" . }}-raw-config
valuesKey: config valuesKey: config
{{- end }} {{- end }}
{{- if .Values.config.sensitive }} {{- range .Values.config.pretty }}
- kind: Secret - kind: Secret
name: {{ include "helmrelease.fullname" . }}-config name: {{ include "helmrelease.fullname" $ }}-config
valuesKey: config valuesKey: {{ .key }}
targetPath: {{ .path }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -3,11 +3,12 @@ helm:
chart: chart:
name: test name: test
version: test version: test
repo: test repo:
url: test
type: oci
config: config:
plain: pretty:
test: test - key: encryption_method
test2: test2 path: env.environment.data.METHOD
secret: value: test
test: test raw: ""
test2: test2