Skip to content

Subscription CR ​

Use the Subscription custom resource (CR) to describe the kind of data and the format used to subscribe to events. You specify the event types and the target endpoint for event delivery.

When you define a Subscription, the Eventing Manager configures a dedicated consumer in the chosen backend for each event type you specify. These consumers are push-based, meaning the backend delivers events to your subscriber's sink as soon as they become available.

The following components use the Subscription CR:

  • Eventing Manager: Reconciles on Subscriptions and creates a connection between subscribers and the Eventing backend.
  • Eventing Publisher Proxy: Reads the Subscriptions to find out how events are used for each Application.

You must delete all Subscription CRs before you can delete the Eventing module.

To see the current CRD in YAML format, run:

kubectl get crd subscriptions.eventing.kyma-project.io -o yaml

Sample Custom Resource ​

This sample Subscription CR subscribes to an event called order.created.v1.

yaml
apiVersion: eventing.kyma-project.io/v1alpha2
kind: Subscription
metadata:
  name: test
  namespace: test
spec:
  typeMatching: standard
  source: commerce
  types:
    - order.created.v1
  sink: http://test.test.svc.cluster.local
  config:
    maxInFlightMessages: "10"

Subscription Status ​

The status.ready field shows the overall readiness of the Subscription. If false, check the status.conditions array for details.

Custom Resource Parameters ​

NOTE

If the Subscription CR and the target subscriber aren't in the same namespace, you must specify the sink.ref.namespace.

Eventing backends might not support certain characters in event names defined under spec.type. If you use unsupported characters, the Eventing module removes them. For details, see Event Name Cleanup.

Subscription.eventing.kyma-project.io/v1alpha2 ​

Spec:

ParameterTypeDescription
configmap[string]stringMap of configuration options that will be applied on the backend.
idstringUnique identifier of the Subscription, read-only.
sink (required)stringKubernetes Service that should be used as a target for the events that match the Subscription. Must exist in the same Namespace as the Subscription.
source (required)stringDefines the origin of the event.
typeMatchingstringDefines how types should be handled.
- standard: backend-specific logic will be applied to the configured source and types.
- exact: no further processing will be applied to the configured source and types.
types (required)[]stringList of event types that will be used for subscribing on the backend.

Status:

ParameterTypeDescription
backendobjectBackend-specific status which is applicable to the active backend only.
backend.​apiRuleNamestringName of the APIRule which is used by the Subscription.
backend.​emsSubscriptionStatusobjectStatus of the Subscription as reported by EventMesh.
backend.​emsSubscriptionStatus.​lastFailedDeliverystringTimestamp of the last failed delivery.
backend.​emsSubscriptionStatus.​lastFailedDeliveryReasonstringReason for the last failed delivery.
backend.​emsSubscriptionStatus.​lastSuccessfulDeliverystringTimestamp of the last successful delivery.
backend.​emsSubscriptionStatus.​statusstringStatus of the Subscription as reported by the backend.
backend.​emsSubscriptionStatus.​statusReasonstringReason for the current status.
backend.​emsTypes[]objectList of mappings from event type to EventMesh compatible types. Used only with EventMesh as the backend.
backend.​emsTypes.​eventMeshType (required)stringEvent type that is used on the EventMesh backend.
backend.​emsTypes.​originalType (required)stringEvent type that was originally used to subscribe.
backend.​emshashintegerHash used to identify an EventMesh Subscription retrieved from the server without the WebhookAuth config.
backend.​ev2hashintegerChecksum for the Subscription custom resource.
backend.​eventMeshLocalHashintegerHash used to identify an EventMesh Subscription posted to the server without the WebhookAuth config.
backend.​externalSinkstringWebhook URL used by EventMesh to trigger subscribers.
backend.​failedActivationstringProvides the reason if a Subscription failed activation in EventMesh.
backend.​types[]objectList of event type to consumer name mappings for the NATS backend.
backend.​types.​consumerNamestringName of the JetStream consumer created for the event type.
backend.​types.​originalType (required)stringEvent type that was originally used to subscribe.
backend.​webhookAuthHashintegerHash used to identify the WebhookAuth of an EventMesh Subscription existing on the server.
conditions[]objectCurrent state of the Subscription.
conditions.​lastTransitionTimestringDefines the date of the last condition status change.
conditions.​messagestringProvides more details about the condition status change.
conditions.​reasonstringDefines the reason for the condition status change.
conditions.​status (required)stringStatus of the condition. The value is either True, False, or Unknown.
conditions.​typestringShort description of the condition.
ready (required)booleanOverall readiness of the Subscription.
types (required)[]objectList of event types after cleanup for use with the configured backend.
types.​cleanType (required)stringEvent type after it was cleaned up from backend compatible characters.
types.​originalType (required)stringEvent type as specified in the Subscription spec.