add persistence and service annotations

This commit is contained in:
James 2023-03-14 21:26:55 +00:00
parent e02c2087da
commit afbb940694
4 changed files with 56 additions and 0 deletions

View File

@ -66,6 +66,17 @@ spec:
value: {{ .Values.config.jvmMemory.limit }}
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 }}

View File

@ -0,0 +1,32 @@
{{- if .Values.persistence.enabled -}}
{{- if not .Values.persistence.existingClaim -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "unifi-controller.fullname" . }}-pvc
labels:
{{- include "unifi-controller.labels" . | nindent 4 }}
# app.kubernetes.io/name: {{ include "unifi-controller.name" . }}
# helm.sh/chart: {{ include "unifi-controller.chart" . }}
# app.kubernetes.io/instance: {{ .Release.Name }}
# app.kubernetes.io/managed-by: {{ .Release.Service }}
# app.kubernetes.io/component: app
{{- if .Values.persistence.annotations }}
annotations:
{{ toYaml .Values.persistence.annotations | indent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}

View File

@ -2,6 +2,10 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "unifi-controller.fullname" . }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "unifi-controller.labels" . | nindent 4 }}
spec:

View File

@ -18,6 +18,14 @@ config:
startup: default
limit: default
persistence:
enabled: false
existingClaim: ""
annotations: {}
accessMode: ReadWriteOnce
storageClass: ""
size: 1Gi
serviceAccount:
# Specifies whether a service account should be created
create: true
@ -42,6 +50,7 @@ securityContext: {}
service:
type: ClusterIP
annotations: {}
ingress:
enabled: false