1apiVersion: apps/v1
2kind: Deployment
3metadata:
4  name: istiocoredns
5  namespace: {{ .Release.Namespace }}
6  labels:
7    app: istiocoredns
8    release: {{ .Release.Name }}
9spec:
10  replicas: {{ .Values.istiocoredns.replicaCount }}
11  selector:
12    matchLabels:
13      app: istiocoredns
14  strategy:
15    rollingUpdate:
16      maxSurge: {{ .Values.istiocoredns.rollingMaxSurge }}
17      maxUnavailable: {{ .Values.istiocoredns.rollingMaxUnavailable }}
18  template:
19    metadata:
20      name: istiocoredns
21      labels:
22        app: istiocoredns
23        release: {{ .Release.Name }}
24      annotations:
25        sidecar.istio.io/inject: "false"
26        {{- if .Values.istiocoredns.podAnnotations }}
27{{ toYaml .Values.istiocoredns.podAnnotations | indent 8 }}
28        {{- end }}
29    spec:
30      serviceAccountName: istiocoredns-service-account
31{{- if .Values.global.priorityClassName }}
32      priorityClassName: "{{ .Values.global.priorityClassName }}"
33{{- end }}
34      containers:
35      - name: coredns
36        image: {{ .Values.istiocoredns.coreDNSImage }}:{{ .Values.istiocoredns.coreDNSTag }}
37{{- if .Values.global.imagePullPolicy }}
38        imagePullPolicy: {{ .Values.global.imagePullPolicy }}
39{{- end }}
40        args: [ "-conf", "/etc/coredns/Corefile" ]
41        volumeMounts:
42        - name: config-volume
43          mountPath: /etc/coredns
44        ports:
45        - containerPort: 53
46          name: dns
47          protocol: UDP
48        - containerPort: 53
49          name: dns-tcp
50          protocol: TCP
51        - containerPort: 9153
52          name: metrics
53          protocol: TCP
54        livenessProbe:
55          httpGet:
56            path: /health
57            port: 8080
58            scheme: HTTP
59          initialDelaySeconds: 60
60          timeoutSeconds: 5
61          successThreshold: 1
62          failureThreshold: 5
63        resources:
64{{- if .Values.istiocoredns.resources }}
65{{ toYaml .Values.istiocoredns.resources | indent 10 }}
66{{- else }}
67{{ toYaml .Values.global.defaultResources | indent 10 }}
68{{- end }}
69      - name: istio-coredns-plugin
70        command:
71        - /usr/local/bin/plugin
72        image: {{ .Values.istiocoredns.coreDNSPluginImage }}
73{{- if .Values.global.imagePullPolicy }}
74        imagePullPolicy: {{ .Values.global.imagePullPolicy }}
75{{- end }}
76        ports:
77        - containerPort: 8053
78          name: dns-grpc
79          protocol: TCP
80        resources:
81{{- if .Values.istiocoredns.resources }}
82{{ toYaml .Values.istiocorednsresources | indent 10 }}
83{{- else }}
84{{ toYaml .Values.global.defaultResources | indent 10 }}
85{{- end }}
86      dnsPolicy: Default
87      volumes:
88      - name: config-volume
89        configMap:
90          name: coredns
91          items:
92          - key: Corefile
93            path: Corefile
94      affinity:
95      {{- include "nodeaffinity" . | indent 6 }}
96      {{- include "podAntiAffinity" . | indent 6 }}
97{{- if .Values.istiocoredns.tolerations }}
98      tolerations:
99{{ toYaml .Values.istiocoredns.tolerations | indent 6 }}
100{{- else if .Values.global.defaultTolerations }}
101      tolerations:
102{{ toYaml .Values.global.defaultTolerations | indent 6 }}
103{{- end }}
104