helm - fix lost+found in nextcloud

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-11-21 16:49:51 +01:00
parent f0fd5b692d
commit b85ffbb0cc
4 changed files with 37 additions and 2 deletions

View file

@ -1,6 +1,6 @@
name: nextcloud-aio-helm-chart name: nextcloud-aio-helm-chart
description: A generated Helm Chart for Nextcloud AIO from Skippbox Kompose description: A generated Helm Chart for Nextcloud AIO from Skippbox Kompose
version: 7.7.1-dev3 version: 7.7.1-dev4
apiVersion: v2 apiVersion: v2
keywords: keywords:
- latest - latest

View file

@ -42,4 +42,8 @@ spec:
ports: ports:
- containerPort: 9980 - containerPort: 9980
protocol: TCP protocol: TCP
securityContext:
capabilities:
add:
- MKNOD
{{- end }} {{- end }}

View file

@ -23,6 +23,17 @@ spec:
io.kompose.service: nextcloud-aio-nextcloud io.kompose.service: nextcloud-aio-nextcloud
spec: spec:
initContainers: 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 - name: init-volumes
image: alpine image: alpine
command: command:

View file

@ -98,6 +98,22 @@ cat << EOL > /tmp/initcontainers.clamav
- "-R" - "-R"
volumeMountsInitContainer: volumeMountsInitContainer:
EOL 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 # shellcheck disable=SC1083
DEPLOYMENTS="$(find ./ -name '*deployment.yaml')" DEPLOYMENTS="$(find ./ -name '*deployment.yaml')"
mapfile -t DEPLOYMENTS <<< "$DEPLOYMENTS" mapfile -t DEPLOYMENTS <<< "$DEPLOYMENTS"
@ -107,6 +123,8 @@ for variable in "${DEPLOYMENTS[@]}"; do
sed -i "/^ spec:/r /tmp/initcontainers.database" "$variable" sed -i "/^ spec:/r /tmp/initcontainers.database" "$variable"
elif echo "$variable" | grep -q clamav; then elif echo "$variable" | grep -q clamav; then
sed -i "/^ spec:/r /tmp/initcontainers.clamav" "$variable" 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 else
sed -i "/^ spec:/r /tmp/initcontainers" "$variable" sed -i "/^ spec:/r /tmp/initcontainers" "$variable"
fi fi
@ -117,6 +135,7 @@ for variable in "${DEPLOYMENTS[@]}"; do
if [ "$volumeName" != "nextcloud-aio-nextcloud-data" ]; then if [ "$volumeName" != "nextcloud-aio-nextcloud-data" ]; then
sed -i "/^.*volumeMountsInitContainer:/i\ \ \ \ \ \ \ \ \ \ \ \ - /$volumeName" "$variable" sed -i "/^.*volumeMountsInitContainer:/i\ \ \ \ \ \ \ \ \ \ \ \ - /$volumeName" "$variable"
sed -i "/volumeMountsInitContainer:/a\ \ \ \ \ \ \ \ \ \ \ \ - name: $volumeName\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ mountPath: /$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 # Workaround for the database volume
if [ "$volumeName" = nextcloud-aio-database ]; then if [ "$volumeName" = nextcloud-aio-database ]; then
sed -i "/mountPath: \/var\/lib\/postgresql\/data/a\ \ \ \ \ \ \ \ \ \ \ \ \ \ subPath: data" "$variable" sed -i "/mountPath: \/var\/lib\/postgresql\/data/a\ \ \ \ \ \ \ \ \ \ \ \ \ \ subPath: data" "$variable"
@ -126,7 +145,8 @@ for variable in "${DEPLOYMENTS[@]}"; do
fi fi
done 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 if grep -q claimName "$variable"; then
claimNames="$(grep claimName "$variable")" claimNames="$(grep claimName "$variable")"
mapfile -t claimNames <<< "$claimNames" mapfile -t claimNames <<< "$claimNames"