Skip to content

Commit 0273f73

Browse files
committed
feat(chart): support envFrom
Signed-off-by: Jan Jansen <jan.jansen@gdata.de>
1 parent d38daef commit 0273f73

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed

charts/external-dns/templates/deployment.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ spec:
8585
env:
8686
{{- toYaml . | nindent 12 }}
8787
{{- end }}
88+
{{- with .Values.envFrom }}
89+
envFrom:
90+
{{- toYaml . | nindent 12 }}
91+
{{- end }}
8892
args:
8993
- --log-level={{ .Values.logLevel }}
9094
- --log-format={{ .Values.logFormat }}
@@ -187,6 +191,10 @@ spec:
187191
env:
188192
{{- toYaml . | nindent 12 }}
189193
{{- end }}
194+
{{- with .envFrom }}
195+
envFrom:
196+
{{- toYaml . | nindent 12 }}
197+
{{- end }}
190198
{{- with .args }}
191199
args:
192200
{{- toYaml . | nindent 12 }}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
suite: Deployment env configurations
2+
templates:
3+
- deployment.yaml
4+
release:
5+
namespace: default
6+
tests:
7+
- it: should provide expected default env
8+
asserts:
9+
- isNotNull :
10+
path: spec.template.spec.containers[?(@.name == "external-dns")]
11+
- isNull :
12+
path: spec.template.spec.containers[?(@.name == "external-dns")].env
13+
14+
- it: should copy 'env' into main container
15+
set:
16+
env:
17+
- key: "bla"
18+
value: "foo"
19+
asserts:
20+
- isNotNull :
21+
path: spec.template.spec.containers[?(@.name == "external-dns")]
22+
- equal :
23+
path: spec.template.spec.containers[?(@.name == "external-dns")].env
24+
value:
25+
- key: "bla"
26+
value: "foo"
27+
28+
- it: should provide expected default provider env
29+
set:
30+
provider:
31+
name: webhook
32+
webhook:
33+
image:
34+
repository: "test"
35+
tag: "test"
36+
asserts:
37+
- isNotNull :
38+
path: spec.template.spec.containers[?(@.name == "webhook")]
39+
- isNull :
40+
path: spec.template.spec.containers[?(@.name == "webhook")].env
41+
42+
- it: should copy 'env' into main container
43+
set:
44+
provider:
45+
name: webhook
46+
webhook:
47+
image:
48+
repository: "test"
49+
tag: "test"
50+
env:
51+
- key: "bla"
52+
value: "foo"
53+
asserts:
54+
- isNotNull :
55+
path: spec.template.spec.containers[?(@.name == "webhook")]
56+
- equal :
57+
path: spec.template.spec.containers[?(@.name == "webhook")].env
58+
value:
59+
- key: "bla"
60+
value: "foo"
61+
62+
- it: should provide expected default envFrom
63+
asserts:
64+
- isNotNull :
65+
path: spec.template.spec.containers[?(@.name == "external-dns")]
66+
- isNull :
67+
path: spec.template.spec.containers[?(@.name == "external-dns")].envFrom
68+
69+
- it: should copy 'envFrom' into main container
70+
set:
71+
envFrom:
72+
- configMapRef:
73+
name: env-configmap
74+
asserts:
75+
- isNotNull :
76+
path: spec.template.spec.containers[?(@.name == "external-dns")]
77+
- equal :
78+
path: spec.template.spec.containers[?(@.name == "external-dns")].envFrom
79+
value:
80+
- configMapRef:
81+
name: env-configmap
82+
83+
- it: should provide expected default provider envFrom
84+
set:
85+
provider:
86+
name: webhook
87+
webhook:
88+
image:
89+
repository: "test"
90+
tag: "test"
91+
asserts:
92+
- isNotNull :
93+
path: spec.template.spec.containers[?(@.name == "webhook")]
94+
- isNull :
95+
path: spec.template.spec.containers[?(@.name == "webhook")].envFrom
96+
97+
- it: should copy 'envFrom' into main container
98+
set:
99+
provider:
100+
name: webhook
101+
webhook:
102+
image:
103+
repository: "test"
104+
tag: "test"
105+
envFrom:
106+
- configMapRef:
107+
name: env-configmap
108+
asserts:
109+
- isNotNull :
110+
path: spec.template.spec.containers[?(@.name == "webhook")]
111+
- equal :
112+
path: spec.template.spec.containers[?(@.name == "webhook")].envFrom
113+
value:
114+
- configMapRef:
115+
name: env-configmap

charts/external-dns/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ securityContext:
119119
# -- [Environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the `external-dns` container.
120120
env: []
121121

122+
# -- [Environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the `external-dns` container.
123+
envFrom: []
124+
122125
# -- [Liveness probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) configuration for the `external-dns` container.
123126
# @default -- See _values.yaml_
124127
livenessProbe:
@@ -259,6 +262,8 @@ provider: # @schema type: [object, string]
259262
pullPolicy: IfNotPresent
260263
# -- [Environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the `webhook` container.
261264
env: []
265+
# -- [Environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the `external-dns` container.
266+
envFrom: []
262267
# -- Extra arguments to provide for the `webhook` container.
263268
args: []
264269
# -- Extra [volume mounts](https://kubernetes.io/docs/concepts/storage/volumes/) for the `webhook` container.

0 commit comments

Comments
 (0)