Skip to content

Commit cc1c5f5

Browse files
committed
Helm chart support for provider images
1 parent 438d06f commit cc1c5f5

File tree

6 files changed

+179
-76
lines changed

6 files changed

+179
-76
lines changed

charts/external-dns/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424

2525
- Added the option to explicitly enable or disable service account token automounting. ([#3983](https://github.com/kubernetes-sigs/external-dns/pull/3983)) [@gilles-gosuin](https://github.com/gilles-gosuin)
2626
- Added the option to configure revisionHistoryLimit on the K8s Deployment resource. ([#4008](https://github.com/kubernetes-sigs/external-dns/pull/4008)) [@arnisoph](https://github.com/arnisoph)
27+
- Added support for webhook sidecars.
2728

2829
## [v1.13.1] - 2023-09-07
2930

charts/external-dns/README.md

Lines changed: 75 additions & 67 deletions
Large diffs are not rendered by default.

charts/external-dns/templates/_helpers.tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,17 @@ The image to use
7070
{{- define "external-dns.image" -}}
7171
{{- printf "%s:%s" .Values.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.image.tag) }}
7272
{{- end }}
73+
74+
{{/*
75+
Keep backward compatibility on provider
76+
*/}}
77+
{{- define "external-dns.providername" -}}
78+
{{- if eq (typeOf .Values.provider) "string" }}
79+
{{- .Values.provider }}
80+
{{- if contains "/" .Values.provider }}
81+
{{- fail "A provider image must be specified as provider.name" }}
82+
{{- end }}
83+
{{- else }}
84+
{{- .Values.provider.name }}
85+
{{- end }}
86+
{{- end }}

charts/external-dns/templates/deployment.yaml

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- $providername := include "external-dns.providername" . }}
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
@@ -103,7 +104,11 @@ spec:
103104
{{- range .Values.domainFilters }}
104105
- --domain-filter={{ . }}
105106
{{- end }}
106-
- --provider={{ tpl .Values.provider $ }}
107+
{{- if contains "/" $providername }}
108+
- --provider=webhook
109+
{{- else }}
110+
- --provider={{ tpl $providername $ }}
111+
{{- end }}
107112
{{- range .Values.extraArgs }}
108113
- {{ tpl . $ }}
109114
{{- end }}
@@ -115,9 +120,9 @@ spec:
115120
{{- toYaml .Values.livenessProbe | nindent 12 }}
116121
readinessProbe:
117122
{{- toYaml .Values.readinessProbe | nindent 12 }}
118-
{{- if or .Values.secretConfiguration.enabled .Values.extraVolumeMounts }}
123+
{{- if or .Values.secretConfiguration.mountPath .Values.extraVolumeMounts }}
119124
volumeMounts:
120-
{{- if .Values.secretConfiguration.enabled }}
125+
{{- if .Values.secretConfiguration.mountPath }}
121126
- name: secrets
122127
mountPath: {{ tpl .Values.secretConfiguration.mountPath $ }}
123128
{{- with .Values.secretConfiguration.subPath }}
@@ -132,9 +137,51 @@ spec:
132137
resources:
133138
{{- toYaml . | nindent 12 }}
134139
{{- end }}
135-
{{- if or .Values.secretConfiguration.enabled .Values.extraVolumes }}
140+
{{- if contains "/" $providername }}
141+
- name: provider
142+
{{- with .Values.securityContext }}
143+
securityContext:
144+
{{- toYaml . | nindent 12 }}
145+
{{- end }}
146+
image: {{ tpl $providername $ }}
147+
imagePullPolicy: {{ .Values.image.pullPolicy }}
148+
{{- with .Values.provider.env }}
149+
env:
150+
{{- toYaml . | nindent 12 }}
151+
{{- end }}
152+
args:
153+
{{- range .Values.provider.args }}
154+
- {{ tpl . $ }}
155+
{{- end }}
156+
ports:
157+
- name: provider-metrics
158+
protocol: TCP
159+
containerPort: 8080
160+
livenessProbe:
161+
{{- toYaml .Values.provider.livenessProbe | nindent 12 }}
162+
readinessProbe:
163+
{{- toYaml .Values.provider.readinessProbe | nindent 12 }}
164+
{{- if or .Values.provider.secretConfiguration.mountPath .Values.provider.extraVolumeMounts }}
165+
volumeMounts:
166+
{{- if .Values.provider.secretConfiguration.mountPath }}
167+
- name: secrets
168+
mountPath: {{ tpl .Values.provider.secretConfiguration.mountPath $ }}
169+
{{- with .Values.provider.secretConfiguration.subPath }}
170+
subPath: {{ tpl . $ }}
171+
{{- end }}
172+
{{- end }}
173+
{{- with .Values.provider.extraVolumeMounts }}
174+
{{- toYaml . | nindent 12 }}
175+
{{- end }}
176+
{{- end }}
177+
{{- with .Values.provider.resources }}
178+
resources:
179+
{{- toYaml . | nindent 12 }}
180+
{{- end }}
181+
{{- end }}
182+
{{- if or .Values.secretConfiguration.mountPath (and (contains "/" $providername) .Values.provider.secretConfiguration.mountPath) .Values.extraVolumes }}
136183
volumes:
137-
{{- if .Values.secretConfiguration.enabled }}
184+
{{- if or .Values.secretConfiguration.mountPath (and (contains "/" $providername) .Values.provider.secretConfiguration.mountPath) }}
138185
- name: secrets
139186
secret:
140187
secretName: {{ include "external-dns.fullname" . }}

charts/external-dns/values.schema.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"$schema": "http://json-schema.org/draft-07/schema",
33
"type": "object",
44
"properties": {
5-
"provider": {
6-
"type": "string"
7-
},
85
"extraArgs": {
96
"type": "array",
107
"items": {

charts/external-dns/values.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,43 @@ txtSuffix: ""
180180

181181
domainFilters: []
182182

183-
provider: aws
183+
provider:
184+
# The name of the DNS provider. This can be either a built-in provider or a provider image to run as a sidecar container.
185+
name: "aws"
186+
# Arguments to pass to the provider container (these can be templated).
187+
args: []
188+
# [Environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the provider container; this supports the full [EnvVar](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#envvar-v1-core) API including secrets and configmaps.
189+
env: []
190+
# Additional volume mounts for the provider container; this supports the full [VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#volumemount-v1-core) API.
191+
extraVolumeMounts: []
192+
# [Liveness probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) for the provider container; this supports the full [Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#probe-v1-core) API.
193+
livenessProbe:
194+
httpGet:
195+
path: /healthz
196+
port: provider-metrics
197+
initialDelaySeconds: 10
198+
periodSeconds: 10
199+
timeoutSeconds: 5
200+
failureThreshold: 2
201+
successThreshold: 1
202+
# [Readiness probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) for the webhook container; this supports the full [Probe](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#probe-v1-core) API.
203+
readinessProbe:
204+
httpGet:
205+
path: /healthz
206+
port: provider-metrics
207+
initialDelaySeconds: 5
208+
periodSeconds: 10
209+
timeoutSeconds: 5
210+
failureThreshold: 6
211+
successThreshold: 1
212+
# Resource requests and limits for the provider container; this supports the full [ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#resourcerequirements-v1-core) API.
213+
resources: {}
214+
215+
secretConfiguration:
216+
# Mount path of secret configuration secret in the provider container (this can be templated).
217+
mountPath: ""
218+
# Sub-path of secret configuration secret in the provider container (this can be templated).
219+
subPath: ""
184220

185221
extraArgs: []
186222

0 commit comments

Comments
 (0)