Merge pull request #2467 from nextcloud/enh/noid/put-db-into-subpath

put the database into a subpath
This commit is contained in:
Simon L 2023-05-02 20:31:26 +02:00 committed by GitHub
commit c5b26ffb4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,6 +61,7 @@ cat << EOL > /tmp/initcontainers.database
command: command:
- chown - chown
- 999:999 - 999:999
- "-R"
volumeMountsInitContainer: volumeMountsInitContainer:
EOL EOL
# shellcheck disable=SC1083 # shellcheck disable=SC1083
@ -80,6 +81,11 @@ 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"
# Workaround for the database volume
if [ "$volumeName" = nextcloud-aio-database ]; then
sed -i "/mountPath: \/var\/lib\/postgresql\/data/a\ \ \ \ \ \ \ \ \ \ \ \ \ \ subPath: data" "$variable"
fi
fi fi
done done
sed -i "s|volumeMountsInitContainer|volumeMounts|" "$variable" sed -i "s|volumeMountsInitContainer|volumeMounts|" "$variable"