This repository was archived by the owner on Sep 2, 2024. It is now read-only.
This repository was archived by the owner on Sep 2, 2024. It is now read-only.
Open
Description
ORIGINAL ISSUE: knative/eventing-contrib#1189
Describe the bug
When eventing.knative.dev/scope: namespace
annotation is available on a channel, KafkaChannel should create the topic in the Kafka cluster that's specified in the config-kafka
configmap within the same namespace.
But the topic is created in the Kafka cluster that's specified in the Knative system's knative-eventing/config-kafka
configmap.
Expected behavior
Topic should be created in the correct Kafka instance.
To Reproduce
- Create a Kafka cluster in
kafka
namespace - Use that cluster in Knative eventing system's
knative-eventing/config-kafka
configmap:
apiVersion: v1
kind: ConfigMap
metadata:
name: config-kafka
namespace: knative-eventing
data:
bootstrapServers: my-cluster-kafka-bootstrap.kafka:9092
- Create a Kafka cluster in
foo
namespace - Use that cluster in
foo
'sknative-eventing/config-kafka
configmap:
apiVersion: v1
kind: ConfigMap
metadata:
name: config-kafka
namespace: foo
data:
bootstrapServers: my-cluster-kafka-bootstrap.foo:9092
- Create a channel in
foo
, with the namespace scope annotation:
apiVersion: messaging.knative.dev/v1alpha1
kind: KafkaChannel
metadata:
name: my-kafka-channel
namespace: foo
annotations:
eventing.knative.dev/scope: namespace
spec:
numPartitions: 1
replicationFactor: 1
- Topic is created in the first Kafka cluster
Knative release version
I reproduced the issue on 0.13, but it is valid in 0.14 too
Additional context
Creating namespace-scoped dispatchers : https://github.com/knative/eventing-contrib/blob/release-0.14/kafka/channel/README.md
Code refs:
- This is the place where the system Kafka config is read: https://github.com/knative/eventing-contrib/blob/25ab82d6a7319e16440ba6550055c2ae6f046605/kafka/channel/pkg/reconciler/controller/controller.go#L90
- It is passed from here to there, until it is used in the topic creation: https://github.com/knative/eventing-contrib/blob/25ab82d6a7319e16440ba6550055c2ae6f046605/kafka/channel/pkg/reconciler/controller/kafkachannel.go#L176
scope
reading happens after the topic creation using the system namespace