diff --git a/charts/helmrelease/templates/helmrelease.yaml b/charts/helmrelease/templates/helmrelease.yaml index b6176b8..e062c16 100644 --- a/charts/helmrelease/templates/helmrelease.yaml +++ b/charts/helmrelease/templates/helmrelease.yaml @@ -1,17 +1,17 @@ -{{- if .Values.config.plain }} +{{- if .Values.config.raw }} --- apiVersion: v1 -kind: ConfigMap +kind: Secret metadata: - name: {{ include "helmrelease.fullname" . }}-config + name: {{ include "helmrelease.fullname" . }}-raw-config labels: {{- include "helmrelease.labels" $ | nindent 4 }} -data: +stringData: config: |- - {{- .Values.config | toYaml | nindent 6 }} + {{- .Values.config.raw | toYaml | nindent 6 }} {{- end }} -{{- if .Values.config.sensitive }} +{{- if .Values.config.pretty }} --- apiVersion: v1 kind: Secret @@ -19,9 +19,10 @@ metadata: name: {{ include "helmrelease.fullname" . }}-config labels: {{- include "helmrelease.labels" $ | nindent 4 }} -stringData: - config: |- - {{- .Values.config | toYaml | nindent 6 }} +stringData: + {{- range .Values.config.pretty }} + {{ .key }}: {{ .value }} + {{- end }} {{- end }} --- @@ -33,7 +34,8 @@ metadata: {{- include "helmrelease.labels" $ | nindent 4 }} spec: interval: 5m - url: {{ .Values.helm.repo }} + url: {{ .Values.helm.repo.url }} + type: {{ .Values.helm.repo.type }} --- apiVersion: helm.toolkit.fluxcd.io/v2beta2 kind: HelmRelease @@ -63,16 +65,17 @@ spec: enable: true driftDetection: mode: enabled - {{- if or .Values.config.plain .Values.config.sensitive }} + {{- if or .Values.config.pretty .Values.config.raw }} valuesFrom: - {{- if .Values.config.plain }} - - kind: ConfigMap - name: {{ include "helmrelease.fullname" . }}-config + {{- if .Values.config.raw }} + - kind: Secret + name: {{ include "helmrelease.fullname" . }}-raw-config valuesKey: config {{- end }} - {{- if .Values.config.sensitive }} + {{- range .Values.config.pretty }} - kind: Secret - name: {{ include "helmrelease.fullname" . }}-config - valuesKey: config + name: {{ include "helmrelease.fullname" $ }}-config + valuesKey: {{ .key }} + targetPath: {{ .path }} {{- end }} {{- end }} diff --git a/charts/helmrelease/values.yaml b/charts/helmrelease/values.yaml index d8c2292..0d2276e 100644 --- a/charts/helmrelease/values.yaml +++ b/charts/helmrelease/values.yaml @@ -3,11 +3,12 @@ helm: chart: name: test version: test - repo: test + repo: + url: test + type: oci config: - plain: - test: test - test2: test2 - secret: - test: test - test2: test2 + pretty: + - key: encryption_method + path: env.environment.data.METHOD + value: test + raw: "" \ No newline at end of file