ungleich-k8s/apps/knotdns/templates/deployment.yaml
2021-07-18 01:42:12 +02:00

94 lines
1.9 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-knot
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-knot
replicas: 2
template:
metadata:
labels:
app: {{ .Release.Name }}-knot
use-as-service: {{ .Release.Name }}
spec:
initContainers:
containers:
- name: knot
image: cznic/knot:3.0
ports:
- containerPort: 53
volumeMounts:
- name: config
mountPath: "/config"
- name: zones
mountPath: "/zones"
args:
- knotd
volumes:
- name: config
configMap:
name: {{ tpl .Values.identifier . }}-config
- name: zones
configMap:
name: {{ tpl .Values.identifier . }}-zones
---
apiVersion: v1
kind: Service
metadata:
name: {{ tpl .Values.identifier . }}
labels:
app: {{ tpl .Values.identifier . }}
spec:
type: ClusterIP
ports:
- port: 53
protocol: TCP
name: tcp-53
- port: 53
protocol: UDP
name: udp-53
selector:
use-as-service: {{ .Release.Name }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ tpl .Values.identifier . }}-zones
data:
{{ tpl (.Files.Glob "zones/*").AsConfig . | indent 2 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ tpl .Values.identifier . }}-config
data:
knot.conf: |
server:
listen: 0.0.0.0@53
listen: ::@53
log:
- target: stdout
zone:
- domain: place7.ungleich.ch
file: /zones/place7.ungleich.ch
notknot.conf: |
server:
listen: 0.0.0.0@53
listen: ::@53
log:
- target: stdout
zone:
{{ range $path, $_ := .Files.Glob "zones/*" }}
{{- $domain := base $path }}
{{ printf "- domain: %s" $domain | indent 2}}
{{ printf "file: /zones/%s" $domain | indent 4}}
{{ end }}