From c3cd3cf153d517f7d3c00a1cefbfa3e166c08874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Goinvic?= Date: Fri, 6 Jun 2025 17:43:21 +0200 Subject: [PATCH] syn2mas: fail if pods are still up after statefulset are all down --- matrix-tools/internal/pkg/syn2mas/syn2mas.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/matrix-tools/internal/pkg/syn2mas/syn2mas.go b/matrix-tools/internal/pkg/syn2mas/syn2mas.go index 36eff8e1..6a468394 100644 --- a/matrix-tools/internal/pkg/syn2mas/syn2mas.go +++ b/matrix-tools/internal/pkg/syn2mas/syn2mas.go @@ -59,6 +59,19 @@ func scaleDownSynapse(client kubernetes.Interface, namespace string) map[string] break } } + podsClient := client.CoreV1().Pods(namespace) + pods, err := podsClient.List(ctx, metav1.ListOptions{ + LabelSelector: "app.kubernetes.io/component=matrix-server", + }) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + if len(pods.Items) != 0 { + fmt.Println("StatefulSet are down, but pods matching matrix-server component are remaining. Something wrong is happening.") + os.Exit(1) + } + return stsReplicas }