Skip to content

Commit

Permalink
Merge pull request #3792 from nextcloud/enh/noid/remove-lost+found
Browse files Browse the repository at this point in the history
  • Loading branch information
szaimen authored Nov 23, 2023
2 parents f0fd5b6 + b85ffbb commit 4a9c344
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nextcloud-aio-helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ spec:
ports:
- containerPort: 9980
protocol: TCP
securityContext:
capabilities:
add:
- MKNOD
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 21 additions & 1 deletion nextcloud-aio-helm-chart/update-helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 4a9c344

Please sign in to comment.