diff --git a/charts/nextcloud/Chart.yaml b/charts/nextcloud/Chart.yaml index d5d28e2a..2a66956b 100644 --- a/charts/nextcloud/Chart.yaml +++ b/charts/nextcloud/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: nextcloud -version: 4.5.20 +version: 4.6.0 appVersion: 28.0.2 description: A file sharing server that puts the control and security of your own data back into your hands. keywords: diff --git a/charts/nextcloud/templates/configmap-hooks.yaml b/charts/nextcloud/templates/configmap-hooks.yaml new file mode 100644 index 00000000..76f40c74 --- /dev/null +++ b/charts/nextcloud/templates/configmap-hooks.yaml @@ -0,0 +1,18 @@ +{{- if not (values .Values.nextcloud.hooks | compact | empty) }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "nextcloud.fullname" . }}-hooks + 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 }} +data: + {{- range $hook, $shell := .Values.nextcloud.hooks }} + {{- if $shell }} + {{ $hook }}.sh: {{ $shell | b64enc }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index b6fc261d..be3aeea9 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -43,6 +43,7 @@ spec: {{- if .Values.nginx.enabled }} nginx-config-hash: {{ print .Values.nginx.config.default "-" .Values.nginx.config.custom | sha256sum }} {{- end }} + hooks-hash: {{ toYaml .Values.nextcloud.hooks | sha256sum }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} @@ -136,6 +137,14 @@ spec: {{- end }} volumeMounts: {{- include "nextcloud.volumeMounts" . | trim | nindent 12 }} + {{- range $hook, $shell := .Values.nextcloud.hooks }} + {{- if $shell }} + - name: nextcloud-hooks + mountPath: /docker-entrypoint-hooks.d/{{ $hook }}/helm.sh + subPath: {{ $hook }}.sh + readOnly: true + {{- end }} + {{- end }} {{- if .Values.nginx.enabled }} - name: {{ .Chart.Name }}-nginx image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}" @@ -348,6 +357,12 @@ spec: configMap: name: {{ template "nextcloud.fullname" . }}-nginxconfig {{- end }} + {{- if not (values .Values.nextcloud.hooks | compact | empty) }} + - name: nextcloud-hooks + configMap: + name: {{ template "nextcloud.fullname" . }}-hooks + defaultMode: 0o755 + {{- end }} {{- with .Values.nextcloud.extraVolumes }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index f740c368..7ec63f72 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -147,6 +147,16 @@ nextcloud: # ) # ); + # Hooks for auto configuration + # Here you could write small scripts which are placed in `/docker-entrypoint-hooks.d//helm.sh` + # ref: https://github.com/nextcloud/docker?tab=readme-ov-file#auto-configuration-via-hook-folders + hooks: + pre-installation: + post-installation: + pre-upgrade: + post-upgrade: + before-starting: + ## Strategy used to replace old pods ## IMPORTANT: use with care, it is suggested to leave as that for upgrade purposes ## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy