charts/charts/netbox/templates/deployment-housekeeping.yaml

78 lines
2.5 KiB
YAML

{{- if .Values.housekeeping.enabled -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "netbox.fullname" . }}-housekeeping
labels:
{{- include "netbox.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "netbox.fullname" . }}-housekeeping
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configuration.yaml") . | sha256sum }}
labels:
app: {{ include "netbox.fullname" . }}-housekeeping
spec:
containers:
- name: {{ .Chart.Name }}-housekeeping
command:
- /opt/netbox/housekeeping.sh
image: "{{ .Values.image.repository }}:{{ include "netbox.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: HOME
value: /tmp
envFrom:
- configMapRef:
name: {{ include "netbox.fullname" . }}
- secretRef:
name: {{ .Values.existingSecret }}
{{- with .Values.extraEnvFrom -}}
{{ . | toYaml | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.housekeeping.resources | nindent 12 }}
{{- if or .Values.extraConfiguration .Values.extraPlugins }}
volumeMounts:
{{- if .Values.extraConfiguration }}
- name: netbox-extra-config
mountPath: /etc/netbox/config/extra.py
subPath: extra.py
{{- end }}
{{- if .Values.extraPlugins }}
- name: netbox-extra-plugins
mountPath: /etc/netbox/config/plugins.py
subPath: plugins.py
{{- end }}
{{- end }}
{{- with .Values.housekeeping.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if or .Values.extraConfiguration .Values.extraPlugins }}
{{- if .Values.extraConfiguration }}
- name: netbox-extra-config
configMap:
name: {{ .Chart.Name }}-extra
{{- end }}
{{- if .Values.extraPlugins }}
- name: netbox-extra-plugins
configMap:
name: {{ .Chart.Name }}-plugins
{{- end }}
{{- end }}
{{- with .Values.housekeeping.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.housekeeping.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end -}}