banzaicloud/koperator

Unable to create multiple kafka topics

stoader opened this issue · 5 comments

Describe the bug
Unable to create multiple kafka topics using KafkaTopic custom resources on K8s cluster version 1.21 with latest koperator built from master branch.

Steps to reproduce the issue:
Create two KafkaTopic custom resources with different topic names (e.g. topic1, topic2). The second fails as the validating webhook rejects it with "KafkaTopic CR 'topic1' in namesapce 'kafka' is already referencing Kafka topic 'topic1'

Expected behavior
Ability to create multiple kafka topics with different names via KafkaTopic custom resources.

this is happening even on k8s 1.18.3 for me with latest koperator version v0.20.1 , I am seeing such errors in koperator logs

{"level":"info","ts":"2022-01-21T05:43:06.796Z","logger":"controllers.KafkaCluster","msg":"could not create cruise control topic: admission webhook "kafkatopics.kafka.banzaicloud.io" denied the request: KafkaTopic CR 'mme-events' in namesapce 'fed-kafka' is already referencing Kafka topic 'mme-events'","Request.Namespace":"fed-kafka/kafka","Request.Name":"kafka"}

{"level":"error","ts":"2022-01-21T05:41:51.264Z","logger":"controller.kafkatopic","msg":"Reconciler error","name":"smf-events","namespace":"fed-kafka","error":"admission webhook "kafkatopics.kafka.banzaicloud.io" denied the request: KafkaTopic CR 'pgw-events' in namesapce 'fed-kafka' is already referencing Kafka topic 'pgw-events'","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.10.3/pkg/internal/controller/controller.go:227"}

Probably caused by #717

@adamantal in which version was this regression introduced? will v0.20.0 also have this issue?

The first release that contains this issue is 0.20.1, so 0.20.0 does not have this defect.
Since the error message is also introduced in this version, you must be in >=0.20.1.

This one just got fixed. We also released a new version from the operator https://github.com/banzaicloud/koperator/releases/tag/v0.20.2 which contains the fix.