v1alpha2

package
v0.0.0-...-ea047a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Overview

Package v1alpha2 contains API Schema definitions for the eventing v1alpha2 API group. +kubebuilder:object:generate=true +groupName=eventing.kyma-project.io

Index

Constants

View Source
const (
	TypeMatchingStandard TypeMatching = "standard"
	TypeMatchingExact    TypeMatching = "exact"

	// config fields.
	MaxInFlightMessages = "maxInFlightMessages"

	// protocol settings.
	Protocol                        = "protocol"
	ProtocolSettingsContentMode     = "contentMode"
	ProtocolSettingsExemptHandshake = "exemptHandshake"
	ProtocolSettingsQos             = "qos"

	// webhook auth fields.
	WebhookAuthType         = "type"
	WebhookAuthGrantType    = "grantType"
	WebhookAuthClientID     = "clientId"
	WebhookAuthClientSecret = "clientSecret"
	WebhookAuthTokenURL     = "tokenUrl"
	WebhookAuthScope        = "scope"
)
View Source
const (
	DefaultMaxInFlightMessages = "10"

	InvalidPrefix         = "sap.kyma.custom"
	ClusterLocalURLSuffix = "svc.cluster.local"
	ValidSource           = "source"
)

Variables

View Source
var (
	SourcePath = field.NewPath("spec").Child("source")
	TypesPath  = field.NewPath("spec").Child("types")
	ConfigPath = field.NewPath("spec").Child("config")
	SinkPath   = field.NewPath("spec").Child("sink")
	NSPath     = field.NewPath("metadata").Child("namespace")

	EmptyErrDetail          = "must not be empty"
	InvalidURIErrDetail     = "must be valid as per RFC 3986"
	DuplicateTypesErrDetail = "must not have duplicate types"
	LengthErrDetail         = "must not be of length zero"
	MinSegmentErrDetail     = fmt.Sprintf("must have minimum %s segments", strconv.Itoa(minEventTypeSegments))
	InvalidPrefixErrDetail  = fmt.Sprintf("must not have %s as type prefix", InvalidPrefix)
	StringIntErrDetail      = fmt.Sprintf("%s must be a stringified int value", MaxInFlightMessages)

	InvalidQosErrDetail = fmt.Sprintf("must be a valid QoS value %s or %s",
		types.QosAtLeastOnce, types.QosAtMostOnce)
	InvalidAuthTypeErrDetail  = fmt.Sprintf("must be a valid Auth Type value %s", types.AuthTypeClientCredentials)
	InvalidGrantTypeErrDetail = fmt.Sprintf("must be a valid Grant Type value %s", types.GrantTypeClientCredentials)

	MissingSchemeErrDetail = "must have URL scheme 'http' or 'https'"
	SuffixMissingErrDetail = fmt.Sprintf("must have valid sink URL suffix %s", ClusterLocalURLSuffix)
	SubDomainsErrDetail    = fmt.Sprintf("must have sink URL with %d sub-domains: ", subdomainSegments)
	NSMismatchErrDetail    = "must have the same namespace as the subscriber: "
)
View Source
var (
	// GroupVersion is group version used to register these objects.
	GroupVersion = schema.GroupVersion{Group: "eventing.kyma-project.io", Version: "v1alpha2"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme

	//nolint:gochecknoglobals // required for tests
	// GroupKind is group kind to identify these objects.
	GroupKind = schema.GroupKind{Group: "eventing.kyma-project.io", Kind: "Subscription"}
)
View Source
var Finalizer = GroupVersion.Group

Functions

func ConditionEquals

func ConditionEquals(existing, expected Condition) bool

ConditionsEquals checks if two conditions are equal.

func ConditionsEquals

func ConditionsEquals(existing, expected []Condition) bool

ConditionsEquals checks if two list of conditions are equal.

func ContainSameConditionTypes

func ContainSameConditionTypes(conditions1, conditions2 []Condition) bool

func CreateMessageForConditionReasonSubscriptionCreated

func CreateMessageForConditionReasonSubscriptionCreated(eventMeshName string) string

func IsInvalidCE

func IsInvalidCE(source, eventType string) bool

func MakeInvalidFieldError

func MakeInvalidFieldError(path *field.Path, subName, detail string) *field.Error

func SubscriptionGroupVersionResource

func SubscriptionGroupVersionResource() schema.GroupVersionResource

Types

type Backend

type Backend struct {

	// Checksum for the Subscription custom resource.
	// +optional
	Ev2hash int64 `json:"ev2hash,omitempty"`

	// Hash used to identify an EventMesh Subscription retrieved from the server without the WebhookAuth config.
	// +optional
	EventMeshHash int64 `json:"emshash,omitempty"`

	// Hash used to identify an EventMesh Subscription posted to the server without the WebhookAuth config.
	// +optional
	EventMeshLocalHash int64 `json:"eventMeshLocalHash,omitempty"`

	// Hash used to identify the WebhookAuth of an EventMesh Subscription existing on the server.
	// +optional
	WebhookAuthHash int64 `json:"webhookAuthHash,omitempty"`

	// Webhook URL used by EventMesh to trigger subscribers.
	// +optional
	ExternalSink string `json:"externalSink,omitempty"`

	// Provides the reason if a Subscription failed activation in EventMesh.
	// +optional
	FailedActivation string `json:"failedActivation,omitempty"`

	// Name of the APIRule which is used by the Subscription.
	// +optional
	APIRuleName string `json:"apiRuleName,omitempty"`

	// Status of the Subscription as reported by EventMesh.
	// +optional
	EventMeshSubscriptionStatus *EventMeshSubscriptionStatus `json:"emsSubscriptionStatus,omitempty"`

	// List of event type to consumer name mappings for the NATS backend.
	// +optional
	Types []JetStreamTypes `json:"types,omitempty"`

	// List of mappings from event type to EventMesh compatible types. Used only with EventMesh as the backend.
	// +optional
	EmsTypes []EventMeshTypes `json:"emsTypes,omitempty"`
}

Backend contains Backend-specific fields.

func (*Backend) CopyHashes

func (b *Backend) CopyHashes(src Backend)

CopyHashes copies the precomputed hashes from the given backend.

func (*Backend) DeepCopy

func (in *Backend) DeepCopy() *Backend

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend.

func (*Backend) DeepCopyInto

func (in *Backend) DeepCopyInto(out *Backend)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Condition

type Condition struct {
	// Short description of the condition.
	Type ConditionType `json:"type,omitempty"`

	// Status of the condition. The value is either `True`, `False`, or `Unknown`.
	Status corev1.ConditionStatus `json:"status"`

	// Defines the date of the last condition status change.
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	// Defines the reason for the condition status change.
	Reason ConditionReason `json:"reason,omitempty"`
	// Provides more details about the condition status change.
	Message string `json:"message,omitempty"`
}

func GetSubscriptionActiveCondition

func GetSubscriptionActiveCondition(sub *Subscription, err error) []Condition

GetSubscriptionActiveCondition updates the ConditionSubscriptionActive condition based on the given error value.

func MakeCondition

func MakeCondition(conditionType ConditionType, reason ConditionReason, status corev1.ConditionStatus, message string) Condition

func MakeSubscriptionConditions

func MakeSubscriptionConditions() []Condition

MakeSubscriptionConditions creates a map of all conditions which the Subscription should have.

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConditionReason

type ConditionReason string
const (
	// JetStream Conditions.
	ConditionReasonNATSSubscriptionActive    ConditionReason = "NATS Subscription active"
	ConditionReasonNATSSubscriptionNotActive ConditionReason = "NATS Subscription not active"

	// EventMesh Conditions.
	ConditionReasonSubscriptionCreated        ConditionReason = "EventMesh Subscription created"
	ConditionReasonSubscriptionCreationFailed ConditionReason = "EventMesh Subscription creation failed"
	ConditionReasonSubscriptionActive         ConditionReason = "EventMesh Subscription active"
	ConditionReasonSubscriptionNotActive      ConditionReason = "EventMesh Subscription not active"
	ConditionReasonSubscriptionDeleted        ConditionReason = "EventMesh Subscription deleted"
	ConditionReasonAPIRuleStatusReady         ConditionReason = "APIRule status ready"
	ConditionReasonAPIRuleStatusNotReady      ConditionReason = "APIRule status not ready"
	ConditionReasonWebhookCallStatus          ConditionReason = "EventMesh Subscription webhook call no errors status"
)

type ConditionType

type ConditionType string
const (
	ConditionSubscribed         ConditionType = "Subscribed"
	ConditionSubscriptionActive ConditionType = "Subscription active"
	ConditionAPIRuleStatus      ConditionType = "APIRule status"
	ConditionWebhookCallStatus  ConditionType = "Webhook call status"

	ConditionPublisherProxyReady ConditionType = "Publisher Proxy Ready"
	ConditionControllerReady     ConditionType = "Subscription Controller Ready"
)

type EventMeshSubscriptionStatus

type EventMeshSubscriptionStatus struct {
	// Status of the Subscription as reported by the backend.
	// +optional
	Status string `json:"status,omitempty"`

	// Reason for the current status.
	// +optional
	StatusReason string `json:"statusReason,omitempty"`

	// Timestamp of the last successful delivery.
	// +optional
	LastSuccessfulDelivery string `json:"lastSuccessfulDelivery,omitempty"`

	// Timestamp of the last failed delivery.
	// +optional
	LastFailedDelivery string `json:"lastFailedDelivery,omitempty"`

	// Reason for the last failed delivery.
	// +optional
	LastFailedDeliveryReason string `json:"lastFailedDeliveryReason,omitempty"`
}

func (*EventMeshSubscriptionStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventMeshSubscriptionStatus.

func (*EventMeshSubscriptionStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type EventMeshTypes

type EventMeshTypes struct {
	// Event type that was originally used to subscribe.
	OriginalType string `json:"originalType"`
	// Event type that is used on the EventMesh backend.
	EventMeshType string `json:"eventMeshType"`
}

func (*EventMeshTypes) DeepCopy

func (in *EventMeshTypes) DeepCopy() *EventMeshTypes

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventMeshTypes.

func (*EventMeshTypes) DeepCopyInto

func (in *EventMeshTypes) DeepCopyInto(out *EventMeshTypes)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type EventType

type EventType struct {
	// Event type as specified in the Subscription spec.
	OriginalType string `json:"originalType"`
	// Event type after it was cleaned up from backend compatible characters.
	CleanType string `json:"cleanType"`
}

func (*EventType) DeepCopy

func (in *EventType) DeepCopy() *EventType

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventType.

func (*EventType) DeepCopyInto

func (in *EventType) DeepCopyInto(out *EventType)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JetStreamTypes

type JetStreamTypes struct {
	// Event type that was originally used to subscribe.
	OriginalType string `json:"originalType"`
	// Name of the JetStream consumer created for the event type.
	ConsumerName string `json:"consumerName,omitempty"`
}

func (*JetStreamTypes) DeepCopy

func (in *JetStreamTypes) DeepCopy() *JetStreamTypes

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JetStreamTypes.

func (*JetStreamTypes) DeepCopyInto

func (in *JetStreamTypes) DeepCopyInto(out *JetStreamTypes)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Subscription

type Subscription struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   SubscriptionSpec   `json:"spec,omitempty"`
	Status SubscriptionStatus `json:"status,omitempty"`
}

Subscription is the Schema for the subscriptions API.

func (*Subscription) DeepCopy

func (in *Subscription) DeepCopy() *Subscription

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscription.

func (*Subscription) DeepCopyInto

func (in *Subscription) DeepCopyInto(out *Subscription)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Subscription) DeepCopyObject

func (in *Subscription) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Subscription) Default

func (s *Subscription) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type.

func (*Subscription) DuplicateWithStatusDefaults

func (s *Subscription) DuplicateWithStatusDefaults() *Subscription

func (*Subscription) GetMaxInFlightMessages

func (s *Subscription) GetMaxInFlightMessages(defaults *env.DefaultSubscriptionConfig) int

GetMaxInFlightMessages tries to convert the string-type maxInFlight to the integer.

func (*Subscription) GetUniqueTypes

func (s *Subscription) GetUniqueTypes() []string

GetUniqueTypes returns the de-duplicated types from subscription spec.

func (*Subscription) Hub

func (*Subscription) Hub()

Hub marks this type as a conversion hub.

func (Subscription) MarshalJSON

func (s Subscription) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. If the SubscriptionStatus.CleanEventTypes is nil, it will be initialized to an empty slice of stings. It is needed because the Kubernetes APIServer will reject requests containing null in the JSON payload.

func (*Subscription) SetupWebhookWithManager

func (s *Subscription) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*Subscription) ToUnstructuredSub

func (s *Subscription) ToUnstructuredSub() (*unstructured.Unstructured, error)

func (*Subscription) ValidateCreate

func (s *Subscription) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type.

func (*Subscription) ValidateDelete

func (s *Subscription) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type.

func (*Subscription) ValidateSubscription

func (s *Subscription) ValidateSubscription() (admission.Warnings, error)

func (*Subscription) ValidateUpdate

func (s *Subscription) ValidateUpdate(_ runtime.Object) (admission.Warnings, error)

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.

type SubscriptionList

type SubscriptionList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Subscription `json:"items"`
}

SubscriptionList contains a list of Subscription.

func ConvertUnstructListToSubList

func ConvertUnstructListToSubList(unstructuredList *unstructured.UnstructuredList) (*SubscriptionList, error)

func (*SubscriptionList) DeepCopy

func (in *SubscriptionList) DeepCopy() *SubscriptionList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionList.

func (*SubscriptionList) DeepCopyInto

func (in *SubscriptionList) DeepCopyInto(out *SubscriptionList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SubscriptionList) DeepCopyObject

func (in *SubscriptionList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SubscriptionSpec

type SubscriptionSpec struct {
	// Unique identifier of the Subscription, read-only.
	// +optional
	ID string `json:"id,omitempty"`

	// Kubernetes Service that should be used as a target for the events that match the Subscription.
	// Must exist in the same Namespace as the Subscription.
	Sink string `json:"sink"`

	// Defines how types should be handled.<br />
	// - `standard`: backend-specific logic will be applied to the configured source and types.<br />
	// - `exact`: no further processing will be applied to the configured source and types.
	TypeMatching TypeMatching `json:"typeMatching,omitempty"`

	// Defines the origin of the event.
	Source string `json:"source"`

	// List of event types that will be used for subscribing on the backend.
	Types []string `json:"types"`

	// Map of configuration options that will be applied on the backend.
	// +optional
	Config map[string]string `json:"config,omitempty"`
}

Defines the desired state of the Subscription.

func (*SubscriptionSpec) DeepCopy

func (in *SubscriptionSpec) DeepCopy() *SubscriptionSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionSpec.

func (*SubscriptionSpec) DeepCopyInto

func (in *SubscriptionSpec) DeepCopyInto(out *SubscriptionSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SubscriptionStatus

type SubscriptionStatus struct {
	// Current state of the Subscription.
	// +optional
	Conditions []Condition `json:"conditions,omitempty"`

	// Overall readiness of the Subscription.
	Ready bool `json:"ready"`

	// List of event types after cleanup for use with the configured backend.
	Types []EventType `json:"types"`

	// Backend-specific status which is applicable to the active backend only.
	Backend Backend `json:"backend,omitempty"`
}

SubscriptionStatus defines the observed state of Subscription. +kubebuilder:subresource:status

func (*SubscriptionStatus) DeepCopy

func (in *SubscriptionStatus) DeepCopy() *SubscriptionStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionStatus.

func (*SubscriptionStatus) DeepCopyInto

func (in *SubscriptionStatus) DeepCopyInto(out *SubscriptionStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (SubscriptionStatus) FindCondition

func (s SubscriptionStatus) FindCondition(conditionType ConditionType) *Condition

func (*SubscriptionStatus) GetConditionAPIRuleStatus

func (s *SubscriptionStatus) GetConditionAPIRuleStatus() corev1.ConditionStatus

func (*SubscriptionStatus) InitializeConditions

func (s *SubscriptionStatus) InitializeConditions()

InitializeConditions sets unset Subscription conditions to Unknown.

func (*SubscriptionStatus) InitializeEventTypes

func (s *SubscriptionStatus) InitializeEventTypes()

InitializeEventTypes initializes the SubscriptionStatus.Types with an empty slice of EventType.

func (*SubscriptionStatus) IsConditionSubscribed

func (s *SubscriptionStatus) IsConditionSubscribed() bool

func (*SubscriptionStatus) IsConditionWebhookCall

func (s *SubscriptionStatus) IsConditionWebhookCall() bool

func (SubscriptionStatus) IsReady

func (s SubscriptionStatus) IsReady() bool

func (*SubscriptionStatus) SetConditionAPIRuleStatus

func (s *SubscriptionStatus) SetConditionAPIRuleStatus(err error)

func (SubscriptionStatus) ShouldUpdateReadyStatus

func (s SubscriptionStatus) ShouldUpdateReadyStatus() bool

ShouldUpdateReadyStatus checks if there is a mismatch between the Subscription Ready status and the Ready status of all the conditions.

type TypeMatching

type TypeMatching string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL