Knative Eventing Sugar Controller
The Sugar Controller is by default and can be enabled by configuring config-sugar
ConfigMap. See below for a simple example and for more details.
Automatic Broker Creation
One way to create a Broker is to manually apply a resource to a cluster using the default settings:
Copy the following YAML into a file:
There might be cases where automated Broker creation is desirable, such as on namespace creation, or on Trigger creation. The Sugar controller enables those use-cases. The following sample configuration of the ConfigMap enables Sugar Controller for select Namespaces & all Triggers.
- When a Namespace is created with label
my.custom.injection.key: enabled
, the Sugar controller will create a Broker named “default” in that namespace. - When a Trigger is created, the Sugar controller will create a Broker named “default” in the Trigger’s namespace.
When a Broker is deleted and but the referenced label selectors are in use, the Sugar Controller will automatically recreate a default Broker.
Creating a “default” Broker when creating a Namespace:
Copy the following YAML into a file:
apiVersion: v1
name: example
labels:
my.custom.injection.key: enabled
-
Where is the name of the file you created in the previous step.
To automatically create a Broker after a namespace exists, label the Namespace:
If the Broker named “default” already exists in the Namespace, the Sugar Controller will do nothing.
Trigger Example
Create a “default” Broker in the Trigger’s Namespace when creating a Trigger:
If the Broker named “default” already exists in the Namespace, the Sugar Controller will do nothing and the Trigger will not own the existing Broker.