Skip to content

Commit 4e3e44e

Browse files
NickLarsenNZadwk67
andauthored
test: Shutdown Kafka Brokers before ZooKeeper/KRaft Controllers (#956)
* test: Add final step to scale down kafka This ensures Kafka pods don't hang when zookeeper is shutdown before kafka on namespace deletion by kuttl * test: Add final step to scale down kafka when using KRaft This ensures Kafka brokers don't hang when kraft controlers are shutdown on namespace deletion by kuttl * Revert "test: Add final step to scale down kafka when using KRaft" This reverts commit cc853b9. This relies on a bug fix that should come in with #955 * test(logging): Scale down the custom-log-config RoleGroup Co-authored-by: Andrew Kenworthy <andrew.kenworthy@stackable.de> * test(delete-role): Add note about not scaling down the already deleted RoleGroup --------- Co-authored-by: Andrew Kenworthy <andrew.kenworthy@stackable.de>
1 parent 0d1c8bb commit 4e3e44e

7 files changed

Lines changed: 78 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# Scale Kafka down before kuttl deletes the namespace.
3+
# Without this, ZooKeeper and Kafka are terminated simultaneously,
4+
# and Kafka hangs on controlled-shutdown ZooKeeper timeouts.
5+
apiVersion: kuttl.dev/v1beta1
6+
kind: TestStep
7+
commands:
8+
- script: |
9+
kubectl patch kafkacluster test-kafka -n $NAMESPACE --type merge -p '{"spec":{"brokers":{"roleGroups":{"default":{"replicas":0}}}}}'
10+
- script: |
11+
kubectl wait --for=delete pod -l app.kubernetes.io/instance=test-kafka -n $NAMESPACE --timeout=300s
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
# Scale Kafka down before kuttl deletes the namespace.
3+
# Without this, ZooKeeper and Kafka are terminated simultaneously,
4+
# and Kafka hangs on controlled-shutdown ZooKeeper timeouts.
5+
apiVersion: kuttl.dev/v1beta1
6+
kind: TestStep
7+
commands:
8+
# Note: By the time this script runs, the secondary RoleGroup has already been deleted, therefore we don't scale it down.
9+
- script: |
10+
kubectl patch kafkacluster test-kafka -n $NAMESPACE --type merge -p '{"spec":{"brokers":{"roleGroups":{"default":{"replicas":0}}}}}'
11+
- script: |
12+
kubectl wait --for=delete pod -l app.kubernetes.io/instance=test-kafka -n $NAMESPACE --timeout=300s
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# Scale Kafka down before kuttl deletes the namespace.
3+
# Without this, ZooKeeper and Kafka are terminated simultaneously,
4+
# and Kafka hangs on controlled-shutdown ZooKeeper timeouts.
5+
apiVersion: kuttl.dev/v1beta1
6+
kind: TestStep
7+
commands:
8+
- script: |
9+
kubectl patch kafkacluster test-kafka -n $NAMESPACE --type merge -p '{"spec":{"brokers":{"roleGroups":{"default":{"replicas":0}}}}}'
10+
- script: |
11+
kubectl wait --for=delete pod -l app.kubernetes.io/instance=test-kafka -n $NAMESPACE --timeout=300s
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# Scale Kafka down before kuttl deletes the namespace.
3+
# Without this, ZooKeeper and Kafka are terminated simultaneously,
4+
# and Kafka hangs on controlled-shutdown ZooKeeper timeouts.
5+
apiVersion: kuttl.dev/v1beta1
6+
kind: TestStep
7+
commands:
8+
- script: |
9+
kubectl patch kafkacluster test-kafka -n $NAMESPACE --type merge -p '{"spec":{"brokers":{"roleGroups":{"automatic-log-config":{"replicas":0}, "custom-log-config":{"replicas":0}}}}}'
10+
- script: |
11+
kubectl wait --for=delete pod -l app.kubernetes.io/instance=test-kafka -n $NAMESPACE --timeout=300s
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# Scale Kafka down before kuttl deletes the namespace.
3+
# Without this, ZooKeeper and Kafka are terminated simultaneously,
4+
# and Kafka hangs on controlled-shutdown ZooKeeper timeouts.
5+
apiVersion: kuttl.dev/v1beta1
6+
kind: TestStep
7+
commands:
8+
- script: |
9+
kubectl patch kafkacluster test-kafka -n $NAMESPACE --type merge -p '{"spec":{"brokers":{"roleGroups":{"default":{"replicas":0}}}}}'
10+
- script: |
11+
kubectl wait --for=delete pod -l app.kubernetes.io/instance=test-kafka -n $NAMESPACE --timeout=300s
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# Scale Kafka down before kuttl deletes the namespace.
3+
# Without this, ZooKeeper and Kafka are terminated simultaneously,
4+
# and Kafka hangs on controlled-shutdown ZooKeeper timeouts.
5+
apiVersion: kuttl.dev/v1beta1
6+
kind: TestStep
7+
commands:
8+
- script: |
9+
kubectl patch kafkacluster test-kafka -n $NAMESPACE --type merge -p '{"spec":{"brokers":{"roleGroups":{"default":{"replicas":0}}}}}'
10+
- script: |
11+
kubectl wait --for=delete pod -l app.kubernetes.io/instance=test-kafka -n $NAMESPACE --timeout=300s
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# Scale Kafka down before kuttl deletes the namespace.
3+
# Without this, ZooKeeper and Kafka are terminated simultaneously,
4+
# and Kafka hangs on controlled-shutdown ZooKeeper timeouts.
5+
apiVersion: kuttl.dev/v1beta1
6+
kind: TestStep
7+
commands:
8+
- script: |
9+
kubectl patch kafkacluster test-kafka -n $NAMESPACE --type merge -p '{"spec":{"brokers":{"roleGroups":{"default":{"replicas":0}}}}}'
10+
- script: |
11+
kubectl wait --for=delete pod -l app.kubernetes.io/instance=test-kafka -n $NAMESPACE --timeout=300s

0 commit comments

Comments
 (0)