charts/charts/netbox/templates/deployment.yaml

108 lines
3.4 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "netbox.fullname" . }}-app
labels:
{{- include "netbox.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "netbox.fullname" . }}-app
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configuration.yaml") . | sha256sum }}
labels:
app: {{ include "netbox.fullname" . }}-app
spec:
containers:
- name: {{ .Chart.Name }}
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 }}
ports:
- name: http
containerPort: 8080
protocol: TCP
{{- with .Values.livenessProbe }}
livenessProbe:
{{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.startupProbe }}
startupProbe:
{{ toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /opt/netbox/netbox/media
subPath: media
- name: data
mountPath: /opt/netbox/netbox/reports
subPath: reports
- name: data
mountPath: /opt/netbox/netbox/scripts
subPath: scripts
{{- 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 }}
{{- with .Values.extraVolumeMounts }}
{{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "netbox.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end }}
{{- 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 }}
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}