| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- apiVersion: apps/v1
- kind: Deployment
- metadata:
- name: {{ template "nextcloud.fullname" . }}
- labels:
- app.kubernetes.io/name: {{ include "nextcloud.name" . }}
- helm.sh/chart: {{ include "nextcloud.chart" . }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- app.kubernetes.io/managed-by: {{ .Release.Service }}
- app.kubernetes.io/component: app
- {{- if .Values.deploymentAnnotations }}
- annotations:
- {{ toYaml .Values.deploymentAnnotations | indent 4 }}
- {{- end }}
- spec:
- replicas: {{ .Values.replicaCount }}
- strategy:
- type: {{ .Values.nextcloud.strategy }}
- selector:
- matchLabels:
- app.kubernetes.io/name: {{ include "nextcloud.name" . }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- app.kubernetes.io/component: app
- template:
- metadata:
- labels:
- app.kubernetes.io/name: {{ include "nextcloud.name" . }}
- app.kubernetes.io/instance: {{ .Release.Name }}
- app.kubernetes.io/component: app
- {{- if .Values.podAnnotations }}
- annotations:
- {{ toYaml .Values.podAnnotations | indent 8 }}
- {{- end }}
- spec:
- {{- if .Values.image.pullSecrets }}
- imagePullSecrets:
- {{- range .Values.image.pullSecrets }}
- - name: {{ . }}
- {{- end}}
- {{- end }}
- containers:
- - name: {{ .Chart.Name }}
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
- imagePullPolicy: {{ .Values.image.pullPolicy }}
- {{- if .Values.lifecycle }}
- lifecycle:
- {{- if .Values.lifecycle.postStartCommand }}
- postStart:
- exec:
- command:
- {{- toYaml .Values.lifecycle.postStartCommand | nindent 16 -}}
- {{- end }}
- {{- if .Values.lifecycle.preStopCommand }}
- preStop:
- exec:
- command:
- {{- toYaml .Values.lifecycle.preStopCommand | nindent 16 -}}
- {{- end }}
- {{- end }}
- env:
- {{- if .Values.internalDatabase.enabled }}
- - name: SQLITE_DATABASE
- value: {{ .Values.internalDatabase.name | quote }}
- {{- else }}
- {{- if eq .Values.externalDatabase.type "postgresql" }}
- - name: POSTGRES_HOST
- value: {{ .Values.externalDatabase.host | quote }}
- - name: POSTGRES_DB
- value: {{ .Values.externalDatabase.database | quote }}
- - name: POSTGRES_USER
- valueFrom:
- secretKeyRef:
- name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
- key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }}
- - name: POSTGRES_PASSWORD
- valueFrom:
- secretKeyRef:
- name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
- key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }}
- {{- else }}
- - name: MYSQL_HOST
- value: {{ .Values.externalDatabase.host | quote }}
- - name: MYSQL_DATABASE
- value: {{ .Values.externalDatabase.database | quote }}
- - name: MYSQL_USER
- valueFrom:
- secretKeyRef:
- name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
- key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }}
- - name: MYSQL_PASSWORD
- valueFrom:
- secretKeyRef:
- name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
- key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }}
- {{- end }}
- {{- end }}
- - name: NEXTCLOUD_ADMIN_USER
- valueFrom:
- secretKeyRef:
- name: {{ template "nextcloud.fullname" . }}
- key: nextcloud-username
- - name: NEXTCLOUD_ADMIN_PASSWORD
- valueFrom:
- secretKeyRef:
- name: {{ template "nextcloud.fullname" . }}
- key: nextcloud-password
- - name: NEXTCLOUD_TRUSTED_DOMAINS
- value: {{ .Values.nextcloud.host }}
- {{- if ne (int .Values.nextcloud.update) 0 }}
- - name: NEXTCLOUD_UPDATE
- value: {{ .Values.nextcloud.update | quote }}
- {{- end }}
- - name: NEXTCLOUD_DATA_DIR
- value: {{ .Values.nextcloud.datadir | quote }}
- {{- if .Values.nextcloud.tableprefix }}
- - name: NEXTCLOUD_TABLE_PREFIX
- value: {{ .Values.nextcloud.tableprefix | quote }}
- {{- end }}
- {{- if .Values.nextcloud.mail.enabled }}
- - name: MAIL_FROM_ADDRESS
- value: {{ .Values.nextcloud.mail.fromAddress | quote }}
- - name: MAIL_DOMAIN
- value: {{ .Values.nextcloud.mail.domain | quote }}
- - name: SMTP_HOST
- value: {{ .Values.nextcloud.mail.smtp.host | quote }}
- - name: SMTP_SECURE
- value: {{ .Values.nextcloud.mail.smtp.secure | quote }}
- - name: SMTP_PORT
- value: {{ .Values.nextcloud.mail.smtp.port | quote }}
- - name: SMTP_AUTHTYPE
- value: {{ .Values.nextcloud.mail.smtp.authtype | quote }}
- - name: SMTP_NAME
- valueFrom:
- secretKeyRef:
- name: {{ template "nextcloud.fullname" . }}
- key: smtp-username
- - name: SMTP_PASSWORD
- valueFrom:
- secretKeyRef:
- name: {{ template "nextcloud.fullname" . }}
- key: smtp-password
- {{- end }}
- {{- if .Values.nextcloud.extraEnv }}
- {{ toYaml .Values.nextcloud.extraEnv | indent 8 }}
- {{- end }}
- {{- if not .Values.nginx.enabled }}
- ports:
- - name: http
- containerPort: 80
- protocol: TCP
- {{- end }}
- {{- if and .Values.livenessProbe.enabled (not .Values.nginx.enabled) }}
- livenessProbe:
- httpGet:
- path: /status.php
- port: http
- httpHeaders:
- - name: Host
- value: {{ .Values.nextcloud.host | quote }}
- initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
- periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
- timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
- successThreshold: {{ .Values.livenessProbe.successThreshold }}
- failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
- {{- end }}
- {{- if and .Values.readinessProbe.enabled (not .Values.nginx.enabled) }}
- readinessProbe:
- httpGet:
- path: /status.php
- port: http
- httpHeaders:
- - name: Host
- value: {{ .Values.nextcloud.host | quote }}
- initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
- periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
- timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
- successThreshold: {{ .Values.readinessProbe.successThreshold }}
- failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
- {{- end }}
- resources:
- {{ toYaml .Values.resources | indent 10 }}
- volumeMounts:
- - name: nextcloud-data
- mountPath: /var/www/
- subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/html
- subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: {{ .Values.nextcloud.datadir }}
- subPath: {{ ternary "data" (printf "%s/%s" .Values.nextcloud.persistence.subPath "data") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/html/config
- subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/html/custom_apps
- subPath: {{ ternary "custom_apps" (printf "%s/%s" .Values.nextcloud.persistence.subPath "custom_apps") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/tmp
- subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/html/themes
- subPath: {{ ternary "themes" (printf "%s/%s" .Values.nextcloud.persistence.subPath "themes") (empty .Values.nextcloud.persistence.subPath) }}
- {{- range $key, $value := .Values.nextcloud.configs }}
- - name: nextcloud-config
- mountPath: /var/www/html/config/{{ $key }}
- subPath: {{ $key }}
- {{- end }}
- {{- if .Values.nextcloud.configs }}
- {{- range $key, $value := .Values.nextcloud.defaultConfigs }}
- {{- if $value }}
- - name: nextcloud-config
- mountPath: /var/www/html/config/{{ $key }}
- subPath: {{ $key }}
- {{- end }}
- {{- end }}
- {{- end }}
- {{- range $key, $value := .Values.nextcloud.phpConfigs }}
- - name: nextcloud-phpconfig
- mountPath: /usr/local/etc/php/conf.d/{{ $key }}
- subPath: {{ $key }}
- {{- end }}
- {{- if .Values.nextcloud.extraVolumeMounts }}
- {{ toYaml .Values.nextcloud.extraVolumeMounts | indent 8 }}
- {{- end }}
- {{- if .Values.nginx.enabled }}
- - name: {{ .Chart.Name }}-nginx
- image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}"
- imagePullPolicy: {{ .Values.nginx.image.pullPolicy }}
- ports:
- - name: http
- containerPort: 80
- protocol: TCP
- {{- if .Values.livenessProbe.enabled }}
- livenessProbe:
- httpGet:
- path: /status.php
- port: http
- httpHeaders:
- - name: Host
- value: {{ .Values.nextcloud.host | quote }}
- initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
- periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
- timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
- successThreshold: {{ .Values.livenessProbe.successThreshold }}
- failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
- {{- end }}
- {{- if .Values.readinessProbe.enabled }}
- readinessProbe:
- httpGet:
- path: /status.php
- port: http
- httpHeaders:
- - name: Host
- value: {{ .Values.nextcloud.host | quote }}
- initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
- periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
- timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
- successThreshold: {{ .Values.readinessProbe.successThreshold }}
- failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
- {{- end }}
- resources:
- {{ toYaml .Values.nginx.resources | indent 10 }}
- volumeMounts:
- - name: nextcloud-data
- mountPath: /var/www/
- subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/html
- subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: {{ .Values.nextcloud.datadir }}
- subPath: {{ ternary "data" (printf "%s/%s" .Values.nextcloud.persistence.subPath "data") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/html/config
- subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/html/custom_apps
- subPath: {{ ternary "custom_apps" (printf "%s/%s" .Values.nextcloud.persistence.subPath "custom_apps") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/tmp
- subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-data
- mountPath: /var/www/html/themes
- subPath: {{ ternary "themes" (printf "%s/%s" .Values.nextcloud.persistence.subPath "themes") (empty .Values.nextcloud.persistence.subPath) }}
- - name: nextcloud-nginx-config
- mountPath: /etc/nginx/nginx.conf
- subPath: nginx.conf
- {{- 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 }}
- volumes:
- - name: nextcloud-data
- {{- if ne (include "configuredHostPath" .) "" }}
- hostPath:
- path: {{ template "configuredHostPath" . }}
- {{- else }}
- emptyDir: {}
- {{- end }}
- {{- if .Values.nextcloud.configs }}
- - name: nextcloud-config
- configMap:
- name: {{ template "nextcloud.fullname" . }}-config
- {{- end }}
- {{- if .Values.nextcloud.phpConfigs }}
- - name: nextcloud-phpconfig
- configMap:
- name: {{ template "nextcloud.fullname" . }}-phpconfig
- {{- end }}
- {{- if .Values.nginx.enabled }}
- - name: nextcloud-nginx-config
- configMap:
- name: {{ template "nextcloud.fullname" . }}-nginxconfig
- {{- end }}
- {{- if .Values.nextcloud.extraVolumes }}
- {{ toYaml .Values.nextcloud.extraVolumes | indent 6 }}
- {{- end }}
- {{- if .Values.nginx.enabled }}
- # Will mount configuration files as www-data (id: 82) for nextcloud
- securityContext:
- fsGroup: 82
- {{- else }}
- # Will mount configuration files as www-data (id: 33) for nextcloud
- securityContext:
- fsGroup: 33
- {{- end }}
|