This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
/
deployment.yaml
executable file
·326 lines (326 loc) · 12.7 KB
/
deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "external-dns.fullname" . }}
labels: {{ include "external-dns.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels: {{ include "external-dns.matchLabels" . | nindent 6 }}
template:
metadata:
{{- if or .Values.podAnnotations .Values.metrics.enabled }}
annotations: {{ include "external-dns.podAnnotations" . | nindent 8 }}
{{- end }}
labels: {{ include "external-dns.labels" . | nindent 8 }}
{{- if or (and .Values.aws.credentials.secretKey .Values.aws.credentials.accessKey) .Values.cloudflare.apiKey .Values.digitalocean.apiToken (and .Values.infoblox.wapiUsername .Values.infoblox.wapiPassword) .Values.rfc2136.tsigSecret .Values.extraEnv .Values.google.serviceAccountKey }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum | trunc 63 }}
{{- end }}
{{- if and (eq .Values.provider "designate") .Values.designate.customCA.enabled }}
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum | trunc 63 }}
{{- end }}
spec:
{{- include "external-dns.imagePullSecrets" . | indent 6 }}
{{- if .Values.podSecurityContext }}
securityContext: {{ toYaml .Values.podSecurityContext | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- if .Values.rbac.create }}
serviceAccountName: {{ template "external-dns.fullname" . }}
{{- else }}
serviceAccountName: {{ .Values.rbac.serviceAccountName | quote }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
containers:
- name: external-dns
image: "{{ template "external-dns.image" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
args:
# Generic arguments
{{- if .Values.logLevel }}
- --log-level={{ .Values.logLevel }}
{{- end }}
{{- if .Values.dryRun }}
- --dry-run
{{- end }}
{{- if .Values.publishInternalServices }}
- --publish-internal-services
{{- end }}
{{- range .Values.domainFilters }}
- --domain-filter={{ . }}
{{- end }}
{{- range .Values.zoneIdFilters }}
- --zone-id-filter={{ . }}
{{- end }}
- --policy={{ .Values.policy }}
- --provider={{ .Values.provider }}
- --registry={{ .Values.registry }}
- --interval={{ .Values.interval }}
{{- if eq .Values.registry "txt" }}
{{- if .Values.txtOwnerId }}
- --txt-owner-id={{ .Values.txtOwnerId }}
{{- end }}
{{- if .Values.txtPrefix }}
- --txt-prefix={{ .Values.txtPrefix }}
{{- end }}
{{- end }}
{{- if .Values.annotationFilter }}
- --annotation-filter={{ .Values.annotationFilter }}
{{- end }}
{{- if .Values.crd.create }}
{{- if .Values.crd.apiversion }}
- --crd-source-apiversion={{ .Values.crd.apiversion }}
{{- end }}
{{- if .Values.crd.kind }}
- --crd-source-kind={{ .Values.crd.kind }}
{{- end }}
{{- end }}
{{- range .Values.istioIngressGateways }}
- --istio-ingress-gateway={{ . }}
{{- end }}
{{- range .Values.sources }}
- --source={{ . }}
{{- end }}
# AWS arguments
{{- if or (eq .Values.provider "aws") (eq .Values.provider "aws-sd") }}
{{- if .Values.aws.zoneType }}
- --aws-zone-type={{ .Values.aws.zoneType }}
{{- end }}
{{- if .Values.aws.assumeRoleArn }}
- --aws-assume-role={{ .Values.aws.assumeRoleArn }}
{{- end }}
{{- if .Values.aws.batchChangeSize }}
- --aws-batch-change-size={{ .Values.aws.batchChangeSize }}
{{- end }}
{{- end }}
# Azure Arguments
{{- if eq .Values.provider "azure" }}
{{- if .Values.azure.resoureGroup }}
- --azure-resource-group={{ .Values.azure.resoureGroup }}
{{- end }}
{{- end }}
# Cloudflare arguments
{{- if eq .Values.provider "cloudflare" }}
{{- if .Values.cloudflare.proxied }}
- --cloudflare-proxied
{{- end }}
{{- end }}
# Google Arguments
{{- if eq .Values.provider "google" }}
- --google-project={{ .Values.google.project }}
{{- end }}
# Infloblox Arguments
{{- if eq .Values.provider "infoblox" }}
- --infoblox-grid-host={{ .Values.infoblox.gridHost }}
{{- if .Values.infoblox.domainFilter }}
- --domain-filter={{ .Values.infoblox.domainFilter }}
{{- end }}
{{- if .Values.infoblox.wapiPort }}
- --infoblox-wapi-port={{ .Values.infoblox.wapiPort }}
{{- end }}
{{- if .Values.infoblox.wapiVersion }}
- --infoblox-wapi-version={{ .Values.infoblox.wapiVersion }}
{{- end }}
{{- if .Values.infoblox.noSslVerify }}
- --no-infoblox-ssl-verify
{{- else }}
- --infoblox-ssl-verify
{{- end }}
{{- end }}
# RFC 2136 arguments
{{- if eq .Values.provider "rfc2136" }}
- --rfc2136-host={{ required "rfc2136.host must be supplied for provider 'rfc2136'" .Values.rfc2136.host }}
- --rfc2136-port={{ .Values.rfc2136.port }}
- --rfc2136-zone={{ required "rfc2136.zone must be supplied for provider 'rfc2136'" .Values.rfc2136.zone }}
{{- if .Values.rfc2136.tsigKeyname }}
- --rfc2136-tsig-secret-alg={{ .Values.rfc2136.tsigSecretAlg }}
- --rfc2136-tsig-keyname={{ .Values.rfc2136.tsigKeyname }}
{{- if .Values.rfc2136.tsigAxfr }}
- --rfc2136-tsig-axfr
{{- end }}
{{- else }}
- --rfc2136-insecure
{{- end }}
{{- end }}
# Extra arguments
{{- range $key, $value := .Values.extraArgs }}
{{- if $value }}
- --{{ $key }}={{ $value }}
{{- else }}
- --{{ $key }}
{{- end }}
{{- end }}
env:
# AWS environment variables
{{- if or (eq .Values.provider "aws") (eq .Values.provider "aws-sd") }}
{{- if .Values.aws.region }}
- name: AWS_DEFAULT_REGION
value: {{ .Values.aws.region }}
{{- end }}
{{- if .Values.aws.roleArn }}
- name: AWS_CONFIG_FILE
value: {{ .Values.aws.credentials.mountPath }}/config
{{- end }}
{{- if and .Values.aws.credentials.secretKey .Values.aws.credentials.accessKey }}
- name: AWS_SHARED_CREDENTIALS_FILE
value: {{ .Values.aws.credentials.mountPath }}/credentials
{{- end }}
{{- end }}
# Cloudflare environment variables
{{- if eq .Values.provider "cloudflare" }}
- name: CF_API_KEY
valueFrom:
secretKeyRef:
name: {{ template "external-dns.fullname" . }}
key: cloudflare_api_key
- name: CF_API_EMAIL
value: {{ .Values.cloudflare.email | quote }}
{{- end }}
# DigitalOcean environment variables
{{- if eq .Values.provider "digitalocean" }}
- name: DO_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "external-dns.fullname" . }}
key: digitalocean_api_token
{{- end }}
# Google environment variables
{{- if eq .Values.provider "google" }}
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/secrets/service-account/credentials.json
{{- end }}
# Infloblox environment variables
{{- if eq .Values.provider "infoblox" }}
{{- if .Values.infoblox.wapiConnectionPoolSize }}
- name: EXTERNAL_DNS_INFOBLOX_HTTP_POOL_CONNECTIONS
value: "{{ .Values.infoblox.wapiConnectionPoolSize }}"
{{- end }}
{{- if .Values.infoblox.wapiHttpTimeout }}
- name: EXTERNAL_DNS_INFOBLOX_HTTP_REQUEST_TIMEOUT
value: "{{ .Values.infoblox.wapiHttpTimeout }}"
{{- end }}
{{- if and .Values.infoblox.wapiUsername .Values.infoblox.wapiPassword }}
- name: EXTERNAL_DNS_INFOBLOX_WAPI_USERNAME
valueFrom:
secretKeyRef:
name: {{ template "external-dns.fullname" . }}
key: infoblox_wapi_username
- name: EXTERNAL_DNS_INFOBLOX_WAPI_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "external-dns.fullname" . }}
key: infoblox_wapi_password
{{- end }}
{{- end }}
# RFC 2136 environment variables
{{- if and .Values.rfc2136.tsigSecret }}
- name: EXTERNAL_DNS_RFC2136_TSIG_SECRET
valueFrom:
secretKeyRef:
name: {{ template "external-dns.fullname" . }}
key: rfc2136_tsig_secret
{{- end }}
{{- if and (eq .Values.provider "designate") .Values.designate.customCA.enabled }}
- name: OPENSTACK_CA_FILE
value: {{ .Values.designate.customCA.mountPath }}/{{ .Values.designate.customCA.filename }}
{{- end }}
# Extra environment variables
{{- $root := . -}}
{{- range .Values.extraEnv }}
- name: {{ .name }}
valueFrom:
{{- if .valueFrom }}
{{ toYaml .valueFrom | indent 12 }}
{{- else }}
secretKeyRef:
name: {{ template "external-dns.fullname" $root }}
key: {{ .name }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
readinessProbe: {{ toYaml .Values.readinessProbe | nindent 10 }}
livenessProbe: {{ toYaml .Values.livenessProbe | nindent 10 }}
{{- if .Values.securityContext }}
securityContext: {{ toYaml .Values.securityContext | nindent 10 }}
{{- end }}
{{- if .Values.resources }}
resources: {{ toYaml .Values.resources | nindent 10 }}
{{- end }}
volumeMounts:
# AWS mountPath(s)
{{- if and (eq .Values.provider "aws") (or .Values.aws.assumeRoleArn (and .Values.aws.credentials.secretKey .Values.aws.credentials.accessKey)) }}
- name: aws-credentials
mountPath: {{ .Values.aws.credentials.mountPath }}
readOnly: true
{{- end }}
# Azure mountPath(s)
{{- if eq .Values.provider "azure" }}
- name: azure-config-file
{{- if not .Values.azure.secretName }}
mountPath: /etc/kubernetes/azure.json
{{- else }}
mountPath: /etc/kubernetes/
{{- end }}
readOnly: true
{{- end }}
# Google mountPath(s)
{{- if eq .Values.provider "google" }}
- name: google-service-account
mountPath: /etc/secrets/service-account/
{{- end }}
# Designate mountPath(s)
{{- if and (eq .Values.provider "designate") .Values.designate.customCA.enabled }}
- name: designate-custom-ca
mountPath: {{ .Values.designate.customCA.mountPath }}
readOnly: true
{{- end }}
volumes:
# AWS volume(s)
{{- if and (eq .Values.provider "aws") (or .Values.aws.assumeRoleArn (and .Values.aws.credentials.secretKey .Values.aws.credentials.accessKey)) }}
- name: aws-credentials
secret:
secretName: {{ template "external-dns.fullname" . }}
{{- end }}
# Azure volume(s)
{{- if eq .Values.provider "azure" }}
- name: azure-config-file
{{- if (not .Values.azure.secretName) }}
hostPath:
path: /etc/kubernetes/azure.json
type: File
{{- else }}
secret:
secretName: {{ .Values.azure.secretName }}
{{- end }}
{{- end }}
# Google volume(s)
{{- if eq .Values.provider "google" }}
- name: google-service-account
secret:
{{- if .Values.google.serviceAccountSecret }}
secretName: {{ .Values.google.serviceAccountSecret | quote }}
{{- else }}
secretName: {{ template "external-dns.fullname" . }}
{{- end }}
{{- end }}
# Designate volume(s)
{{- if and (eq .Values.provider "designate") .Values.designate.customCA.enabled }}
- name: designate-custom-ca
configMap:
name: {{ template "external-dns.fullname" . }}
items:
- key: {{ .Values.designate.customCA.filename }}
path: {{ .Values.designate.customCA.filename }}
{{- end }}