Skip to content

Commit f21725f

Browse files
committed
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
1 parent bf667f1 commit f21725f

7 files changed

Lines changed: 77 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: 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":{"automatic-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)