From 787fe87341a0b3987a29e7b66b82f98a939d6bdc Mon Sep 17 00:00:00 2001 From: anand3559 Date: Mon, 4 May 2026 10:56:18 +0530 Subject: [PATCH] fix(kafka-setup): ensure Strimzi CRDs are established before applying Kafka resources Kafka setup fails with errors like 'no matches for kind KafkaNodePool' because Strimzi CRDs are not fully established when Kafka resources are applied. Added explicit waits for CRDs and operator readiness to prevent race condition. Also updated KEDA installation to use server-side apply to avoid annotation size issues. --- e2e/kafka/setup/kafka-ephemeral.yaml | 8 +++----- e2e/kafka/setup/kafka-topic.yaml | 4 ++-- e2e/kafka/setup/setup.sh | 11 ++++++++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/e2e/kafka/setup/kafka-ephemeral.yaml b/e2e/kafka/setup/kafka-ephemeral.yaml index 05dfa94491..42bd305a0c 100644 --- a/e2e/kafka/setup/kafka-ephemeral.yaml +++ b/e2e/kafka/setup/kafka-ephemeral.yaml @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # --------------------------------------------------------------------------- -apiVersion: kafka.strimzi.io/v1beta2 +apiVersion: kafka.strimzi.io/v1 kind: KafkaNodePool metadata: name: controller @@ -32,8 +32,7 @@ spec: type: ephemeral kraftMetadata: shared --- - -apiVersion: kafka.strimzi.io/v1beta2 +apiVersion: kafka.strimzi.io/v1 kind: KafkaNodePool metadata: name: broker @@ -51,8 +50,7 @@ spec: type: ephemeral kraftMetadata: shared --- - -apiVersion: kafka.strimzi.io/v1beta2 +apiVersion: kafka.strimzi.io/v1 kind: Kafka metadata: name: my-cluster diff --git a/e2e/kafka/setup/kafka-topic.yaml b/e2e/kafka/setup/kafka-topic.yaml index 896e43e4c1..04c0c60b1b 100644 --- a/e2e/kafka/setup/kafka-topic.yaml +++ b/e2e/kafka/setup/kafka-topic.yaml @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # --------------------------------------------------------------------------- -apiVersion: kafka.strimzi.io/v1beta2 +apiVersion: kafka.strimzi.io/v1 kind: KafkaTopic metadata: name: my-topic @@ -26,4 +26,4 @@ spec: replicas: 1 config: retention.ms: 7200000 - segment.bytes: 1073741824 \ No newline at end of file + segment.bytes: 1073741824 diff --git a/e2e/kafka/setup/setup.sh b/e2e/kafka/setup/setup.sh index 20adbb2a58..3e20a4a9f4 100755 --- a/e2e/kafka/setup/setup.sh +++ b/e2e/kafka/setup/setup.sh @@ -23,13 +23,18 @@ # #### -kubectl create namespace kafka -kubectl create -f 'https://strimzi.io/install/latest?namespace=kafka' -n kafka +kubectl create namespace kafka --dry-run=client -o yaml | kubectl apply -f - +kubectl apply --server-side -f 'https://strimzi.io/install/latest?namespace=kafka' -n kafka kubectl rollout status deployment strimzi-cluster-operator -n kafka --timeout=180s +# Wait for CRDs to be established +kubectl wait --for=condition=established crd/kafkas.kafka.strimzi.io --timeout=60s +kubectl wait --for=condition=established crd/kafkanodepools.kafka.strimzi.io --timeout=60s +kubectl wait --for=condition=established crd/kafkatopics.kafka.strimzi.io --timeout=60s + #### Setup Keda operator # it creates by default a keda namespace -kubectl apply -f https://github.com/kedacore/keda/releases/download/v2.17.2/keda-2.17.2.yaml +kubectl apply --server-side -f https://github.com/kedacore/keda/releases/download/v2.17.2/keda-2.17.2.yaml kubectl rollout status deployment keda-operator -n keda --timeout=180s #### Setup a Kafka cluster which we'll use for testing