mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 12:43:32 +09:00
The kafka e2e test pinned both the kafka and zookeeper components to the legacy "nano" preset (250m CPU / 128Mi memory). 128Mi cannot hold the Strimzi Kafka 3.9.1 and ZooKeeper JVMs: the brokers OOMKill on startup (exit 137) and CrashLoopBackOff, so the pods never reach Ready, the Kafka CR and its HelmRelease never go Ready, and the 5m readiness wait times out. It surfaced as a flake because 128Mi sits right at the JVM-start threshold — occasionally a broker passes readiness before its RSS crosses the cgroup limit. Raise both components to "c1.small" (1 CPU / 1Gi), the chart default, which comfortably fits the JVMs. The e2e sandbox VMs are 8 CPU / 24Gi, so 1Gi across the four pods is well within budget. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
62 lines
2.9 KiB
Bash
62 lines
2.9 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
@test "Create Kafka" {
|
|
name='test'
|
|
kubectl -n tenant-test delete kafka.apps.cozystack.io $name --ignore-not-found --timeout=2m || true
|
|
kubectl -n tenant-test wait kafka.apps.cozystack.io $name --for=delete --timeout=2m 2>/dev/null || true
|
|
kubectl apply -f- <<EOF
|
|
apiVersion: apps.cozystack.io/v1alpha1
|
|
kind: Kafka
|
|
metadata:
|
|
name: $name
|
|
namespace: tenant-test
|
|
spec:
|
|
external: false
|
|
kafka:
|
|
size: 10Gi
|
|
replicas: 2
|
|
storageClass: ""
|
|
resources: {}
|
|
resourcesPreset: "c1.small"
|
|
zookeeper:
|
|
size: 5Gi
|
|
replicas: 2
|
|
storageClass: ""
|
|
resources:
|
|
resourcesPreset: "c1.small"
|
|
topics:
|
|
- name: testResults
|
|
partitions: 1
|
|
replicas: 2
|
|
config:
|
|
min.insync.replicas: 2
|
|
- name: testOrders
|
|
config:
|
|
cleanup.policy: compact
|
|
segment.ms: 3600000
|
|
max.compaction.lag.ms: 5400000
|
|
min.insync.replicas: 2
|
|
partitions: 1
|
|
replicas: 2
|
|
EOF
|
|
# Wait for the operator to materialise the HelmRelease before kubectl wait
|
|
# kicks in (kubectl wait errors immediately if the object does not exist yet).
|
|
timeout 60 sh -ec "until kubectl -n tenant-test get hr kafka-$name >/dev/null 2>&1; do sleep 2; done"
|
|
kubectl -n tenant-test wait hr kafka-$name --timeout=5m --for=condition=ready
|
|
timeout 60 sh -ec "until kubectl -n tenant-test get kafkas $name >/dev/null 2>&1; do sleep 2; done"
|
|
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"
|
|
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"
|
|
}
|