Subscription

The subscriptions.eventing.kyma-project.io 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 subscriptions.eventing.kyma-project.io -o yaml

Sample custom resource

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

WARNING: Non-alphanumeric characters [^a-zA-Z0-9]+ are not allowed in event names under the spec.filter.filters.eventType.value property. 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
apiVersion: eventing.kyma-project.io/v1alpha1
kind: Subscription
metadata:
name: test
namespace: test
spec:
filter:
filters:
- eventSource:
property: source
type: exact
value: ""
eventType:
property: type
type: exact
value: sap.kyma.custom.commerce.order.created.v1
sink: http://test.test.svc.cluster.local

Custom resource parameters

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

ParameterRequiredDescription
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.filterYesDefines the list of filters.
spec.filter.dialectNoSpecifies the preferred Eventing backend. Currently, the capability to switch between Eventing backends is not available. It is set to NATS by default.
spec.filter.filtersYesDefines the filter element as a combination of two CloudEvent filter elements.
spec.filter.filters.eventSourceYesThe origin from which events are published.
spec.filter.filters.eventTypeYesThe type of events used to trigger workloads.
spec.filter.filters.eventSource.propertyYesMust be set to source.
spec.filter.filters.eventSource.typeNoMust be set to exact.
spec.filter.filters.eventSource.valueYesMust be set to "" for the NATS backend.
spec.filter.filters.eventType.propertyYesMust be set to type.
spec.filter.filters.eventType.typeNoMust be set to exact.
spec.filter.filters.eventType.valueYesName of the event being subscribed to, for example: sap.kyma.custom.commerce.order.created.v1. The name cannot contain any non-alphanumeric characters [^a-zA-Z0-9]+. Read Event names for more information.
spec.protocolYesMust be set to "".
spec.protocolsettingsYesDefines the CloudEvent protocol setting specification implementation. Must be set to {}.
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:

ComponentDescription
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.