Files
k8s-at-home-charts/charts/stable/blocky/templates/deployment.yaml
2021-03-18 13:11:24 +01:00

121 lines
4.2 KiB
YAML

{{- $blockyConfig := .Values.config | fromYaml }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "blocky.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "blocky.name" . }}
helm.sh/chart: {{ include "blocky.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicas }}
revisionHistoryLimit: 3
selector:
matchLabels:
app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "blocky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{ toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- if .Values.timeZone }}
- name: TZ
value: {{ .Values.timeZone | quote }}
{{- end }}
volumeMounts:
- name: config
mountPath: /app/config.yml
subPath: config.yml
readOnly: true
{{- range $name, $value := .Values.extraLists }}
- name: config
mountPath: /app/{{ $name }}
subPath: {{ $name }}
readOnly: true
{{- end }}
{{- if hasKey $blockyConfig "queryLog" }}
- name: data
mountPath: {{ $blockyConfig.queryLog.dir }}
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- end }}
{{- end }}
ports:
- name: api
containerPort: 4000
- name: dns
containerPort: 53
protocol: TCP
- name: dns-udp
containerPort: 53
protocol: UDP
livenessProbe:
httpGet:
path: /
port: api
failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
readinessProbe:
httpGet:
path: /
port: api
failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
startupProbe:
httpGet:
path: /
port: api
initialDelaySeconds: {{ .Values.probes.startup.initialDelaySeconds }}
failureThreshold: {{ .Values.probes.startup.failureThreshold }}
periodSeconds: {{ .Values.probes.startup.periodSeconds }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: config
projected:
defaultMode: 0444
sources:
- configMap:
name: {{ template "blocky.fullname" . }}
items:
- key: config.yml
path: config.yml
{{- range $name, $value := .Values.extraLists }}
- key: {{ $name }}
path: {{ $name }}
{{- end }}
{{- if hasKey $blockyConfig "queryLog" }}
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "blocky.fullname" . }}{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}