knative-extensions/eventing-kafka-broker

EventType auto-create for MTChannelBasedBroker backed by KafkaChannel creates two event types

Closed this issue · 5 comments

This is similar to knative/eventing#7154
A MTChannelBasedBroker that is configured to use KafkaChannel generates two events, one with spec.reference.kind:KafkaChannel and one with spec.reference.kind:Broker. It should create only one with kind:Broker.

Describe the bug

Broker definition that generates the two event type objects:

  kind: Broker
  metadata:
    annotations:
      eventing.knative.dev/broker.class: MTChannelBasedBroker
    name: broker-sxncpdop
    namespace: test-cznqpwoy
  spec:
    config:
      apiVersion: v1
      kind: ConfigMap
      name: kafka-broker-config-dbnmlkgx
      namespace: test-cznqpwoy
    delivery:
      backoffDelay: PT0.2S
      backoffPolicy: exponential
      retry: 10

Related ConfigMap:

apiVersion: v1
data:
  channel-template-spec: |
    apiVersion: messaging.knative.dev/v1beta1
    kind: KafkaChannel
    spec:
      numPartitions: 2
      replicationFactor: 3
kind: ConfigMap
metadata:
  name: kafka-broker-config-dbnmlkgx
  namespace: test-cznqpwoy

Generated event types:

oc get eventtypes -A -oyaml
apiVersion: v1
items:
- apiVersion: eventing.knative.dev/v1beta2
  kind: EventType
  metadata:
    annotations:
      eventing.knative.dev/creator: system:serviceaccount:knative-eventing:mt-broker-ingress
      eventing.knative.dev/lastModifier: system:serviceaccount:knative-eventing:mt-broker-ingress
    creationTimestamp: "2024-08-20T08:19:46Z"
    generation: 1
    name: et-broker-sxncpdop-5f5920d3fe07c9d40216b7d4f9825422
    namespace: test-cznqpwoy
    ownerReferences:
    - apiVersion: eventing.knative.dev/v1
      kind: Broker
      name: broker-sxncpdop
      uid: 10f844d6-a873-442c-8123-15c5ecd45ca9
    resourceVersion: "21542750"
    uid: 0409f3d6-3158-4910-8fec-4cdec30eb397
  spec:
    description: Event Type auto-created by controller
    reference:
      apiVersion: eventing.knative.dev/v1
      kind: Broker
      name: broker-sxncpdop
      namespace: test-cznqpwoy
    schema: http://example.com/schema
    schemaData: http://example.com/schema
    source: http://example.com/source
    type: test.broker.custom.event.type
  status:
    conditions:
    - lastTransitionTime: "2024-08-20T08:19:46Z"
      status: "True"
      type: Ready
    - lastTransitionTime: "2024-08-20T08:19:46Z"
      status: "True"
      type: ReferenceExists
    observedGeneration: 1
- apiVersion: eventing.knative.dev/v1beta2
  kind: EventType
  metadata:
    annotations:
      eventing.knative.dev/creator: system:serviceaccount:knative-eventing:knative-kafka-channel-data-plane
      eventing.knative.dev/lastModifier: system:serviceaccount:knative-eventing:knative-kafka-channel-data-plane
    creationTimestamp: "2024-08-20T08:19:46Z"
    generation: 1
    name: et-broker-sxncpdop-kne-trigger-530e2d80844a293f6e4e71678e29d146
    namespace: test-cznqpwoy
    ownerReferences:
    - apiVersion: messaging.knative.dev/v1beta1
      kind: KafkaChannel
      name: broker-sxncpdop-kne-trigger
      uid: 64f2936b-67b0-43e7-abba-e06478290559
    resourceVersion: "21542761"
    uid: e729b08e-1e07-4b05-bf3f-ace058a7f84b
  spec:
    description: Event Type auto-created by controller
    reference:
      apiVersion: messaging.knative.dev/v1beta1
      kind: KafkaChannel
      name: broker-sxncpdop-kne-trigger
      namespace: test-cznqpwoy
    schema: http://example.com/schema
    source: http://example.com/source
    type: test.broker.custom.event.type
  status:
    conditions:
    - lastTransitionTime: "2024-08-20T08:19:46Z"
      status: "True"
      type: Ready
    - lastTransitionTime: "2024-08-20T08:19:46Z"
      status: "True"
      type: ReferenceExists
    observedGeneration: 1
kind: List
metadata:
  resourceVersion: ""

Expected behavior
Only one event type is created, with kind: Broker.

To Reproduce
The reproducer test is in this PR.
Would be nice to attach the test with a possible fix later and commit it into the repository.

Knative release version
1.14

Additional context

@mgencur I guess for InMemoryChannel this is not an issue?

@mgencur I guess for InMemoryChannel this is not an issue?

Correct. For InMemoryChannel this was already fixed.

@mgencur: Reopened this issue.

In response to this:

The TestChannelSubscriptionEventTypeAutoCreate test from https://github.com/knative-extensions/eventing-kafka-broker/pull/4074/files still shows that the eventtype references a KafkaChannel instead of Subscription. See https://prow.knative.dev/view/gs/knative-prow/pr-logs/pull/knative-extensions_eventing-kafka-broker/4074/channel-reconciler-tests-sasl-plain_eventing-kafka-broker_main/1833439756705337344

Reference:Kind = KafkaChannel, Namespace = test-shtvzyyt, Name = channel-rkavthwn

/reopen

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-sigs/prow repository.

/close

@mgencur: Closing this issue.

In response to this:

/close

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-sigs/prow repository.