From b85ffbb0cc76d8411614301a270ec57c73cc5fa0 Mon Sep 17 00:00:00 2001 From: Simon L Date: Tue, 21 Nov 2023 16:49:51 +0100 Subject: [PATCH] helm - fix lost+found in nextcloud Signed-off-by: Simon L --- nextcloud-aio-helm-chart/Chart.yaml | 2 +- .../nextcloud-aio-collabora-deployment.yaml | 4 ++++ .../nextcloud-aio-nextcloud-deployment.yaml | 11 ++++++++++ nextcloud-aio-helm-chart/update-helm.sh | 22 ++++++++++++++++++- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/nextcloud-aio-helm-chart/Chart.yaml b/nextcloud-aio-helm-chart/Chart.yaml index 37669b75442..76e1c150ac0 100755 --- a/nextcloud-aio-helm-chart/Chart.yaml +++ b/nextcloud-aio-helm-chart/Chart.yaml @@ -1,6 +1,6 @@ name: nextcloud-aio-helm-chart description: A generated Helm Chart for Nextcloud AIO from Skippbox Kompose -version: 7.7.1-dev3 +version: 7.7.1-dev4 apiVersion: v2 keywords: - latest diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-collabora-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-collabora-deployment.yaml index 0ec6e6f6eaf..cb9ba46cd93 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-collabora-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-collabora-deployment.yaml @@ -42,4 +42,8 @@ spec: ports: - containerPort: 9980 protocol: TCP + securityContext: + capabilities: + add: + - MKNOD {{- end }} diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml index 8353c7f07d7..839323f347b 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml @@ -23,6 +23,17 @@ spec: io.kompose.service: nextcloud-aio-nextcloud spec: initContainers: + - name: delete lost+found + image: alpine + command: + - rm + - "-rf" + - /nextcloud-aio-nextcloud/lost+found + volumeMounts: + - name: nextcloud-aio-nextcloud-trusted-cacerts + mountPath: /nextcloud-aio-nextcloud-trusted-cacerts + - name: nextcloud-aio-nextcloud + mountPath: /nextcloud-aio-nextcloud - name: init-volumes image: alpine command: diff --git a/nextcloud-aio-helm-chart/update-helm.sh b/nextcloud-aio-helm-chart/update-helm.sh index a105d1ddcb0..e16883b2a75 100755 --- a/nextcloud-aio-helm-chart/update-helm.sh +++ b/nextcloud-aio-helm-chart/update-helm.sh @@ -98,6 +98,22 @@ cat << EOL > /tmp/initcontainers.clamav - "-R" volumeMountsInitContainer: EOL +cat << EOL > /tmp/initcontainers.nextcloud + initContainers: + - name: delete lost+found + image: alpine + command: + - rm + - "-rf" + - /nextcloud-aio-nextcloud/lost+found + volumeMountsInitRmLostFound: + - name: init-volumes + image: alpine + command: + - chmod + - "777" + volumeMountsInitContainer: +EOL # shellcheck disable=SC1083 DEPLOYMENTS="$(find ./ -name '*deployment.yaml')" mapfile -t DEPLOYMENTS <<< "$DEPLOYMENTS" @@ -107,6 +123,8 @@ for variable in "${DEPLOYMENTS[@]}"; do sed -i "/^ spec:/r /tmp/initcontainers.database" "$variable" elif echo "$variable" | grep -q clamav; then sed -i "/^ spec:/r /tmp/initcontainers.clamav" "$variable" + elif echo "$variable" | grep -q "nextcloud-deployment.yaml"; then + sed -i "/^ spec:/r /tmp/initcontainers.nextcloud" "$variable" else sed -i "/^ spec:/r /tmp/initcontainers" "$variable" fi @@ -117,6 +135,7 @@ for variable in "${DEPLOYMENTS[@]}"; do if [ "$volumeName" != "nextcloud-aio-nextcloud-data" ]; then sed -i "/^.*volumeMountsInitContainer:/i\ \ \ \ \ \ \ \ \ \ \ \ - /$volumeName" "$variable" sed -i "/volumeMountsInitContainer:/a\ \ \ \ \ \ \ \ \ \ \ \ - name: $volumeName\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ mountPath: /$volumeName" "$variable" + sed -i "/volumeMountsInitRmLostFound:/a\ \ \ \ \ \ \ \ \ \ \ \ - name: $volumeName\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ mountPath: /$volumeName" "$variable" # Workaround for the database volume if [ "$volumeName" = nextcloud-aio-database ]; then sed -i "/mountPath: \/var\/lib\/postgresql\/data/a\ \ \ \ \ \ \ \ \ \ \ \ \ \ subPath: data" "$variable" @@ -126,7 +145,8 @@ for variable in "${DEPLOYMENTS[@]}"; do fi done - sed -i "s|volumeMountsInitContainer|volumeMounts|" "$variable" + sed -i "s|volumeMountsInitContainer:|volumeMounts:|" "$variable" + sed -i "s|volumeMountsInitRmLostFound:|volumeMounts:|" "$variable" if grep -q claimName "$variable"; then claimNames="$(grep claimName "$variable")" mapfile -t claimNames <<< "$claimNames"