Skip to content

Commit 18fe8be

Browse files
authored
stop guard when cluster is deleted to avoid spamming the terminal (#835)
Signed-off-by: Mohammed Abdi <mohammed.munir.abdi@ibm.com>
1 parent ded4302 commit 18fe8be

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

deploy/install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ start_apiservice_guard() {
165165
(
166166
while true; do
167167
sleep 10
168+
# Exit if cluster is gone (e.g. kind cluster deleted) to avoid spamming the terminal
169+
if ! kubectl cluster-info &>/dev/null; then
170+
echo "[apiservice-guard] Cluster unreachable, stopping guard"
171+
exit 0
172+
fi
168173
current_svc=$(kubectl get apiservice v1beta1.external.metrics.k8s.io \
169174
-o jsonpath='{.spec.service.name}' 2>/dev/null || echo "")
170175
current_ns=$(kubectl get apiservice v1beta1.external.metrics.k8s.io \

0 commit comments

Comments
 (0)