From 65046cbda46ec4375df71af34c50adc46fdf20c5 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Fri, 14 Jun 2024 23:11:12 +0200 Subject: [PATCH] fix(notify-push): add autoSetup support --- charts/nextcloud/files/notify_push.sh.gotmpl | 3 +++ charts/nextcloud/templates/deployment.yaml | 15 +++++++++++++++ .../templates/notify_push/configmap.yaml | 15 +++++++++++++++ charts/nextcloud/values.yaml | 1 + 4 files changed, 34 insertions(+) create mode 100644 charts/nextcloud/files/notify_push.sh.gotmpl create mode 100644 charts/nextcloud/templates/notify_push/configmap.yaml diff --git a/charts/nextcloud/files/notify_push.sh.gotmpl b/charts/nextcloud/files/notify_push.sh.gotmpl new file mode 100644 index 00000000..4aeb9cb4 --- /dev/null +++ b/charts/nextcloud/files/notify_push.sh.gotmpl @@ -0,0 +1,3 @@ +#!/bin/sh +/var/www/html/occ app:install notify_push +/var/www/html/occ notify_push:setup https://{{ .Values.nextcloud.host }}{{ .Values.notifyPush.ingress.path }} diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index 83546f42..3f3a2a98 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -137,6 +137,12 @@ spec: {{- end }} volumeMounts: {{- include "nextcloud.volumeMounts" . | trim | nindent 12 }} + {{- if and .Values.notifyPush.enabled .Values.notifyPush.autoSetup }} + - name: nextcloud-notify-hooks + mountPath: /docker-entrypoint-hooks.d/before-starting/notify_push.sh + subPath: notify_push.sh + readOnly: true + {{- end }} {{- range $hook, $shell := .Values.nextcloud.hooks }} {{- if $shell }} - name: nextcloud-hooks @@ -361,6 +367,15 @@ spec: configMap: name: {{ template "nextcloud.fullname" . }}-nginxconfig {{- end }} + {{- if and .Values.notifyPush.enabled .Values.notifyPush.autoSetup }} + - name: nextcloud-notify-hooks + configMap: + name: {{ template "nextcloud.fullname" . }}-notify-push + defaultMode: 0o755 + items: + - key: hook.sh + path: notify_push.sh + {{- end }} {{- if not (values .Values.nextcloud.hooks | compact | empty) }} - name: nextcloud-hooks configMap: diff --git a/charts/nextcloud/templates/notify_push/configmap.yaml b/charts/nextcloud/templates/notify_push/configmap.yaml new file mode 100644 index 00000000..f13d5f1c --- /dev/null +++ b/charts/nextcloud/templates/notify_push/configmap.yaml @@ -0,0 +1,15 @@ +{{- if and .Values.notifyPush.enabled .Values.notifyPush.autoSetup }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "nextcloud.fullname" . }}-notify-push + 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: + hook.sh: |- + {{- tpl (.Files.Get "files/notify_push.sh.gotmpl" ) . | nindent 4 }} +{{- end }} diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index 98c2de6b..53e46d78 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -487,6 +487,7 @@ affinity: {} # Notify Push (Clientpush) notifyPush: enabled: false + autoSetup: false replicaCount: 1