Skip to content

Commit

Permalink
fix(backend): Backend - Cache - Fixed reinstallation. Fixes #4299 (#4320
Browse files Browse the repository at this point in the history
)

* Backend - Cache - Fixed reinstallation by adding missing roles

* Stop ignoring the deletion errors

* Added patch permission as well

It should not be triggered, but might be useful in the future.
  • Loading branch information
Ark-kun committed Aug 5, 2020
1 parent d4aabd1 commit fe77c19
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/src/cache/deployer/deploy-cache-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ WEBHOOK_SECRET_NAME=webhook-server-tls

# This should fail if there are connectivity problems
# Gotcha: Listing all objects requires list permission,
# but when listing a single oblect kubecttl will fail if it's not found
# but when listing a single oblect kubectl will fail if it's not found
# unless --ignore-not-found is specified.
kubectl get mutatingwebhookconfigurations "${MUTATING_WEBHOOK_CONFIGURATION_NAME}" --namespace "${NAMESPACE}" --ignore-not-found >webhooks.txt
kubectl get secrets "${WEBHOOK_SECRET_NAME}" --namespace "${NAMESPACE}" --ignore-not-found >cache_secret.txt
Expand All @@ -50,12 +50,12 @@ fi

if [ "$webhook_config_exists" == "true" ]; then
echo "Warning: Webhook config exists, but the secret does not exist. Reinstalling."
kubectl delete mutatingwebhookconfigurations "${MUTATING_WEBHOOK_CONFIGURATION_NAME}" --namespace "${NAMESPACE}" || true
kubectl delete mutatingwebhookconfigurations "${MUTATING_WEBHOOK_CONFIGURATION_NAME}" --namespace "${NAMESPACE}"
fi

if [ "$webhook_secret_exists" == "true" ]; then
echo "Warning: Webhook secret exists, but the config does not exist. Reinstalling."
kubectl delete secrets "${WEBHOOK_SECRET_NAME}" --namespace "${NAMESPACE}" || true
kubectl delete secrets "${WEBHOOK_SECRET_NAME}" --namespace "${NAMESPACE}"
fi


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ rules:
- mutatingwebhookconfigurations
verbs:
- create
- delete
- get
- list
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand All @@ -52,8 +55,10 @@ rules:
- secrets
verbs:
- create
- delete
- get
- patch
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ rules:
- secrets
verbs:
- create
- delete
- get
- patch
- list
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ rules:
- mutatingwebhookconfigurations
verbs:
- create
- delete
- get
- list
- patch

0 comments on commit fe77c19

Please sign in to comment.