The CustomResourceDefinition (CRD) is a detailed description of the kind of data and the format used to subscribe to events. To get the up-to-date CRD and show the output in the YAML format, run this command:

kubectl get crd -o yaml

Sample custom resource

This sample Subscription custom resource (CR) subscribes to an event called order.created.v1.

WARNING: Prohibited characters in event names under the spec.types property, are not supported in some backends. If any are detected, Eventing will remove them. Read Event names for more information.

NOTE: Both the subscriber and the Subscription should exist in the same Namespace.

Click to copy
kind: Subscription
name: test
namespace: test
typeMatching: standard
source: commerce
- order.created.v1
sink: http://test.test.svc.cluster.local
maxInFlightMessages: "10"

Custom resource parameters

This table lists all the possible parameters of a given resource together with their descriptions:

metadata.nameYesSpecifies the name of the CR.
metadata.namespaceNoDefines the Namespace in which the CR is available. It is set to default unless your specify otherwise.
spec.typeMatchingNoDefines the matching type (standard or exact) for event types. When it is set to exact, Eventing does not do any kind of modifications to the provided spec.types internally. In case of standard, Eventing modifies the types internally to fulfil the backend requirements. It is set to standard unless you specify otherwise. NOTE: The exact type matching with NATS JetStream is only supported to upgrade a Subscription CR from version v1alpha1 to v1alpha2, and it will be deprecated in future.
spec.sourceYesThe origin from which events are published.
spec.typesYesDefines the list of event types used to trigger workloads.
spec.sinkYesSpecifies the HTTP endpoint where matching events should be sent to, for example: test.test.svc.cluster.local.
spec.config.maxInFlightMessagesNoThe maximum idle "in-flight messages" sent by NATS to the sink without waiting for a response. By default, it is set to 10.

These components use this CR:

Eventing ControllerThe Eventing Controller reconciles on Subscriptions and creates a connection between subscribers and the Eventing backend.
Event Publisher ProxyThe Event Publisher Proxy reads the Subscriptions to find out how events are used for each Application.