eventing
eventing copied to clipboard
Broker class based defaults
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
/assign
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?
/assign
https://docs.google.com/document/d/1RKij-DYPmcbCTHF26hkXdrtWHqrksA-Fo5qYLRP7xVA/edit Added some initial thoughts in this google doc.