Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

KafkaChannel doesn't respect the scope annotation when creating the topic #1189

Closed
aliok opened this issue May 4, 2020 · 24 comments
Closed
Labels
channel/kafka Kafka channel related issue kind/bug Categorizes issue or PR as related to a bug.

Comments

@aliok
Copy link
Member

aliok commented May 4, 2020

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's knative-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:

@aliok aliok added the kind/bug Categorizes issue or PR as related to a bug. label May 4, 2020
@lberk
Copy link
Member

lberk commented May 4, 2020

/label channel/kafka

@knative-prow-robot knative-prow-robot added the channel/kafka Kafka channel related issue label May 4, 2020
@aliok
Copy link
Member Author

aliok commented May 5, 2020

/assign

@aliok
Copy link
Member Author

aliok commented May 5, 2020

/unassign @aliok

@aliok
Copy link
Member Author

aliok commented May 5, 2020

I am unassigning this from myself. There's a decision needs to be done first around if we would like to have this eventing.knative.dev/scope annotation or if we would like to find another way to support the use case.
Fixing this problem is not very hard but not trivial either. Thus I would like to park this.

Threads:

@aliok
Copy link
Member Author

aliok commented Jul 28, 2020

cc @scholzj

@scholzj
Copy link

scholzj commented Aug 11, 2020

Kafka doesn't have any native support for namespaces. So when the topic operator is enabled and a topic in Kafka is created, it will created a new KafkaTopic custom resource corresponding to the topic in the namespace it is watching. By default, that is the namespace where the Kafka cluster runs (but if a user provided this cluster it can be configured to a different namespace). So this is expected and should not cause any problems. Users who do not want this can also disable the Topic Operator completely and manage the Kafka topics only directly in Kafka. Hope this helps.

@AceHack
Copy link
Contributor

AceHack commented Sep 11, 2020

we have multiple kafka clusters and need the ability to connect to different clusters

@AceHack
Copy link
Contributor

AceHack commented Sep 11, 2020

Can you please fix this as soon as possible since "Fixing this problem is not very hard". It is causing us bad issues currently.

@AceHack
Copy link
Contributor

AceHack commented Sep 11, 2020

@scholzj what do you man disable the Topic Operator? how can you do that? Also, knative does not have a CRD named KafkaTopic. I'm so confused by your comment.

@scholzj
Copy link

scholzj commented Sep 11, 2020

@scholzj what do you man disable the Topic Operator? how can you do that? Also, knative does not have a CRD named KafkaTopic. I'm so confused by your comment.

The Kafka contrib part is using Kafka from a project called Strimzi. The KafkaTopic resources are created by the Strimzi Topic Operator which can be disabled by removing this line from the Kafka custom resource which defines the Kafka cluster. for the record, I do not know much about Knative so I have no clue whether disabling it is an option or whether Knative uses it in any way.

@AceHack
Copy link
Contributor

AceHack commented Sep 11, 2020

@scholzj in no way does knative kafka channel contrib use Strimzi. It creates topics all by itself without any external kafka operator such as Strimzi. For instance, we don't even have Strimzi installed and use knative kafka channel contrib and it works fine. Whenever you create KafkaChannel CRD that IS part of knative kafka channel contrib, it's the knative kafka channel controller creates the kafka topic, Strimizi is not involved at all. This fix needs to happen inside the knative kafka channel controller, not Strimizi.

@scholzj
Copy link

scholzj commented Sep 11, 2020

I didn't said it is using the KafkaTopic resources to create topics. I the operator would create them when you create a topic in Kafka. Anyway ... that is my understanding why I was cced here. If it is not the case, you can just ignore anything I said.

@anerathil
Copy link

Any news on this?

@aliok
Copy link
Member Author

aliok commented Nov 6, 2020

I know that this is valid for 0.17, not sure about the next versions.

Reproducer:

@github-actions
Copy link

github-actions bot commented Feb 5, 2021

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 5, 2021
@AceHack
Copy link
Contributor

AceHack commented Feb 6, 2021

Bump we still need something like this

@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 6, 2021
@github-actions
Copy link

github-actions bot commented May 7, 2021

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 7, 2021
@AceHack
Copy link
Contributor

AceHack commented May 7, 2021

Bump any plans on supporting more than one kafka cluster?

@lionelvillard
Copy link
Member

/remove-lifecycle stale

@knative-prow-robot knative-prow-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 7, 2021
@lionelvillard
Copy link
Member

@aliok Does KafkaChannel support this now or is there more to do?

@aliok
Copy link
Member Author

aliok commented May 7, 2021

sorry, we still couldn't fix this issue :(

@vaikas
Copy link
Contributor

vaikas commented May 26, 2021

@aliok would you mind recreating this issue in the eventing-kafka?
This repo is getting archived and I need to close all the issues here.

@aliok
Copy link
Member Author

aliok commented May 26, 2021

/close

Moved to eventing-kafka repo: knative-extensions/eventing-kafka#656

@knative-prow-robot
Copy link
Contributor

@aliok: Closing this issue.

In response to this:

/close

Moved to eventing-kafka repo: knative-extensions/eventing-kafka#656

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
channel/kafka Kafka channel related issue kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants