From 011356343faca5d7c1956682d6108523562ab5b4 Mon Sep 17 00:00:00 2001 From: Simon L Date: Thu, 2 Feb 2023 12:49:26 +0100 Subject: [PATCH] try to remove readonly from global volumes automatically Signed-off-by: Simon L --- helm-chart/update-helm.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/helm-chart/update-helm.sh b/helm-chart/update-helm.sh index b0602e74..31c55bf2 100755 --- a/helm-chart/update-helm.sh +++ b/helm-chart/update-helm.sh @@ -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