Skip to content

Commit 9b0a39a

Browse files
committed
WIP: patch script fixups
Signed-off-by: Todd Short <[email protected]>
1 parent 15964fb commit 9b0a39a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

hack/tools/patch-base-for-helm.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#!/bin/bash
22

3-
set -x
4-
53
# Patch catalogd rbac
64
catalogd_rbac_filelist=(
75
helm/olmv1/base/catalogd/rbac/experimental/*.yaml
86
helm/olmv1/base/catalogd/rbac/standard/*.yaml
97
)
108
for f in "${catalogd_rbac_filelist[@]}"; do
119
yq -i '.metadata.labels["app.kubernetes.io/name"] = "catalogd"' "${f}"
12-
rm "${f}.bak"
10+
rm -f "${f}.bak"
1311
done
1412

1513
# Patch operator-controller rbac
@@ -19,7 +17,7 @@ operator_controller_rbac_filelist=(
1917
)
2018
for f in "${operator_controller_rbac_filelist[@]}"; do
2119
yq -i '.metadata.labels["app.kubernetes.io/name"] = "operator-controller"' "${f}"
22-
rm "${f}.bak"
20+
rm -f "${f}.bak"
2321
done
2422

2523
# Patch catalogd webhook
@@ -37,7 +35,7 @@ for f in "${catalogd_webhook_filelist[@]}"; do
3735
yq -i '.webhooks[0].clientConfig.service.port = 9443' "${f}"
3836
yq -i '.webhooks[0].matchConditions[0].name = "MissingOrIncorrectMetadataNameLabel"' "${f}"
3937
yq -i '.webhooks[0].matchConditions[0].expression = "\"name\" in object.metadata && (!has(object.metadata.labels) || !(\"olm.operatorframework.io/metadata.name\" in object.metadata.labels) || object.metadata.labels[\"olm.operatorframework.io/metadata.name\"] != object.metadata.name)"' "${f}"
40-
rm "${f}.bak"
38+
rm -f "${f}.bak"
4139
done
4240

4341
# Patch everything genericly
@@ -58,10 +56,10 @@ for f in "${filelist[@]}"; do
5856
# Patch in the temporary items
5957
yq -i '.metadata.annotations.replaceMe = "annotations"' "${f}"
6058
yq -i '.metadata.labels.replaceMe = "labels"' "${f}"
61-
# Replace with helm template - must be done last or yq will complain about the file format
59+
# Replace with helm template - must be done last or yq will complain about the file formXat
6260
sed -i.bak 's/replaceMe: annotations/{{- include "olmv1.annotations" . | nindent 4 }}/g' "${f}"
6361
sed -i.bak 's/replaceMe: labels/{{- include "olmv1.labels" . | nindent 4 }}/g' "${f}"
6462
sed -i.bak 's/olmv1-system/{{ .Values.namespaces.olmv1.name }}/g' "${f}"
6563
# Delete sed's backup file
66-
rm "${f}.bak"
64+
rm -f "${f}.bak"
6765
done

0 commit comments

Comments
 (0)