Skip to content

Commit

Permalink
feat(helm): add possibility to extend secrets for cp in helm charts w…
Browse files Browse the repository at this point in the history
…hen reusing kuma charts (#6883)

Signed-off-by: Marcin Skalski <marcin.skalski@konghq.com>
  • Loading branch information
Automaat authored Jun 1, 2023
1 parent db0897b commit c918368
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions deployments/charts/kuma/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ returns: formatted image string
{{- define "kuma.parentEnv" -}}
{{- end -}}

{{- define "kuma.parentSecrets" -}}
{{- end -}}

{{- define "kuma.defaultEnv" -}}
{{ if (and (eq .Values.controlPlane.environment "universal") (not (eq .Values.controlPlane.mode "global"))) }}
{{ fail "Currently you can only run universal mode on kubernetes in a global mode, this limitation might be lifted in the future" }}
Expand Down
18 changes: 11 additions & 7 deletions deployments/charts/kuma/templates/cp-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
{{- end }}
{{- $envVarsCopy := deepCopy .Values.controlPlane.envVars }}
{{- $mergedEnv := merge $envVarsCopy $defaultEnvDict }}
{{- $defaultSecrets := include "kuma.parentSecrets" . | fromYaml }}
{{- $extraSecrets := .Values.controlPlane.extraSecrets }}
{{- $mergedSecrets := merge $extraSecrets $defaultSecrets }}

apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -241,10 +244,11 @@ spec:
mountPath: {{ $extraConfigMap.mountPath }}
readOnly: {{ $extraConfigMap.readOnly }}
{{- end }}
{{- range $extraSecret := .Values.controlPlane.extraSecrets }}
- name: {{ $extraSecret.name }}
mountPath: {{ $extraSecret.mountPath }}
readOnly: {{ $extraSecret.readOnly }}
{{- range $mergedSecret := $mergedSecrets }}
- name: {{ $mergedSecret.name }}
mountPath: {{ $mergedSecret.mountPath }}
subPath: {{ $mergedSecret.subPath }}
readOnly: {{ $mergedSecret.readOnly }}
{{- end }}
- name: tmp
mountPath: /tmp
Expand Down Expand Up @@ -323,10 +327,10 @@ spec:
configMap:
name: {{ $extraConfigMap.name }}
{{- end }}
{{- range $extraSecret := .Values.controlPlane.extraSecrets }}
- name: {{ $extraSecret.name }}
{{- range $mergedSecret := $mergedSecrets }}
- name: {{ $mergedSecret.name }}
secret:
secretName: {{ $extraSecret.name }}
secretName: {{ $mergedSecret.name }}
{{- end }}
- name: tmp
emptyDir: {}

0 comments on commit c918368

Please sign in to comment.