k8s-charts/charts/unifi-controller/templates/deployment.yaml

115 lines
3.9 KiB
YAML
Raw Normal View History

2023-03-26 20:16:41 +00:00
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "unifi-controller.fullname" . }}
labels:
{{- include "unifi-controller.labels" . | nindent 4 }}
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "unifi-controller.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "unifi-controller.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "unifi-controller.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
- name: https
containerPort: 8443
protocol: TCP
- name: stun
containerPort: 3478
protocol: UDP
- name: l2discover
containerPort: 1900
protocol: UDP
- name: syslog
containerPort: 5514
protocol: UDP
livenessProbe:
httpGet:
path: /
port: http
periodSeconds: 10
startupProbe:
httpGet:
path: /
port: http
periodSeconds: 10
failureThreshold: 30
env:
- name: TZ
value: {{ .Values.config.timezone }}
- name: MEM_STARTUP
value: {{ .Values.config.jvmMemory.startup }}
- name: MEM_LIMIT
value: {{ .Values.config.jvmMemory.limit }}
- name: MONGO_HOST
value: {{ include "unifi-controller.mongodb.host" . }}
- name: MONGO_PORT
value: {{ include "unifi-controller.mongodb.port" . | quote }}
- name: MONGO_USER
value: {{ include "unifi-controller.mongodb.username" . }}
{{- if or .Values.mongodb.enabled .Values.externalMongodb.existingSecret }}
- name: MONGO_PASS
valueFrom:
secretKeyRef:
{{- if .Values.mongodb.enabled }}
name: {{ .Values.mongodb.existingSecret | default (include "unifi-controller.mongodb.fullname" .) }}
key: mongodb-passwords
{{- else }}
name: {{ .Values.externalMongodb.existingSecret }}
key: {{ .Values.externalMongodb.existingSecretPasswordKey }}
{{- end }}
{{- end }}
- name: MONGO_DBNAME
value: {{ include "unifi-controller.mongodb.database" . }}
2023-03-26 20:16:41 +00:00
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: unifi-config
mountPath: /config
volumes:
- name: unifi-config
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "unifi-controller.fullname" . }}-pvc{{- end }}
{{- else }}
emptyDir: {}
{{- 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 }}