mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-01-30 21:39:04 +00:00
2afb28717e
* add possibility to insert additional env vars * update README.md
156 lines
5.8 KiB
YAML
Executable File
156 lines
5.8 KiB
YAML
Executable File
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "powerdns.fullname" . }}
|
|
labels:
|
|
{{ include "powerdns.labels" . | indent 4 }}
|
|
spec:
|
|
replicas: {{ .Values.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: {{ include "powerdns.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
strategy:
|
|
type: {{ .Values.strategyType }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: {{ include "powerdns.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ template "powerdns.serviceAccountName" . }}
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
image: "{{ .Values.image.repository }}:{{ tpl .Values.image.tag . }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /etc/pdns/conf.d
|
|
env:
|
|
{{- if .Values.postgresql.enabled }}
|
|
- name: AUTOCONF
|
|
value: postgres
|
|
- name: PGSQL_HOST
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "powerdns.fullname" . }}
|
|
key: postgres_host
|
|
- name: PGSQL_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "powerdns.fullname" . }}
|
|
key: postgres_username
|
|
- name: PGSQL_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "powerdns.fullname" . }}
|
|
key: postgres_password
|
|
- name: PGSQL_DB
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "powerdns.fullname" . }}
|
|
key: postgres_database
|
|
- name: PGSQL_DNSSEC
|
|
value: {{if (.Values.powerdns.dnssec)}}"yes"{{else}}"no"{{ end }}
|
|
{{ end }}
|
|
{{- if .Values.mariadb.enabled }}
|
|
- name: AUTOCONF
|
|
value: mysql
|
|
- name: MYSQL_HOST
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "powerdns.fullname" . }}
|
|
key: mysql_host
|
|
- name: MYSQL_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "powerdns.fullname" . }}
|
|
key: mysql_username
|
|
- name: MYSQL_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "powerdns.fullname" . }}
|
|
key: mysql_password
|
|
- name: MYSQL_DB
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "powerdns.fullname" . }}
|
|
key: mysql_database
|
|
- name: MYSQL_DNSSEC
|
|
value: {{if (.Values.powerdns.dnssec)}}"yes"{{else}}"no"{{ end }}
|
|
{{ end }}
|
|
{{- with .Values.powerdns.additionalEnv }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: dns-tcp
|
|
containerPort: 53
|
|
protocol: TCP
|
|
- name: dns-udp
|
|
containerPort: 53
|
|
protocol: UDP
|
|
- name: dns-webserver
|
|
containerPort: 8081
|
|
protocol: TCP
|
|
{{- if .Values.probes.liveness.enabled }}
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: dns-tcp
|
|
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }}
|
|
failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
|
|
timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }}
|
|
{{ end }}
|
|
{{- if .Values.probes.readiness.enabled }}
|
|
readinessProbe:
|
|
tcpSocket:
|
|
port: dns-tcp
|
|
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }}
|
|
failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
|
|
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }}
|
|
{{ end }}
|
|
{{- if .Values.probes.startup.enabled }}
|
|
startupProbe:
|
|
tcpSocket:
|
|
port: dns-tcp
|
|
failureThreshold: {{ .Values.probes.startup.failureThreshold }}
|
|
periodSeconds: {{ .Values.probes.startup.periodSeconds }}
|
|
{{ end }}
|
|
{{- if .Values.mariadb.enabled }}
|
|
lifecycle:
|
|
postStart:
|
|
exec:
|
|
command: ["/bin/sh", "-c", "let a=0; while [ $a -lt 200 ]; do sleep 5; let a=a+1; echo 'Attempt: '$a; if nc -vz {{ printf "%s-%s" .Release.Name "mariadb"}} 3306; then pdnsutil list-zone {{ .Values.powerdns.domain }} 2>/dev/null && break; pdnsutil create-zone {{ .Values.powerdns.domain }}; fi; done"]
|
|
{{ end }}
|
|
{{- if .Values.postgresql.enabled }}
|
|
lifecycle:
|
|
postStart:
|
|
exec:
|
|
command: ["/bin/sh", "-c", "let a=0; while [ $a -lt 200 ]; do sleep 5; let a=a+1; echo 'Attempt: '$a; if nc -vz {{ printf "%s-%s" .Release.Name "postgresql"}} 5432; then pdnsutil list-zone {{ .Values.powerdns.domain }} 2>/dev/null && break; pdnsutil create-zone {{ .Values.powerdns.domain }}; fi; done"]
|
|
{{ end }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: {{ template "powerdns.fullname" . }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|