Merge pull request #80 from gimlet-io/new-features

Added ability to refrence an env from an existing configMaps and secrets
This commit is contained in:
Laszlo Fogas
2023-10-20 10:55:41 +02:00
committed by GitHub
13 changed files with 57 additions and 12 deletions
+1 -1
View File
@@ -15,4 +15,4 @@ type: library
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.3.1
version: 0.4.0
+11 -1
View File
@@ -1,10 +1,20 @@
{{- define "common.envFromRef.tpl" -}}
{{- if or (or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets) .Values.secretName -}}
{{- if or (or (or (or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets) .Values.secretName) .Values.existingConfigMaps) .Values.existingSecrets -}}
envFrom: &envFrom
{{- if .Values.vars }}
- configMapRef:
name: {{ template "common.robustName" .Release.Name }}
{{- end }}
{{- range .Values.existingSecrets }}
- secretRef:
name: {{ .name }}
optional: {{ .optional | default false }}
{{- end }}
{{- range .Values.existingConfigMaps }}
- configMapRef:
name: {{ .name }}
optional: {{ .optional | default false }}
{{- end }}
{{- if .Values.secretEnabled }}
- secretRef:
name: {{ include "common.robustName" $.Release.Name }}
+3 -3
View File
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: file://../common
version: 0.3.1
digest: sha256:64689b29ef8b2262efbd5d49bccf40f798698d426dcfdc7c632aaf183a8cc681
generated: "2023-08-18T08:34:24.144108449+02:00"
version: 0.4.0
digest: sha256:d4eccd332ada7362f429e04b82022f5605a02e2d3aa7b9fdf8adaf4f6c9e03eb
generated: "2023-10-20T10:53:13.982995773+02:00"
+1 -1
View File
@@ -19,5 +19,5 @@ version: 0.58.0
dependencies:
- name: common
version: 0.3.1
version: 0.4.0
repository: file://../common
Binary file not shown.
Binary file not shown.
+3 -3
View File
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: file://../common
version: 0.3.1
digest: sha256:64689b29ef8b2262efbd5d49bccf40f798698d426dcfdc7c632aaf183a8cc681
generated: "2023-08-18T08:31:18.469039683+02:00"
version: 0.4.0
digest: sha256:d4eccd332ada7362f429e04b82022f5605a02e2d3aa7b9fdf8adaf4f6c9e03eb
generated: "2023-10-20T10:52:47.237955041+02:00"
+1 -1
View File
@@ -19,5 +19,5 @@ version: 0.58.0
dependencies:
- name: common
version: 0.3.1
version: 0.4.0
repository: file://../common
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -138,7 +138,7 @@ spec:
- -c
- {{ .Values.sidecar.command | quote }}
{{- end }}
{{- if or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets }}
{{- if or (or (or (or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets) .Values.secretName) .Values.existingConfigMaps) .Values.existingSecrets }}
envFrom: *envFrom
{{- end }}
{{- if or (or (.Values.volumes) (.Values.sealedFileSecrets)) .Values.fileSecrets }}
@@ -16,5 +16,23 @@ tests:
name: release-name
- it: Should not reference configmap if vars are not set
asserts:
- isNull:
- isNull:
path: spec.template.spec.containers[0].envFrom
- it: Should reference to existing configmaps
set:
existingConfigMaps:
- name: firstcm
optional: true
- name: secondcm
optional: true
asserts:
- contains:
path: spec.template.spec.containers[0].envFrom
content:
configMapRef:
name: firstcm
optional: true
configMapRef:
name: secondcm
optional: true
@@ -31,3 +31,20 @@ tests:
content:
secretRef:
name: release-name
- it: Should reference to existing secrets
set:
existingSecrets:
- name: firstsecret
optional: true
- name: secondsecret
optional: true
asserts:
- contains:
path: spec.template.spec.containers[0].envFrom
content:
secretRef:
name: firstsecret
optional: true
secretRef:
name: secondsecret
optional: true