diff --git a/charts/common/templates/deployment.yaml b/charts/common/templates/deployment.yaml index cb0d58f..3e69277 100644 --- a/charts/common/templates/deployment.yaml +++ b/charts/common/templates/deployment.yaml @@ -6,11 +6,11 @@ metadata: labels: app: {{ .Release.Name }} spec: - replicas: {{ .Values.minReplicas }} + replicas: {{ .Values.deployment.minReplicas }} selector: matchLabels: app: {{ .Release.Name }} - {{- with .Values.strategy }} + {{- with .Values.deployment.strategy }} strategy: type: {{ .type }} rollingUpdate: @@ -49,23 +49,35 @@ spec: {{- if .Values.deployment.cpuLimit }} cpu: "{{ .Values.deployment.cpuLimit }}" {{- end }} - {{- if or (.Values.variables.nonSecret) (.Values.variables.secret) }} + {{- if or (.Values.variables.nonSecret) (.Values.variables.secret) (.Values.secret.existingSecret) }} env: - {{- if .Values.variables.nonSecret }} - {{- range $index, $value := .Values.variables.nonSecret }} + {{- if .Values.variables.nonSecret }} + {{- range $index, $value := .Values.variables.nonSecret }} - name: {{ $index }} value: {{ $value | toString | quote }} - {{- end }} - {{- end }} - {{- if .Values.variables.secret }} - {{- range $index, $value := .Values.variables.secret }} + {{- end }} + {{- end }} + {{- if .Values.variables.secret }} + {{- range $index, $value := .Values.variables.secret }} - name: {{ $index }} valueFrom: secretKeyRef: name: {{ $dot.Release.Name }}-{{ $index | lower | replace "_" "-" }} key: secret + {{- end }} + {{- end }} + {{- if .Values.variables.secret.existingSecret }} + {{- range $index, $value := .Values.variables.secret.existingSecret }} + - name: {{ $value.envName }} + valueFrom: + secretKeyRef: + name: {{ $value.name }} + key: {{ $value.key }} + {{- end }} + {{- end }} + {{- end }} - {{- end }} + {{- if .Values.service.enabled }} {{- end }} {{- if .Values.startupProbeEnabled }} startupProbe: diff --git a/charts/common/templates/secrets.yaml b/charts/common/templates/secrets.yaml index 7311db7..06b1140 100644 --- a/charts/common/templates/secrets.yaml +++ b/charts/common/templates/secrets.yaml @@ -1,6 +1,6 @@ {{ if .Values.variables.secret }} {{- $dot := . }} -{{- range $index, $value := .Values.variables.secret }} +{{- range $index, $value := .Values.variables.secret.data }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/common/values.yaml b/charts/common/values.yaml index a4cfa6d..c24c7ff 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -15,6 +15,7 @@ deployment: memoryLimit: null cpuLimit: null port: *containerPort + minReplicas: 1 strategy: type: Replace rollingUpdate: @@ -42,9 +43,18 @@ ingress: # env variables variables: - secret: {} - # user: "username" - # password: "hugepassword" + secret: + data: {} + # user: "username" + # password: "hugepassword" + existingSecret: + - name: "existing-secret" + key: "key" + envName: "ENV_NAME" + - name: another-existing-secret + key: key2 + envName: ENV2_NAME + nonSecret: {} # author: name # app: 1