eventing icon indicating copy to clipboard operation
eventing copied to clipboard

Broker class based defaults

Open pierDipi opened this issue 3 years ago • 5 comments

Problem

Operators can set defaults for brokers at the cluster or namespace level in the config-br-defaults ConfigMap.

When there are multiple classes in the same cluster, it's not possible to set a default for broker.spec fields based on the configured broker class.

A convenient configuration like the following would be perfect:

    clusterDefault:
      brokerClass: MTChannelBasedBroker
      apiVersion: v1
      kind: ConfigMap
      name: config-br-default-channel
      namespace: knative-eventing
      <broker_class>:
        spec:
          delivery: 
            retry: <...>
            # ...
          config: 
            apiVersion: <...>
            kind: <...>
            name: <...>
            namespace: <...>

Persona: Which persona is this feature for?

Operator

Exit Criteria A measurable (binary) test that would indicate that the problem has been resolved.

Time Estimate (optional): How many developer-days do you think this may take to resolve? 2

Additional context (optional) Add any other context about the feature request here.

/area brokers /priority important-longterm /kind feature-request

pierDipi avatar Dec 13 '21 14:12 pierDipi

/assign

liuchangyan avatar Nov 21 '22 02:11 liuchangyan

In this configuration, the <broker_class> is the unknown key in JSON, and in the original code it use parseEntry function to transfer YAML to JSON, if we want to unmarshal the known key in the whole YAML, we need to modify the NewDefaultsConfigFromMap, it will make our code became more complex, so I suggest we use the following Configuration:

  clusterDefault:
      brokerClass: MTChannelBasedBroker
      apiVersion: v1
      kind: ConfigMap
      name: config-br-default-channel
      namespace: knative-eventing
      brokerClassSpec:
        MTChannelBasedBroker:
          spec:
            delivery: 
              retry: <...>
              # ...
            config: 
              apiVersion: <...>
              kind: <...>
              name: <...>
              namespace: <...>
        KafkaBroker:
          spec:
            delivery: 
              retry: <...>
              # ...
            config: 
              apiVersion: <...>
              kind: <...>
              name: <...>
              namespace: <...>
  namespaceDefaults:
     namespace-1:
       brokerClass: MTChannelBasedBroker
     namespace-2:
       brokerClass: KafkaBroker

@pierDipi what do you think?

liuchangyan avatar Nov 21 '22 03:11 liuchangyan

/assign

Leo6Leo avatar Jan 03 '24 14:01 Leo6Leo

https://docs.google.com/document/d/1RKij-DYPmcbCTHF26hkXdrtWHqrksA-Fo5qYLRP7xVA/edit Added some initial thoughts in this google doc.

Leo6Leo avatar Jan 03 '24 22:01 Leo6Leo