v1alpha2

package
v0.0.0-...-11b31ba Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 11 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"
)

Variables

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

ConditionEquals 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 SetSubscriptionActiveCondition

func SetSubscriptionActiveCondition(status *SubscriptionStatus, err error)

SetSubscriptionActiveCondition sets a subscription active condition based on the given error. If the given error is nil, the status will have the Subscription active condition set to true, otherwise it will have the Subscription active condition set to false and the error as the message.

func SubscriptionGroupVersionResource

func SubscriptionGroupVersionResource() kschema.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 kcorev1.ConditionStatus `json:"status"`

	// Defines the date of the last condition status change.
	LastTransitionTime kmetav1.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 MakeCondition

func MakeCondition(conditionType ConditionType, reason ConditionReason, status kcorev1.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 (
	ConditionReasonSubscriptionSpecHasValidationErrors   ConditionReason = "Subscription spec has validation errors"
	ConditionReasonSubscriptionSpecHasNoValidationErrors ConditionReason = "Subscription spec has no validation errors"

	// 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"
	ConditionSubscriptionSpecValid ConditionType = "Subscription spec valid"
	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 {
	kmetav1.TypeMeta   `json:",inline"`
	kmetav1.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) 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) 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) ToUnstructuredSub

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

type SubscriptionList

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

SubscriptionList contains a list of Subscription.

func ConvertUnstructListToSubList

func ConvertUnstructListToSubList(unstructuredList *kunstructured.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.
	// +kubebuilder:default:="standard"
	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
	// +kubebuilder:default:={"maxInFlightMessages":"10"}
	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) ClearBackend

func (s *SubscriptionStatus) ClearBackend()

ClearBackend sets the Subscription Backend to an empty struct.

func (*SubscriptionStatus) ClearConditions

func (s *SubscriptionStatus) ClearConditions()

ClearConditions sets the Subscription conditions to an empty list.

func (*SubscriptionStatus) ClearTypes

func (s *SubscriptionStatus) ClearTypes()

ClearTypes sets the Subscription Types to an empty list.

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() kcorev1.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) SetNotReady

func (s *SubscriptionStatus) SetNotReady()

SetNotReady sets the Subscription status to not ready.

func (*SubscriptionStatus) SetSubscriptionSpecValidCondition

func (s *SubscriptionStatus) SetSubscriptionSpecValidCondition(err error)

SetSubscriptionSpecValidCondition sets a subscription spec valid condition based on the given error. If the given error is nil, the status will have the Subscription spec valid condition set to true, otherwise it will have the Subscription spec valid condition set to false and the error as the message.

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