Skip to content

Commit 5c4b601

Browse files
committed
Add check for $RULE_INDEX validity
Signed-off-by: Tim Serong <[email protected]>
1 parent d5da1fd commit 5c4b601

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

docs/upgrade/v1-4-1-to-v1-4-3.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ To resolve this issue, perform the following steps:
124124
validatingwebhookconfiguration longhorn-webhook-validator -o json \
125125
| jq '.webhooks[0].rules | map(.resources[0] == "persistentvolumeclaims") | index(true)')
126126

127-
kubectl patch validatingwebhookconfiguration longhorn-webhook-validator \
128-
--type='json' \
129-
-p="[{'op': 'remove', 'path': '/webhooks/0/rules/$RULE_INDEX'}]"
127+
if [ -n "$RULE_INDEX" -a "$RULE_INDEX" != "null" ]; then
128+
kubectl patch validatingwebhookconfiguration longhorn-webhook-validator \
129+
--type='json' \
130+
-p="[{'op': 'remove', 'path': '/webhooks/0/rules/$RULE_INDEX'}]"
131+
fi
130132
```
131133

132134
1. Wait for the related PVC to be deleted.

docs/volume/create-volume.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ To resolve this issue, perform the following steps:
4242
validatingwebhookconfiguration longhorn-webhook-validator -o json \
4343
| jq '.webhooks[0].rules | map(.resources[0] == "persistentvolumeclaims") | index(true)')
4444

45-
kubectl patch validatingwebhookconfiguration longhorn-webhook-validator \
46-
--type='json' \
47-
-p="[{'op': 'remove', 'path': '/webhooks/0/rules/$RULE_INDEX'}]"
45+
if [ -n "$RULE_INDEX" -a "$RULE_INDEX" != "null" ]; then
46+
kubectl patch validatingwebhookconfiguration longhorn-webhook-validator \
47+
--type='json' \
48+
-p="[{'op': 'remove', 'path': '/webhooks/0/rules/$RULE_INDEX'}]"
49+
fi
4850
```
4951

5052
1. Wait for the related PVC to be deleted.

versioned_docs/version-v1.4/volume/create-volume.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ To resolve this issue, perform the following steps:
4242
validatingwebhookconfiguration longhorn-webhook-validator -o json \
4343
| jq '.webhooks[0].rules | map(.resources[0] == "persistentvolumeclaims") | index(true)')
4444

45-
kubectl patch validatingwebhookconfiguration longhorn-webhook-validator \
46-
--type='json' \
47-
-p="[{'op': 'remove', 'path': '/webhooks/0/rules/$RULE_INDEX'}]"
45+
if [ -n "$RULE_INDEX" -a "$RULE_INDEX" != "null" ]; then
46+
kubectl patch validatingwebhookconfiguration longhorn-webhook-validator \
47+
--type='json' \
48+
-p="[{'op': 'remove', 'path': '/webhooks/0/rules/$RULE_INDEX'}]"
49+
fi
4850
```
4951

5052
1. Wait for the related PVC to be deleted.

versioned_docs/version-v1.5/volume/create-volume.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ To resolve this issue, perform the following steps:
4242
validatingwebhookconfiguration longhorn-webhook-validator -o json \
4343
| jq '.webhooks[0].rules | map(.resources[0] == "persistentvolumeclaims") | index(true)')
4444

45-
kubectl patch validatingwebhookconfiguration longhorn-webhook-validator \
46-
--type='json' \
47-
-p="[{'op': 'remove', 'path': '/webhooks/0/rules/$RULE_INDEX'}]"
45+
if [ -n "$RULE_INDEX" -a "$RULE_INDEX" != "null" ]; then
46+
kubectl patch validatingwebhookconfiguration longhorn-webhook-validator \
47+
--type='json' \
48+
-p="[{'op': 'remove', 'path': '/webhooks/0/rules/$RULE_INDEX'}]"
49+
fi
4850
```
4951

5052
1. Wait for the related PVC to be deleted.

0 commit comments

Comments
 (0)