try to remove readonly from global volumes automatically

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-02-02 12:49:26 +01:00
parent 26188f797d
commit 011356343f

View file

@ -62,6 +62,15 @@ for variable in "${DEPLOYMENTS[@]}"; do
sed -i "/volumeMountsInitContainer:/a\ \ \ \ \ \ \ \ \ \ \ \ - name: $volumeName\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ mountPath: /$volumeName" "$variable"
done
sed -i "s|volumeMountsInitContainer|volumeMounts|" "$variable"
if grep -q claimName "$variable"; then
claimNames="$(grep claimName "$variable")"
mapfile -t claimNames <<< "$claimNames"
for claimName in "${claimNames[@]}"; do
if grep -A1 "^$claimName$" "$variable" | grep -q "readOnly: true"; then
sed -i "/^$claimName$/{n;d}" "$variable"
fi
done
fi
fi
done
# shellcheck disable=SC1083