Skip to content

Commit

Permalink
Merge pull request #3784 from nextcloud/enh/noid/fix-clamav
Browse files Browse the repository at this point in the history
  • Loading branch information
szaimen authored Nov 21, 2023
2 parents ec33279 + feec123 commit 5a385eb
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 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.0-beta3
version: 7.7.0-beta4
apiVersion: v2
keywords:
- latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,22 @@ spec:
io.kompose.service: nextcloud-aio-clamav
spec:
initContainers:
- name: init-subpath
image: alpine
command:
- mkdir
- "-p"
- /nextcloud-aio-clamav/data
- /nextcloud-aio-clamav
volumeMounts:
- name: nextcloud-aio-clamav
mountPath: /nextcloud-aio-clamav
- name: init-volumes
image: alpine
command:
- chmod
- "777"
- chown
- 100:100
- "-R"
- /nextcloud-aio-clamav
volumeMounts:
- name: nextcloud-aio-clamav
Expand All @@ -46,6 +57,7 @@ spec:
protocol: TCP
volumeMounts:
- mountPath: /var/lib/clamav
subPath: data
name: nextcloud-aio-clamav
volumes:
- name: nextcloud-aio-clamav
Expand Down
27 changes: 24 additions & 3 deletions nextcloud-aio-helm-chart/update-helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,34 @@ cat << EOL > /tmp/initcontainers.database
- "-R"
volumeMountsInitContainer:
EOL
cat << EOL > /tmp/initcontainers.clamav
initContainers:
- name: init-subpath
image: alpine
command:
- mkdir
- "-p"
- /nextcloud-aio-clamav/data
volumeMountsInitContainer:
- name: init-volumes
image: alpine
command:
- chown
- 100:100
- "-R"
volumeMountsInitContainer:
EOL
# shellcheck disable=SC1083
DEPLOYMENTS="$(find ./ -name '*deployment.yaml')"
mapfile -t DEPLOYMENTS <<< "$DEPLOYMENTS"
for variable in "${DEPLOYMENTS[@]}"; do
if grep -q volumeMounts "$variable"; then
if ! echo "$variable" | grep -q database; then
sed -i "/^ spec:/r /tmp/initcontainers" "$variable"
else
if echo "$variable" | grep -q database; then
sed -i "/^ spec:/r /tmp/initcontainers.database" "$variable"
elif echo "$variable" | grep -q clamav; then
sed -i "/^ spec:/r /tmp/initcontainers.clamav" "$variable"
else
sed -i "/^ spec:/r /tmp/initcontainers" "$variable"
fi
volumeNames="$(grep -A1 mountPath "$variable" | grep -v mountPath | sed 's|.*name: ||' | sed '/^--$/d')"
mapfile -t volumeNames <<< "$volumeNames"
Expand All @@ -101,6 +120,8 @@ for variable in "${DEPLOYMENTS[@]}"; do
# Workaround for the database volume
if [ "$volumeName" = nextcloud-aio-database ]; then
sed -i "/mountPath: \/var\/lib\/postgresql\/data/a\ \ \ \ \ \ \ \ \ \ \ \ \ \ subPath: data" "$variable"
elif [ "$volumeName" = nextcloud-aio-clamav ]; then
sed -i "/mountPath: \/var\/lib\/clamav/a\ \ \ \ \ \ \ \ \ \ \ \ \ \ subPath: data" "$variable"
fi

fi
Expand Down

0 comments on commit 5a385eb

Please sign in to comment.