From 69a479df5afe1d7a76b7e72462523822a1b1d10e Mon Sep 17 00:00:00 2001 From: Arsolitt Date: Tue, 19 May 2026 14:22:01 +0300 Subject: [PATCH 1/3] fix(kafka): reclaim ZooKeeper PVCs on Kafka release deletion Set deleteClaim: true on the ZooKeeper persistent-claim storage so the Strimzi operator removes the PVCs together with the rest of the cluster when the Kafka CR is deleted. Previously the Kafka broker PVCs were reclaimed (deleteClaim: true) but the ZooKeeper PVCs were orphaned, forcing manual cleanup before the same release name could be reused. Assisted-By: Claude Signed-off-by: Arsolitt --- packages/apps/kafka/templates/kafka.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apps/kafka/templates/kafka.yaml b/packages/apps/kafka/templates/kafka.yaml index e6c3f2bb9..e164d83c9 100644 --- a/packages/apps/kafka/templates/kafka.yaml +++ b/packages/apps/kafka/templates/kafka.yaml @@ -73,7 +73,7 @@ spec: {{- with .Values.kafka.storageClass }} class: {{ . }} {{- end }} - deleteClaim: false + deleteClaim: true metricsConfig: type: jmxPrometheusExporter valueFrom: From c4b0606e6727cd1847480efab7e58149ffbbe5a9 Mon Sep 17 00:00:00 2001 From: Arsolitt Date: Tue, 19 May 2026 14:38:58 +0300 Subject: [PATCH 2/3] test(kafka): verify ZooKeeper PVCs are reclaimed by the operator Address review feedback from gemini-code-assist on hack/e2e-apps/kafka.bats:53-55: Replace the manual kubectl delete of the two ZooKeeper PVCs with a poll that waits for the Strimzi operator to reclaim them. With deleteClaim: true on the ZooKeeper persistent-claim storage, the operator removes the PVCs as part of Kafka CR deletion; manual deletion would either race the operator, fail with NotFound, or silently mask a regression in the reclamation path. Assisted-By: Claude Signed-off-by: Arsolitt --- hack/e2e-apps/kafka.bats | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hack/e2e-apps/kafka.bats b/hack/e2e-apps/kafka.bats index 9fb0866d1..be9de0232 100644 --- a/hack/e2e-apps/kafka.bats +++ b/hack/e2e-apps/kafka.bats @@ -50,7 +50,10 @@ EOF timeout 40 sh -ec "until kubectl -n tenant-test get svc kafka-$name-zookeeper-client -o jsonpath='{.spec.ports[0].port}' | grep -q '2181'; do sleep 10; done" timeout 40 sh -ec "until kubectl -n tenant-test get svc kafka-$name-zookeeper-nodes -o jsonpath='{.spec.ports[*].port}' | grep -q '2181 2888 3888'; do sleep 10; done" timeout 80 sh -ec "until kubectl -n tenant-test get endpoints kafka-$name-zookeeper-nodes -o jsonpath='{.subsets[*].addresses[0].ip}' | grep -q '[0-9]'; do sleep 10; done" - kubectl -n tenant-test delete kafka.apps.cozystack.io $name - kubectl -n tenant-test delete pvc data-kafka-$name-zookeeper-0 - kubectl -n tenant-test delete pvc data-kafka-$name-zookeeper-1 + kubectl -n tenant-test delete kafka.apps.cozystack.io $name --timeout=2m + # Strimzi reclaims ZooKeeper PVCs automatically when deleteClaim is true on + # the persistent-claim storage. Verify they disappear instead of issuing a + # manual kubectl delete, which would mask a regression in the operator. + timeout 60 sh -ec "while kubectl -n tenant-test get pvc data-kafka-$name-zookeeper-0 >/dev/null 2>&1; do sleep 2; done" + timeout 60 sh -ec "while kubectl -n tenant-test get pvc data-kafka-$name-zookeeper-1 >/dev/null 2>&1; do sleep 2; done" } From 2086f3e6b66a0805502bbff5e61f957df666e45a Mon Sep 17 00:00:00 2001 From: Arsolitt Date: Wed, 20 May 2026 14:03:29 +0300 Subject: [PATCH 3/3] test(kafka): assert ZooKeeper PVC-1 is created before deletion check Address review feedback from coderabbitai on hack/e2e-apps/kafka.bats:58: The post-delete `while kubectl get pvc data-kafka-$name-zookeeper-1` loop exits immediately when the PVC has never been created, so a regression that prevents Strimzi from provisioning the second ZooKeeper PVC would silently pass the reclamation check. Mirror the PVC-0 readiness guard (existence + Bound) for PVC-1 before deleting the Kafka CR so the test only proceeds once both PVCs are observed. Assisted-By: Claude Signed-off-by: Arsolitt --- hack/e2e-apps/kafka.bats | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hack/e2e-apps/kafka.bats b/hack/e2e-apps/kafka.bats index be9de0232..ef4d9187c 100644 --- a/hack/e2e-apps/kafka.bats +++ b/hack/e2e-apps/kafka.bats @@ -47,6 +47,8 @@ EOF kubectl wait kafkas -n tenant-test $name --timeout=300s --for=condition=ready timeout 60 sh -ec "until kubectl -n tenant-test get pvc data-kafka-$name-zookeeper-0; do sleep 10; done" kubectl -n tenant-test wait pvc data-kafka-$name-zookeeper-0 --timeout=50s --for=jsonpath='{.status.phase}'=Bound + timeout 60 sh -ec "until kubectl -n tenant-test get pvc data-kafka-$name-zookeeper-1 >/dev/null 2>&1; do sleep 2; done" + kubectl -n tenant-test wait pvc data-kafka-$name-zookeeper-1 --timeout=50s --for=jsonpath='{.status.phase}'=Bound timeout 40 sh -ec "until kubectl -n tenant-test get svc kafka-$name-zookeeper-client -o jsonpath='{.spec.ports[0].port}' | grep -q '2181'; do sleep 10; done" timeout 40 sh -ec "until kubectl -n tenant-test get svc kafka-$name-zookeeper-nodes -o jsonpath='{.spec.ports[*].port}' | grep -q '2181 2888 3888'; do sleep 10; done" timeout 80 sh -ec "until kubectl -n tenant-test get endpoints kafka-$name-zookeeper-nodes -o jsonpath='{.subsets[*].addresses[0].ip}' | grep -q '[0-9]'; do sleep 10; done"