Skip to content

Commit b92c438

Browse files
Andrey Kolkovandrondo
authored andcommitted
fix(kafka): resolve a single Kafka image for backup e2e harness
STRIMZI_KAFKA_IMAGES is a newline-separated version=image map with one entry per supported Kafka version. The old 'sed | tr -d [:space:]' collapsed every line into one string, producing an invalid multi-image reference (quay.io/...3.8.0quay.io/...3.8.1...) that failed 'kubectl run' with 'invalid reference format' and broke kafka-2-backup-roundtrip. Split on whitespace, keep image lines, strip the version prefix and take the last (newest) image so a single valid reference is exported. Signed-off-by: Andrey Kolkov <[email protected]>
1 parent 891fdad commit b92c438

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,15 @@ spec:
197197
set -eu
198198
cd ../../..
199199
[ -x examples/backups/kafka/run-all.sh ] || { echo "kafka backup example scripts not found at examples/backups/kafka" >&2; exit 1; }
200-
# Reuse the exact Kafka image the operator provisions brokers with, so
201-
# the backup Pod hits a warm image cache and never skews version.
200+
# Reuse a Kafka image the operator already caches on the nodes, so the
201+
# backup Pod hits a warm image cache. STRIMZI_KAFKA_IMAGES is a
202+
# newline-separated "version=image" map (one entry per supported Kafka
203+
# version), so split on whitespace, drop the "version=" prefix and take
204+
# the last (newest) image rather than concatenating every line into one
205+
# malformed reference.
202206
KAFKA_IMAGE=$(kubectl -n cozy-kafka-operator get deploy strimzi-cluster-operator \
203207
-o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="STRIMZI_KAFKA_IMAGES")].value}' \
204-
| sed 's/.*=//' | tr -d '[:space:]')
208+
| tr '[:space:]' '\n' | grep -E '=.*/kafka:' | sed 's/.*=//' | tail -n1)
205209
[ -n "$KAFKA_IMAGE" ] || { echo "could not resolve Kafka image from strimzi-cluster-operator" >&2; exit 1; }
206210
NAMESPACE="$NAMESPACE" KAFKA_IMAGE="$KAFKA_IMAGE" \
207211
S3_ENDPOINT="https://seaweedfs-s3.tenant-root:8333" \

0 commit comments

Comments
 (0)