From f645c4059a0e310decf97bee97af6b5b485d24db Mon Sep 17 00:00:00 2001 From: WrenIX Date: Sat, 11 Nov 2023 15:07:29 +0100 Subject: [PATCH 01/11] chore: cleanup deployment.yaml Signed-off-by: WrenIX --- charts/nextcloud/templates/deployment.yaml | 590 +++++++++++---------- charts/nextcloud/values.yaml | 4 +- 2 files changed, 298 insertions(+), 296 deletions(-) diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index 6834f68f..3ca1dfc9 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -8,17 +9,17 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: app - {{- if .Values.deploymentLabels }} -{{ toYaml .Values.deploymentLabels | indent 4 }} - {{- end }} - {{- if .Values.deploymentAnnotations }} + {{- with .Values.deploymentLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.deploymentAnnotations }} annotations: -{{ toYaml .Values.deploymentAnnotations | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} spec: replicas: {{ .Values.replicaCount }} strategy: -{{ toYaml .Values.nextcloud.strategy | indent 4 }} + {{- toYaml .Values.nextcloud.strategy | nindent 4 }} selector: matchLabels: app.kubernetes.io/name: {{ include "nextcloud.name" . }} @@ -33,8 +34,8 @@ spec: {{- if .Values.redis.enabled }} {{ template "nextcloud.redis.fullname" . }}-client: "true" {{- end }} - {{- if .Values.podLabels }} -{{ toYaml .Values.podLabels | indent 8 }} + {{- with .Values.podLabels }} + {{- toYaml .Values.podLabels | nindent 8 }} {{- end }} annotations: nextcloud-config-hash: {{ print (toJson .Values.nextcloud.defaultConfigs) "-" (toJson .Values.nextcloud.configs) | sha256sum }} @@ -42,315 +43,322 @@ spec: {{- if .Values.nginx.enabled }} nginx-config-hash: {{ print .Values.nginx.config.default "-" .Values.nginx.config.custom | sha256sum }} {{- end }} - {{- if .Values.podAnnotations }} -{{ toYaml .Values.podAnnotations | indent 8 }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} {{- end }} spec: - {{- if .Values.image.pullSecrets }} + {{- with .Values.image.pullSecrets }} imagePullSecrets: - {{- range .Values.image.pullSecrets }} + {{- range . }} - name: {{ . }} - {{- end}} + {{- end}} {{- end }} containers: - - name: {{ .Chart.Name }} - image: {{ include "nextcloud.image" . }} - 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: -{{- include "nextcloud.env" . | indent 8 }} - {{- if not .Values.nginx.enabled }} - ports: - - name: http - containerPort: {{ .Values.nextcloud.containerPort }} - protocol: TCP - {{- end }} - {{- if and .Values.livenessProbe.enabled (not .Values.nginx.enabled) }} - livenessProbe: - httpGet: - path: /status.php - port: {{ .Values.nextcloud.containerPort }} - 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: {{ .Values.nextcloud.containerPort }} - 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 }} - {{- if and .Values.startupProbe.enabled (not .Values.nginx.enabled) }} - startupProbe: - httpGet: - path: /status.php - port: {{ .Values.nextcloud.containerPort }} - httpHeaders: - - name: Host - value: {{ .Values.nextcloud.host | quote }} - initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.startupProbe.periodSeconds }} - timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }} - successThreshold: {{ .Values.startupProbe.successThreshold }} - failureThreshold: {{ .Values.startupProbe.failureThreshold }} - {{- end }} - resources: -{{ toYaml .Values.resources | indent 10 }} - {{- if .Values.nextcloud.securityContext}} - securityContext: + - name: {{ .Chart.Name }} + image: {{ include "nextcloud.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.lifecycle }} + lifecycle: + {{- with .postStartCommand }} + postStart: + exec: + command: + {{- toYaml . | nindent 18 -}} + {{- end }} + {{- with .preStopCommand }} + preStop: + exec: + command: + {{- toYaml . | nindent 18 -}} + {{- end }} + {{- end }} + env: + {{- include "nextcloud.env" . | nindent 12 }} + {{- if not .Values.nginx.enabled }} + ports: + - name: http + containerPort: {{ .Values.nextcloud.containerPort }} + protocol: TCP + {{- with .Values.livenessProbe }} + {{- if .enabled }} + livenessProbe: + httpGet: + path: /status.php + port: {{ $.Values.nextcloud.containerPort }} + httpHeaders: + - name: Host + value: {{ $.Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} + {{- with .Values.readinessProbe }} + {{- if .enabled }} + readinessProbe: + httpGet: + path: /status.php + port: {{ $.Values.nextcloud.containerPort }} + httpHeaders: + - name: Host + value: {{ $.Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} + {{- with .Values.startupProbe }} + {{- if .enabled }} + startupProbe: + httpGet: + path: /status.php + port: {{ $.Values.nextcloud.containerPort }} + httpHeaders: + - name: Host + value: {{ $.Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} + {{- end }}{{/* end-if not nginx */}} + resources: + {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nextcloud.securityContext }} - {{- toYaml . | nindent 10 }} + securityContext: + {{- toYaml . | nindent 12 }} {{- end }} - {{- end }} - volumeMounts: - {{- include "nextcloud.volumeMounts" . | trim | nindent 8 }} - {{- if .Values.cronjob.enabled }} - - name: {{ .Chart.Name }}-cron - image: {{ include "nextcloud.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - command: - - /cron.sh - {{- if .Values.cronjob.lifecycle }} - lifecycle: - {{- if .Values.cronjob.lifecycle.postStartCommand }} - postStart: - exec: - command: - {{- toYaml .Values.cronjob.lifecycle.postStartCommand | nindent 16 -}} - {{- end }} - {{- if .Values.cronjob.lifecycle.preStopCommand }} - preStop: - exec: - command: - {{- toYaml .Values.cronjob.lifecycle.preStopCommand | nindent 16 -}} - {{- end }} - {{- end }} - env: -{{- include "nextcloud.env" . | indent 8 }} - resources: -{{ toYaml .Values.cronjob.resources | indent 10 }} - {{- if .Values.cronjob.securityContext}} - securityContext: - {{- with .Values.cronjob.securityContext }} - {{- toYaml . | nindent 10 }} + volumeMounts: + {{- include "nextcloud.volumeMounts" . | trim | nindent 12 }} + {{- 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 + protocol: TCP + containerPort: {{ .Values.nextcloud.containerPort }} + {{- with .Values.livenessProbe }} + {{- if .enabled }} + livenessProbe: + httpGet: + path: /status.php + port: {{ $.Values.nextcloud.containerPort }} + httpHeaders: + - name: Host + value: {{ $.Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} {{- end }} - {{- end }} - volumeMounts: -{{- include "nextcloud.volumeMounts" . | trim | nindent 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: {{ .Values.nextcloud.containerPort }} - 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: {{ .Values.nextcloud.containerPort }} - 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 }} - {{- if .Values.startupProbe.enabled }} - startupProbe: - httpGet: - path: /status.php - port: {{ .Values.nextcloud.containerPort }} - httpHeaders: - - name: Host - value: {{ .Values.nextcloud.host | quote }} - initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.startupProbe.periodSeconds }} - timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }} - successThreshold: {{ .Values.startupProbe.successThreshold }} - failureThreshold: {{ .Values.startupProbe.failureThreshold }} - {{- end }} + {{- end }} + {{- with .Values.readinessProbe }} + {{- if .enabled }} + readinessProbe: + httpGet: + path: /status.php + port: {{ $.Values.nextcloud.containerPort }} + httpHeaders: + - name: Host + value: {{ $.Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} + {{- with .Values.startupProbe }} + {{- if .enabled }} + startupProbe: + httpGet: + path: /status.php + port: {{ $.Values.nextcloud.containerPort }} + httpHeaders: + - name: Host + value: {{ $.Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }} + {{- end }} - resources: -{{ toYaml .Values.nginx.resources | indent 10 }} - {{- if .Values.nginx.securityContext}} - securityContext: + resources: + {{- toYaml .Values.nginx.resources | nindent 12 }} {{- with .Values.nginx.securityContext }} - {{- toYaml . | nindent 10 }} + securityContext: + {{- toYaml . | nindent 12 }} {{- end }} + volumeMounts: + - name: nextcloud-main + mountPath: /var/www/ + subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-main + mountPath: /var/www/html + subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }} + {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} + - name: nextcloud-data + mountPath: {{ .Values.nextcloud.datadir }} + subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.nextcloudData.subPath "data") (empty .Values.persistence.nextcloudData.subPath) }} + {{- else }} + - name: nextcloud-main + mountPath: {{ .Values.nextcloud.datadir }} + subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.subPath "data") (empty .Values.persistence.subPath) }} + {{- end }} + - name: nextcloud-main + mountPath: /var/www/html/config + subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-main + 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-main + mountPath: /var/www/tmp + subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-main + 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 + {{- with .Values.nextcloud.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} - volumeMounts: - - name: nextcloud-main - mountPath: /var/www/ - subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-main - mountPath: /var/www/html - subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }} - {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} - - name: nextcloud-data - mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.nextcloudData.subPath "data") (empty .Values.persistence.nextcloudData.subPath) }} - {{- else }} - - name: nextcloud-main - mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.subPath "data") (empty .Values.persistence.subPath) }} + {{- if .Values.cronjob.enabled }} + - name: {{ .Chart.Name }}-cron + image: {{ include "nextcloud.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + - /cron.sh + {{- with .Values.cronjob.lifecycle }} + lifecycle: + {{- with .postStartCommand }} + postStart: + exec: + command: + {{- toYaml . | nindent 18 -}} + {{- end }} + {{- with .preStopCommand }} + preStop: + exec: + command: + {{- toYaml . | nindent 18 -}} + {{- end }} + {{- end }} + env: + {{- include "nextcloud.env" . | nindent 12 }} + resources: + {{- toYaml .Values.cronjob.resources | nindent 12 }} + {{- with .Values.cronjob.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- include "nextcloud.volumeMounts" . | trim | nindent 12 }} {{- end }} - - name: nextcloud-main - mountPath: /var/www/html/config - subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-main - 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-main - mountPath: /var/www/tmp - subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-main - 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 - {{- if .Values.nextcloud.extraVolumeMounts }} - {{- toYaml .Values.nextcloud.extraVolumeMounts | nindent 8 }} + {{- with .Values.nextcloud.extraSidecarContainers }} + {{- toYaml . | nindent 8 }} {{- end }} - {{- end }} - {{- with .Values.nextcloud.extraSidecarContainers }} - {{- toYaml . | nindent 6 }} - {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- if or .Values.nextcloud.extraInitContainers .Values.mariadb.enabled .Values.postgresql.enabled }} initContainers: - {{- if .Values.nextcloud.extraInitContainers }} - {{- toYaml .Values.nextcloud.extraInitContainers | nindent 6 }} - {{- end }} - {{- if .Values.mariadb.enabled }} - - name: mariadb-isalive - image: {{ .Values.mariadb.image.registry }}/{{ .Values.mariadb.image.repository }}:{{ .Values.mariadb.image.tag }} - env: - - 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" }} - command: - - "sh" - - "-c" - - {{ printf "until mysql --host=%s-mariadb --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --execute=\"SELECT 1;\"; do echo waiting for mysql; sleep 2; done;" .Release.Name }} - {{- else if .Values.postgresql.enabled }} - - name: postgresql-isready - image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }} - env: - - 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_HOST - value: {{ template "postgresql.v1.primary.fullname" .Subcharts.postgresql }} - command: - - "sh" - - "-c" - - "until pg_isready -h ${POSTGRES_HOST} -U ${POSTGRES_USER} ; do sleep 2 ; done" - {{- end }} + {{- with .Values.nextcloud.extraInitContainers }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.mariadb.enabled }} + - name: mariadb-isalive + image: {{ .Values.mariadb.image.registry }}/{{ .Values.mariadb.image.repository }}:{{ .Values.mariadb.image.tag }} + env: + - name: MYSQL_USER + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey }} + - name: MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.passwordKey }} + command: + - "sh" + - "-c" + - {{ printf "until mysql --host=%s-mariadb --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --execute=\"SELECT 1;\"; do echo waiting for mysql; sleep 2; done;" .Release.Name }} + {{- else if .Values.postgresql.enabled }} + - name: postgresql-isready + image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }} + env: + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey }} + - name: POSTGRES_HOST + value: {{ template "postgresql.v1.primary.fullname" .Subcharts.postgresql }} + command: + - "sh" + - "-c" + - "until pg_isready -h ${POSTGRES_HOST} -U ${POSTGRES_USER} ; do sleep 2 ; done" + {{- end }} {{- end }} - {{- with .Values.affinity }} + {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} + {{- end }} + {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} - volumes: - - name: nextcloud-main - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} - {{- else }} - emptyDir: {} - {{- end }} - {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} - - name: nextcloud-data - persistentVolumeClaim: - claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }} - {{- 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 }} + volumes: + - name: nextcloud-main + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} + {{- else }} + emptyDir: {} + {{- end }} + {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} + - name: nextcloud-data + persistentVolumeClaim: + claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }} + {{- 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 }} + {{- with .Values.nextcloud.extraVolumes }} + {{- toYaml . | nindent 6 }} + {{- end }} securityContext: - {{- if .Values.nextcloud.podSecurityContext }} - {{- with .Values.nextcloud.podSecurityContext }} - {{- toYaml . | nindent 8 }} + {{- with .Values.securityContext }} + {{- toYaml . | nindent 8 }} {{- end }} - {{- else }} + {{- with .Values.nextcloud.podSecurityContext }} + {{- toYaml . | nindent 8 }} + {{- else }} {{- if .Values.nginx.enabled }} # Will mount configuration files as www-data (id: 82) for nextcloud fsGroup: 82 @@ -358,12 +366,6 @@ spec: # Will mount configuration files as www-data (id: 33) for nextcloud fsGroup: 33 {{- end }} - {{- if .Values.securityContext }} - {{- with .Values.securityContext }} - {{- toYaml . | nindent 8 }} - {{- end }} - {{- end }} - {{- end }} {{- if .Values.rbac.enabled }} serviceAccountName: {{ .Values.rbac.serviceaccount.name }} {{- end }} diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index 4d4d93c4..f5fc145a 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -261,8 +261,8 @@ externalDatabase: existingSecret: enabled: false # secretName: nameofsecret - # usernameKey: db-username - # passwordKey: db-password + usernameKey: db-username + passwordKey: db-password # hostKey: db-hostname-or-ip # databaseKey: db-name From 977ba5ff68d0720a8f03b53df8117af16ac88d29 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Sat, 11 Nov 2023 15:11:15 +0100 Subject: [PATCH 02/11] chore: cleanup config.yaml Signed-off-by: WrenIX --- charts/nextcloud/templates/config.yaml | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/charts/nextcloud/templates/config.yaml b/charts/nextcloud/templates/config.yaml index 2e811f16..6976741a 100644 --- a/charts/nextcloud/templates/config.yaml +++ b/charts/nextcloud/templates/config.yaml @@ -9,12 +9,12 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} data: -{{- range $key, $value := .Values.nextcloud.configs }} + {{- range $key, $value := .Values.nextcloud.configs }} {{ $key }}: |- -{{ $value | indent 4 }} -{{- end }} -{{- if .Values.nextcloud.defaultConfigs }} -{{- if index .Values.nextcloud.defaultConfigs ".htaccess" }} + {{ $value | nindent 4 }} + {{- end }} + {{- if .Values.nextcloud.defaultConfigs }} + {{- if index .Values.nextcloud.defaultConfigs ".htaccess" }} .htaccess: |- # line below if for Apache 2.4 @@ -28,8 +28,8 @@ data: IndexIgnore * -{{- end }} -{{- if index .Values.nextcloud.defaultConfigs "redis.config.php" }} + {{- end }} + {{- if index .Values.nextcloud.defaultConfigs "redis.config.php" }} redis.config.php: |- array( 'host' => getenv('REDIS_HOST'), 'port' => getenv('REDIS_HOST_PORT') ?: 6379, -{{- if .Values.redis.auth.enabled }} + {{- if .Values.redis.auth.enabled }} 'password' => getenv('REDIS_HOST_PASSWORD'), -{{- end }} + {{- end }} ), ); } -{{- end }} -{{- if index .Values.nextcloud.defaultConfigs "apache-pretty-urls.config.php" }} + {{- end }} + {{- if index .Values.nextcloud.defaultConfigs "apache-pretty-urls.config.php" }} apache-pretty-urls.config.php: |- '/', ); -{{- end }} -{{- if index .Values.nextcloud.defaultConfigs "apcu.config.php" }} + {{- end }} + {{- if index .Values.nextcloud.defaultConfigs "apcu.config.php" }} apcu.config.php: |- '\OC\Memcache\APCu', ); -{{- end }} -{{- if index .Values.nextcloud.defaultConfigs "apps.config.php" }} + {{- end }} + {{- if index .Values.nextcloud.defaultConfigs "apps.config.php" }} apps.config.php: |- getenv('MAIL_DOMAIN'), ); } -{{- end }} -{{- end }} -{{- end }} + {{- end }} + {{- end }}{{/* end-if defaultConfigs */}} + {{- end }}{{/* end-if configs */}} From df1a32e6eeb318704e7bdccb578b05c76a024257 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Sat, 11 Nov 2023 15:16:07 +0100 Subject: [PATCH 03/11] chore: cleanup db-secret.yaml Signed-off-by: WrenIX --- charts/nextcloud/templates/db-secret.yaml | 16 ++++++++-------- charts/nextcloud/values.yaml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/charts/nextcloud/templates/db-secret.yaml b/charts/nextcloud/templates/db-secret.yaml index 1a4eaf4c..377acd79 100644 --- a/charts/nextcloud/templates/db-secret.yaml +++ b/charts/nextcloud/templates/db-secret.yaml @@ -3,23 +3,23 @@ apiVersion: v1 kind: Secret metadata: - name: {{ printf "%s-%s" .Release.Name "db" }} + name: {{ .Release.Name }}-db 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 }} type: Opaque -data: +stringData: {{- if .Values.mariadb.enabled }} - db-password: {{ default "" .Values.mariadb.auth.password | b64enc | quote }} - db-username: {{ default "" .Values.mariadb.auth.username | b64enc | quote }} + db-username: {{ .Values.mariadb.auth.username | quote }} + db-password: {{ .Values.mariadb.auth.password | quote }} {{- else if .Values.postgresql.enabled }} - db-password: {{ default "" .Values.postgresql.global.postgresql.auth.password | b64enc | quote }} - db-username: {{ default "" .Values.postgresql.global.postgresql.auth.username | b64enc | quote }} + db-username: {{ .Values.postgresql.global.postgresql.auth.username | quote }} + db-password: {{ .Values.postgresql.global.postgresql.auth.password | quote }} {{- else }} - db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} - db-username: {{ default "" .Values.externalDatabase.user | b64enc | quote }} + db-username: {{ .Values.externalDatabase.user | quote }} + db-password: {{ .Values.externalDatabase.password | quote }} {{- end }} {{- end }} {{- end }} diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index f5fc145a..fba90238 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -252,7 +252,7 @@ externalDatabase: user: nextcloud ## Database password - password: + password: "" ## Database name database: nextcloud From 712aab10a64769e64e1ba41d206838f24887fa9b Mon Sep 17 00:00:00 2001 From: WrenIX Date: Sat, 11 Nov 2023 15:33:29 +0100 Subject: [PATCH 04/11] chore: revert db-secret.yaml stringData Signed-off-by: WrenIX --- charts/nextcloud/templates/db-secret.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/charts/nextcloud/templates/db-secret.yaml b/charts/nextcloud/templates/db-secret.yaml index 377acd79..dcc3129a 100644 --- a/charts/nextcloud/templates/db-secret.yaml +++ b/charts/nextcloud/templates/db-secret.yaml @@ -10,16 +10,16 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} type: Opaque -stringData: +data: {{- if .Values.mariadb.enabled }} - db-username: {{ .Values.mariadb.auth.username | quote }} - db-password: {{ .Values.mariadb.auth.password | quote }} + db-username: {{ .Values.mariadb.auth.username | b64enc | quote }} + db-password: {{ .Values.mariadb.auth.password | b64enc | quote }} {{- else if .Values.postgresql.enabled }} - db-username: {{ .Values.postgresql.global.postgresql.auth.username | quote }} - db-password: {{ .Values.postgresql.global.postgresql.auth.password | quote }} + db-username: {{ .Values.postgresql.global.postgresql.auth.username | b64enc | quote }} + db-password: {{ .Values.postgresql.global.postgresql.auth.password | b64enc | quote }} {{- else }} - db-username: {{ .Values.externalDatabase.user | quote }} - db-password: {{ .Values.externalDatabase.password | quote }} + db-username: {{ .Values.externalDatabase.user | b64enc | quote }} + db-password: {{ .Values.externalDatabase.password | b64enc | quote }} {{- end }} {{- end }} {{- end }} From 4fd85233c3d4dc0f7a6296b688a7afe7d57c6ef5 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Sat, 11 Nov 2023 15:46:59 +0100 Subject: [PATCH 05/11] chore: cleanup _helper.yaml for database Signed-off-by: WrenIX --- charts/nextcloud/templates/_helpers.tpl | 42 ++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/charts/nextcloud/templates/_helpers.tpl b/charts/nextcloud/templates/_helpers.tpl index e0d899d8..f7bce87c 100644 --- a/charts/nextcloud/templates/_helpers.tpl +++ b/charts/nextcloud/templates/_helpers.tpl @@ -28,7 +28,7 @@ Create a default fully qualified redis app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "nextcloud.redis.fullname" -}} -{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}} +{{- printf "%s-redis" .Release.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -80,13 +80,13 @@ Create environment variables used to configure the nextcloud container as well a - 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: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey }} - 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" }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.passwordKey }} {{- else if .Values.postgresql.enabled }} - name: POSTGRES_HOST value: {{ template "postgresql.v1.primary.fullname" .Subcharts.postgresql }} @@ -99,20 +99,20 @@ Create environment variables used to configure the nextcloud container as well a - 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: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey }} - 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" }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.passwordKey }} {{- else }} {{- if eq .Values.externalDatabase.type "postgresql" }} - name: POSTGRES_HOST {{- if .Values.externalDatabase.existingSecret.hostKey }} valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.hostKey }} {{- else }} value: {{ .Values.externalDatabase.host | quote }} @@ -121,7 +121,7 @@ Create environment variables used to configure the nextcloud container as well a {{- if .Values.externalDatabase.existingSecret.databaseKey }} valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.databaseKey }} {{- else }} value: {{ .Values.externalDatabase.database | quote }} @@ -129,19 +129,19 @@ Create environment variables used to configure the nextcloud container as well a - 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: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey }} - 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" }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.passwordKey }} {{- else }} - name: MYSQL_HOST {{- if .Values.externalDatabase.existingSecret.hostKey }} valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.hostKey }} {{- else }} value: {{ .Values.externalDatabase.host | quote }} @@ -150,7 +150,7 @@ Create environment variables used to configure the nextcloud container as well a {{- if .Values.externalDatabase.existingSecret.databaseKey }} valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.databaseKey }} {{- else }} value: {{ .Values.externalDatabase.database | quote }} @@ -158,13 +158,13 @@ Create environment variables used to configure the nextcloud container as well a - 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: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey }} - 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" }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.passwordKey }} {{- end }} {{- end }} - name: NEXTCLOUD_ADMIN_USER From 44bf2bb9f18d5e7ec98072a5a898086c682fd5d7 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Sat, 11 Nov 2023 15:51:47 +0100 Subject: [PATCH 06/11] chore: cleanup nextcloud-key to default Signed-off-by: WrenIX --- charts/nextcloud/templates/_helpers.tpl | 10 +++++----- charts/nextcloud/templates/metrics-deployment.yaml | 6 +++--- charts/nextcloud/values.yaml | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/charts/nextcloud/templates/_helpers.tpl b/charts/nextcloud/templates/_helpers.tpl index f7bce87c..a6b055c8 100644 --- a/charts/nextcloud/templates/_helpers.tpl +++ b/charts/nextcloud/templates/_helpers.tpl @@ -171,12 +171,12 @@ Create environment variables used to configure the nextcloud container as well a valueFrom: secretKeyRef: name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.usernameKey | default "nextcloud-username" }} + key: {{ .Values.nextcloud.existingSecret.usernameKey }} - name: NEXTCLOUD_ADMIN_PASSWORD valueFrom: secretKeyRef: name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.passwordKey | default "nextcloud-password" }} + key: {{ .Values.nextcloud.existingSecret.passwordKey }} - name: NEXTCLOUD_TRUSTED_DOMAINS value: {{ .Values.nextcloud.host }} {{- if ne (int .Values.nextcloud.update) 0 }} @@ -200,17 +200,17 @@ Create environment variables used to configure the nextcloud container as well a valueFrom: secretKeyRef: name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.smtpHostKey | default "smtp-host" }} + key: {{ .Values.nextcloud.existingSecret.smtpHostKey }} - name: SMTP_NAME valueFrom: secretKeyRef: name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.smtpUsernameKey | default "smtp-username" }} + key: {{ .Values.nextcloud.existingSecret.smtpUsernameKey }} - name: SMTP_PASSWORD valueFrom: secretKeyRef: name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.smtpPasswordKey | default "smtp-password" }} + key: {{ .Values.nextcloud.existingSecret.smtpPasswordKey }} {{- end }} {{- if .Values.redis.enabled }} - name: REDIS_HOST diff --git a/charts/nextcloud/templates/metrics-deployment.yaml b/charts/nextcloud/templates/metrics-deployment.yaml index e4c71853..ea30e918 100644 --- a/charts/nextcloud/templates/metrics-deployment.yaml +++ b/charts/nextcloud/templates/metrics-deployment.yaml @@ -43,18 +43,18 @@ spec: valueFrom: secretKeyRef: name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.tokenKey | default "nextcloud-token" }} + key: {{ .Values.nextcloud.existingSecret.tokenKey }} {{- else }} - name: NEXTCLOUD_USERNAME valueFrom: secretKeyRef: name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.usernameKey | default "nextcloud-username" }} + key: {{ .Values.nextcloud.existingSecret.usernameKey }} - name: NEXTCLOUD_PASSWORD valueFrom: secretKeyRef: name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.passwordKey | default "nextcloud-password" }} + key: {{ .Values.nextcloud.existingSecret.passwordKey }} {{- end }} # NEXTCLOUD_SERVER is used by metrics-exporter to reach the Nextcloud (K8s-)Service to grab the serverinfo api endpoint - name: NEXTCLOUD_SERVER diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index fba90238..12828542 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -78,12 +78,12 @@ nextcloud: existingSecret: enabled: false # secretName: nameofsecret - # usernameKey: nextcloud-username - # passwordKey: nextcloud-password - # tokenKey: nextcloud-token - # smtpUsernameKey: smtp-username - # smtpPasswordKey: smtp-password - # smtpHostKey: smtp-host + usernameKey: nextcloud-username + passwordKey: nextcloud-password + tokenKey: nextcloud-token + smtpUsernameKey: smtp-username + smtpPasswordKey: smtp-password + smtpHostKey: smtp-host update: 0 # If web server is not binding default port, you can define it containerPort: 80 From c6d2ccfb44a24370aec72bc3d90bf7d36e8bd5e7 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Sat, 11 Nov 2023 15:56:44 +0100 Subject: [PATCH 07/11] chore: put know string into printf Signed-off-by: WrenIX --- charts/nextcloud/templates/_helpers.tpl | 16 ++++++++-------- charts/nextcloud/templates/deployment.yaml | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/charts/nextcloud/templates/_helpers.tpl b/charts/nextcloud/templates/_helpers.tpl index a6b055c8..d250589c 100644 --- a/charts/nextcloud/templates/_helpers.tpl +++ b/charts/nextcloud/templates/_helpers.tpl @@ -242,31 +242,31 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con {{- define "nextcloud.volumeMounts" -}} - name: nextcloud-main mountPath: /var/www/ - subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "root" (printf "%s/root" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/html - subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "html" (printf "%s/html" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} - name: nextcloud-data mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.nextcloudData.subPath "data") (empty .Values.persistence.nextcloudData.subPath) }} + subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.nextcloudData.subPath) (empty .Values.persistence.nextcloudData.subPath) }} {{- else }} - name: nextcloud-main mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.subPath "data") (empty .Values.persistence.subPath) }} + subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.subPath) (empty .Values.persistence.subPath) }} {{- end }} - name: nextcloud-main mountPath: /var/www/html/config - subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "config" (printf "%s/config" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/html/custom_apps - subPath: {{ ternary "custom_apps" (printf "%s/%s" .Values.nextcloud.persistence.subPath "custom_apps") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "custom_apps" (printf "%s/custom_apps" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/tmp - subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "tmp" (printf "%s/tmp" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/html/themes - subPath: {{ ternary "themes" (printf "%s/%s" .Values.nextcloud.persistence.subPath "themes") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "themes" (printf "%s/themes" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} {{- range $key, $value := .Values.nextcloud.configs }} - name: nextcloud-config mountPath: /var/www/html/config/{{ $key }} diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index 3ca1dfc9..baba977f 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -202,31 +202,31 @@ spec: volumeMounts: - name: nextcloud-main mountPath: /var/www/ - subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "root" (printf "%s/root" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/html - subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "html" (printf "%s/html" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} - name: nextcloud-data mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.nextcloudData.subPath "data") (empty .Values.persistence.nextcloudData.subPath) }} + subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.nextcloudData.subPath) (empty .Values.persistence.nextcloudData.subPath) }} {{- else }} - name: nextcloud-main mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.subPath "data") (empty .Values.persistence.subPath) }} + subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.subPath) (empty .Values.persistence.subPath) }} {{- end }} - name: nextcloud-main mountPath: /var/www/html/config - subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "config" (printf "%s/config" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/html/custom_apps - subPath: {{ ternary "custom_apps" (printf "%s/%s" .Values.nextcloud.persistence.subPath "custom_apps") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "custom_apps" (printf "%s/custom_apps" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/tmp - subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "tmp" (printf "%s/tmp" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/html/themes - subPath: {{ ternary "themes" (printf "%s/%s" .Values.nextcloud.persistence.subPath "themes") (empty .Values.nextcloud.persistence.subPath) }} + subPath: {{ ternary "themes" (printf "%s/themes" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-nginx-config mountPath: /etc/nginx/nginx.conf subPath: nginx.conf From 097619e0f00dd39a97493ec57c392acec4322b57 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Sat, 11 Nov 2023 15:57:24 +0100 Subject: [PATCH 08/11] fix: dump version after several cleanups Signed-off-by: WrenIX --- charts/nextcloud/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nextcloud/Chart.yaml b/charts/nextcloud/Chart.yaml index ebae207d..0a55845f 100644 --- a/charts/nextcloud/Chart.yaml +++ b/charts/nextcloud/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: nextcloud -version: 4.5.0 +version: 4.5.1 appVersion: 27.1.3 description: A file sharing server that puts the control and security of your own data back into your hands. keywords: From a83c707045e67a95978071da2b9fee3319c83e49 Mon Sep 17 00:00:00 2001 From: WrenIX <133280015+wrenix@users.noreply.github.com> Date: Sun, 12 Nov 2023 20:05:57 +0100 Subject: [PATCH 09/11] chore: fix end after cleanup Signed-off-by: WrenIX <133280015+wrenix@users.noreply.github.com> --- charts/nextcloud/templates/deployment.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index baba977f..e208f95e 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -366,6 +366,7 @@ spec: # Will mount configuration files as www-data (id: 33) for nextcloud fsGroup: 33 {{- end }} + {{- end }}{{/* end-with podSecurityContext */}} {{- if .Values.rbac.enabled }} serviceAccountName: {{ .Values.rbac.serviceaccount.name }} {{- end }} From 60b6047fd41987be8912203d2ad465195b3d31dd Mon Sep 17 00:00:00 2001 From: WrenIX <133280015+wrenix@users.noreply.github.com> Date: Sun, 12 Nov 2023 22:41:47 +0100 Subject: [PATCH 10/11] chore: add some comments for helm-end Signed-off-by: WrenIX <133280015+wrenix@users.noreply.github.com> --- charts/nextcloud/templates/deployment.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index e208f95e..33b5f0e9 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -127,7 +127,7 @@ spec: failureThreshold: {{ .failureThreshold }} {{- end }} {{- end }} - {{- end }}{{/* end-if not nginx */}} + {{- end }}{{/* end-if not nginx.enabled */}} resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nextcloud.securityContext }} @@ -233,7 +233,7 @@ spec: {{- with .Values.nextcloud.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} - {{- end }} + {{- end }}{{/* end-if nginx.enabled */}} {{- if .Values.cronjob.enabled }} - name: {{ .Chart.Name }}-cron image: {{ include "nextcloud.image" . }} @@ -265,7 +265,7 @@ spec: {{- end }} volumeMounts: {{- include "nextcloud.volumeMounts" . | trim | nindent 12 }} - {{- end }} + {{- end }}{{/* end-if cronjob.enabled */}} {{- with .Values.nextcloud.extraSidecarContainers }} {{- toYaml . | nindent 8 }} {{- end }} @@ -311,8 +311,8 @@ spec: - "sh" - "-c" - "until pg_isready -h ${POSTGRES_HOST} -U ${POSTGRES_USER} ; do sleep 2 ; done" - {{- end }} - {{- end }} + {{- end }}{{/* end-if any database-initContainer */}} + {{- end }}{{/* end-if any initContainer */}} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} From befc166f0e4223da5d647ed6fde3a27aa00f0574 Mon Sep 17 00:00:00 2001 From: WrenIX <133280015+wrenix@users.noreply.github.com> Date: Tue, 14 Nov 2023 08:00:58 +0100 Subject: [PATCH 11/11] chore: remove spaces inside of golang template Co-authored-by: Kate <26026535+provokateurin@users.noreply.github.com> Signed-off-by: WrenIX <133280015+wrenix@users.noreply.github.com> --- charts/nextcloud/templates/deployment.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index 33b5f0e9..5b44e8bc 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -59,18 +59,18 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} {{- with .Values.lifecycle }} lifecycle: - {{- with .postStartCommand }} + {{- with .postStartCommand }} postStart: exec: command: {{- toYaml . | nindent 18 -}} - {{- end }} - {{- with .preStopCommand }} + {{- end }} + {{- with .preStopCommand }} preStop: exec: command: {{- toYaml . | nindent 18 -}} - {{- end }} + {{- end }} {{- end }} env: {{- include "nextcloud.env" . | nindent 12 }} @@ -242,18 +242,18 @@ spec: - /cron.sh {{- with .Values.cronjob.lifecycle }} lifecycle: - {{- with .postStartCommand }} + {{- with .postStartCommand }} postStart: exec: command: {{- toYaml . | nindent 18 -}} - {{- end }} - {{- with .preStopCommand }} + {{- end }} + {{- with .preStopCommand }} preStop: exec: command: {{- toYaml . | nindent 18 -}} - {{- end }} + {{- end }} {{- end }} env: {{- include "nextcloud.env" . | nindent 12 }}