mirror of
https://github.com/notherealmarco/coredns-deployment.git
synced 2025-03-14 14:16:16 +01:00
141 lines
4.5 KiB
YAML
141 lines
4.5 KiB
YAML
|
apiVersion: apps/v1
|
||
|
kind: Deployment
|
||
|
metadata:
|
||
|
name: {{ template "coredns.fullname" . }}
|
||
|
labels:
|
||
|
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||
|
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||
|
{{- if .Values.isClusterService }}
|
||
|
k8s-app: {{ .Chart.Name | quote }}
|
||
|
kubernetes.io/cluster-service: "true"
|
||
|
kubernetes.io/name: "CoreDNS"
|
||
|
{{- end }}
|
||
|
app.kubernetes.io/name: {{ template "coredns.name" . }}
|
||
|
{{- if .Values.customLabels }}
|
||
|
{{ toYaml .Values.customLabels | indent 4 }}
|
||
|
{{- end }}
|
||
|
spec:
|
||
|
{{- if not .Values.autoscaler.enabled }}
|
||
|
replicas: {{ .Values.replicaCount }}
|
||
|
{{- end }}
|
||
|
strategy:
|
||
|
type: RollingUpdate
|
||
|
rollingUpdate:
|
||
|
maxUnavailable: {{ .Values.rollingUpdate.maxUnavailable }}
|
||
|
maxSurge: {{ .Values.rollingUpdate.maxSurge }}
|
||
|
selector:
|
||
|
matchLabels:
|
||
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||
|
{{- if .Values.isClusterService }}
|
||
|
k8s-app: {{ .Chart.Name | quote }}
|
||
|
{{- end }}
|
||
|
app.kubernetes.io/name: {{ template "coredns.name" . }}
|
||
|
template:
|
||
|
metadata:
|
||
|
labels:
|
||
|
{{- if .Values.isClusterService }}
|
||
|
k8s-app: {{ .Chart.Name | quote }}
|
||
|
{{- end }}
|
||
|
app.kubernetes.io/name: {{ template "coredns.name" . }}
|
||
|
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||
|
{{- if .Values.customLabels }}
|
||
|
{{ toYaml .Values.customLabels }}
|
||
|
{{- end }}
|
||
|
annotations:
|
||
|
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||
|
{{- if .Values.isClusterService }}
|
||
|
scheduler.alpha.kubernetes.io/critical-pod: ''
|
||
|
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
|
||
|
{{- end }}
|
||
|
{{- if .Values.podAnnotations }}
|
||
|
{{ toYaml .Values.podAnnotations | indent 8 }}
|
||
|
{{- end }}
|
||
|
spec:
|
||
|
{{- if .Values.terminationGracePeriodSeconds }}
|
||
|
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||
|
{{- end }}
|
||
|
serviceAccountName: {{ template "coredns.serviceAccountName" . }}
|
||
|
{{- if .Values.priorityClassName }}
|
||
|
priorityClassName: {{ .Values.priorityClassName | quote }}
|
||
|
{{- end }}
|
||
|
{{- if .Values.isClusterService }}
|
||
|
dnsPolicy: Default
|
||
|
{{- end }}
|
||
|
{{- if .Values.affinity }}
|
||
|
affinity:
|
||
|
{{ toYaml .Values.affinity | indent 8 }}
|
||
|
{{- end }}
|
||
|
{{- if .Values.tolerations }}
|
||
|
tolerations:
|
||
|
{{ toYaml .Values.tolerations | indent 8 }}
|
||
|
{{- end }}
|
||
|
{{- if .Values.nodeSelector }}
|
||
|
nodeSelector:
|
||
|
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||
|
{{- end }}
|
||
|
containers:
|
||
|
- name: "coredns"
|
||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||
|
args: [ "-conf", "/etc/coredns/Corefile" ]
|
||
|
volumeMounts:
|
||
|
- name: config-volume
|
||
|
mountPath: /etc/coredns
|
||
|
{{- range .Values.extraSecrets }}
|
||
|
- name: {{ .name }}
|
||
|
mountPath: {{ .mountPath }}
|
||
|
readOnly: true
|
||
|
{{- end }}
|
||
|
{{- if .Values.extraVolumeMounts }}
|
||
|
{{- toYaml .Values.extraVolumeMounts | nindent 8}}
|
||
|
{{- end }}
|
||
|
resources:
|
||
|
{{ toYaml .Values.resources | indent 10 }}
|
||
|
ports:
|
||
|
{{ include "coredns.containerPorts" . | indent 8 }}
|
||
|
livenessProbe:
|
||
|
httpGet:
|
||
|
path: /health
|
||
|
port: 8080
|
||
|
scheme: HTTP
|
||
|
initialDelaySeconds: 60
|
||
|
timeoutSeconds: 5
|
||
|
successThreshold: 1
|
||
|
failureThreshold: 5
|
||
|
readinessProbe:
|
||
|
httpGet:
|
||
|
path: /ready
|
||
|
port: 8181
|
||
|
scheme: HTTP
|
||
|
initialDelaySeconds: 10
|
||
|
timeoutSeconds: 5
|
||
|
successThreshold: 1
|
||
|
failureThreshold: 5
|
||
|
{{- if .Values.preStopSleep }}
|
||
|
lifecycle:
|
||
|
preStop:
|
||
|
exec:
|
||
|
command: ["/usr/bin/sleep", "{{ .Values.preStopSleep }}"]
|
||
|
{{- end }}
|
||
|
volumes:
|
||
|
- name: config-volume
|
||
|
configMap:
|
||
|
name: {{ template "coredns.fullname" . }}
|
||
|
items:
|
||
|
- key: Corefile
|
||
|
path: Corefile
|
||
|
{{ range .Values.zoneFiles }}
|
||
|
- key: {{ .filename }}
|
||
|
path: {{ .filename }}
|
||
|
{{ end }}
|
||
|
{{- range .Values.extraSecrets }}
|
||
|
- name: {{ .name }}
|
||
|
secret:
|
||
|
secretName: {{ .name }}
|
||
|
defaultMode: 400
|
||
|
{{- end }}
|
||
|
{{- if .Values.extraVolumes }}
|
||
|
{{ toYaml .Values.extraVolumes | indent 8 }}
|
||
|
{{- end }}
|