Skip to content

Commit 0b93328

Browse files
committed
test(kafka): drop the false-green ZK->KRaft migration chainsaw suite
The kafka-zk-to-kraft-migration suite did not exercise the pre-upgrade hook, it reimplemented a simplified flow beside it: a controller pool named "controller" instead of the hashed c-<hash>, no strimzi.io/next-node-ids pin, and a single broker so the controller-vs-broker node-id collision could never occur. That is exactly the defect the hook exists to prevent, so the suite stayed green on a revision whose in-place migration lost every message — reproduced by hand 2/2 on a live cluster. A suite that cannot fail on this code is worse than no suite: it reads as migration coverage and invites trust it has not earned, while costing ~380s on every Kafka PR and asserting only that a PVC object exists, never reading a record back. The migration hook's bats suite and the live upgrade runs are the real coverage; the Strimzi bump would delete this suite regardless. Signed-off-by: Alexey Artamonov <[email protected]>
1 parent 8ef230f commit 0b93328

1 file changed

Lines changed: 0 additions & 229 deletions

File tree

‎hack/e2e-chainsaw/kafka/chainsaw-test.yaml‎

Lines changed: 0 additions & 229 deletions
Original file line numberDiff line numberDiff line change
@@ -121,232 +121,3 @@ spec:
121121
metadata:
122122
name: kafka-test-kafka-bootstrap
123123
(subsets[0].addresses[0].ip != null): true
124-
---
125-
# ZK->KRaft in-place migration (the CRITICAL data-adoption path).
126-
#
127-
# An existing ZooKeeper cluster must be adopted by a broker KafkaNodePool named
128-
# exactly "kafka": Strimzi derives broker/PVC names as <cluster>-<pool>-<id>, so
129-
# only that name reuses the running <cluster>-kafka-N brokers and their PVCs. A
130-
# wrong name (e.g. <release>-broker) provisions fresh empty brokers and orphans
131-
# the tenant's data. This test seeds a ZK cluster, drives the same migration the
132-
# pre-upgrade hook performs, and asserts the original broker PVC survives (same
133-
# object, never recreated) and the cluster reaches KRaft. This sequence was also
134-
# validated by hand against a live cluster.
135-
apiVersion: chainsaw.kyverno.io/v1alpha1
136-
kind: Test
137-
metadata:
138-
name: kafka-zk-to-kraft-migration
139-
spec:
140-
# Run in a dedicated namespace, not the shared tenant-test the other app suites
141-
# use: this test raw-applies Strimzi resources and a namespace-wide LimitRange
142-
# and leaves deleteClaim:false PVCs behind, which would pollute a sibling suite
143-
# sharing the namespace. Raw Strimzi needs no tenant labels, so an own namespace
144-
# is fine; Chainsaw creates and tears it down.
145-
namespace: kafka-migration-e2e
146-
catch:
147-
- events: {}
148-
- podLogs:
149-
selector: strimzi.io/cluster=kafka-migz
150-
tail: 50
151-
steps:
152-
- name: seed-zookeeper-cluster
153-
try:
154-
# Mirror a real tenant namespace: a LimitRange that defaults every container
155-
# to 128Mi. This is what makes resource-less pods OOM — the migration node
156-
# pools must set their own resources to survive it (regression guard).
157-
- apply:
158-
resource:
159-
apiVersion: v1
160-
kind: LimitRange
161-
metadata:
162-
name: tenant-defaults
163-
spec:
164-
limits:
165-
- type: Container
166-
default:
167-
memory: 128Mi
168-
defaultRequest:
169-
memory: 128Mi
170-
- apply:
171-
resource:
172-
apiVersion: kafka.strimzi.io/v1beta2
173-
kind: Kafka
174-
metadata:
175-
name: kafka-migz
176-
annotations:
177-
strimzi.io/node-pools: disabled
178-
strimzi.io/kraft: disabled
179-
spec:
180-
kafka:
181-
version: 3.9.0
182-
replicas: 1
183-
# Explicit resources so the seed survives the LimitRange above,
184-
# mirroring a real chart-deployed ZooKeeper cluster.
185-
resources:
186-
requests:
187-
memory: 1Gi
188-
limits:
189-
memory: 1Gi
190-
listeners:
191-
- name: plain
192-
port: 9092
193-
type: internal
194-
tls: false
195-
config:
196-
offsets.topic.replication.factor: 1
197-
transaction.state.log.replication.factor: 1
198-
transaction.state.log.min.isr: 1
199-
default.replication.factor: 1
200-
min.insync.replicas: 1
201-
storage:
202-
type: jbod
203-
volumes:
204-
- id: 0
205-
type: persistent-claim
206-
size: 5Gi
207-
deleteClaim: false
208-
zookeeper:
209-
replicas: 1
210-
resources:
211-
requests:
212-
memory: 512Mi
213-
limits:
214-
memory: 512Mi
215-
storage:
216-
type: persistent-claim
217-
size: 5Gi
218-
deleteClaim: false
219-
entityOperator:
220-
topicOperator:
221-
resources:
222-
requests:
223-
memory: 256Mi
224-
limits:
225-
memory: 512Mi
226-
userOperator:
227-
resources:
228-
requests:
229-
memory: 256Mi
230-
limits:
231-
memory: 512Mi
232-
- assert:
233-
timeout: 12m
234-
resource:
235-
apiVersion: kafka.strimzi.io/v1beta2
236-
kind: Kafka
237-
metadata:
238-
name: kafka-migz
239-
status:
240-
kafkaMetadataState: ZooKeeper
241-
(conditions[?type == 'Ready']):
242-
- status: "True"
243-
# Baseline: the classic broker PVC that must survive the migration.
244-
- assert:
245-
resource:
246-
apiVersion: v1
247-
kind: PersistentVolumeClaim
248-
metadata:
249-
name: data-0-kafka-migz-kafka-0
250-
status:
251-
phase: Bound
252-
253-
- name: migrate-to-kraft
254-
try:
255-
# The adopting broker pool MUST be named "kafka" (mirrors migration-hook.yaml).
256-
- apply:
257-
resource:
258-
apiVersion: kafka.strimzi.io/v1beta2
259-
kind: KafkaNodePool
260-
metadata:
261-
name: kafka
262-
labels:
263-
strimzi.io/cluster: kafka-migz
264-
spec:
265-
replicas: 1
266-
roles:
267-
- broker
268-
storage:
269-
type: jbod
270-
volumes:
271-
- id: 0
272-
type: persistent-claim
273-
size: 5Gi
274-
deleteClaim: false
275-
- apply:
276-
resource:
277-
apiVersion: kafka.strimzi.io/v1beta2
278-
kind: KafkaNodePool
279-
metadata:
280-
name: controller
281-
labels:
282-
strimzi.io/cluster: kafka-migz
283-
spec:
284-
replicas: 1
285-
roles:
286-
- controller
287-
storage:
288-
type: jbod
289-
volumes:
290-
- id: 0
291-
type: persistent-claim
292-
size: 5Gi
293-
kraftMetadata: shared
294-
deleteClaim: false
295-
# Drive the migration exactly as the pre-upgrade hook does: enable node
296-
# pools + kraft=migration, wait for KRaftPostMigration, then finalize.
297-
- script:
298-
timeout: 12m
299-
content: |
300-
set -eu
301-
kubectl -n "$NAMESPACE" annotate kafka.kafka.strimzi.io kafka-migz strimzi.io/node-pools=enabled --overwrite
302-
kubectl -n "$NAMESPACE" annotate kafka.kafka.strimzi.io kafka-migz strimzi.io/kraft=migration --overwrite
303-
for i in $(seq 1 60); do
304-
s=$(kubectl -n "$NAMESPACE" get kafka.kafka.strimzi.io kafka-migz -o jsonpath='{.status.kafkaMetadataState}' 2>/dev/null || echo "")
305-
echo "[$i/60] kafkaMetadataState=$s"
306-
case "$s" in KRaftPostMigration|PreKRaft|KRaft) break ;; esac
307-
sleep 10
308-
done
309-
kubectl -n "$NAMESPACE" annotate kafka.kafka.strimzi.io kafka-migz strimzi.io/kraft=enabled --overwrite
310-
- assert:
311-
timeout: 6m
312-
resource:
313-
apiVersion: kafka.strimzi.io/v1beta2
314-
kind: Kafka
315-
metadata:
316-
name: kafka-migz
317-
status:
318-
kafkaMetadataState: KRaft
319-
320-
- name: verify-adoption
321-
try:
322-
# The original broker PVC is still Bound — adopted in place, not recreated.
323-
- assert:
324-
resource:
325-
apiVersion: v1
326-
kind: PersistentVolumeClaim
327-
metadata:
328-
name: data-0-kafka-migz-kafka-0
329-
status:
330-
phase: Bound
331-
# A wrong (<release>-broker) pool name would have created this PVC instead.
332-
- error:
333-
resource:
334-
apiVersion: v1
335-
kind: PersistentVolumeClaim
336-
metadata:
337-
name: data-0-kafka-migz-broker-0
338-
# The adopted brokers live under a pool named exactly "kafka" (that name is
339-
# what preserved the data-0-kafka-migz-kafka-0 PVC above). Asserting the pool
340-
# rather than a broker Pod avoids racing the final KRaft roll.
341-
- assert:
342-
timeout: 2m
343-
resource:
344-
apiVersion: kafka.strimzi.io/v1beta2
345-
kind: KafkaNodePool
346-
metadata:
347-
name: kafka
348-
labels:
349-
strimzi.io/cluster: kafka-migz
350-
spec:
351-
roles:
352-
- broker

0 commit comments

Comments
 (0)