v1alpha2

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

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 (
	Standard TypeMatching = "standard"
	Exact    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 (
	// Kind is the custom resource kind.
	Kind = "Subscription"

	// Resource is the custom resource plural name.
	Resource = "subscriptions"
)

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

Types

type Backend

type Backend struct {

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

	// Emshash defines the hash for the Subscription in BEB
	// +optional
	Emshash int64 `json:"emshash,omitempty"`

	// ExternalSink defines the webhook URL which is used by BEB to trigger subscribers
	// +optional
	ExternalSink string `json:"externalSink,omitempty"`

	// FailedActivation defines the reason if a Subscription had failed activation in BEB
	// +optional
	FailedActivation string `json:"failedActivation,omitempty"`

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

	// EmsSubscriptionStatus defines the status of Subscription in BEB
	// +optional
	EmsSubscriptionStatus *EmsSubscriptionStatus `json:"emsSubscriptionStatus,omitempty"`

	// +optional
	Types []JetStreamTypes `json:"types,omitempty"`

	// +optional
	EmsTypes []EventMeshTypes `json:"emsTypes,omitempty"`
}

Backend contains Backend-specific fields

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 Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(client dynamic.Interface) *Client

func (*Client) Create

func (s *Client) Create(ctx context.Context, subscription *Subscription) (*Subscription, error)

func (*Client) Delete

func (s *Client) Delete(ctx context.Context, namespace, name string) error

func (*Client) Get

func (s *Client) Get(ctx context.Context, namespace, name string) (*Subscription, error)

func (*Client) Update

func (s *Client) Update(ctx context.Context, subscription *Subscription) (*Subscription, error)

type Condition

type Condition struct {
	Type               ConditionType          `json:"type,omitempty"`
	Status             corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`
	LastTransitionTime metav1.Time            `json:"lastTransitionTime,omitempty"`
	Reason             ConditionReason        `json:"reason,omitempty"`
	Message            string                 `json:"message,omitempty"`
}

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 EmsSubscriptionStatus

type EmsSubscriptionStatus struct {
	// Status defines the status of the Subscription
	// +optional
	Status string `json:"status,omitempty"`

	// StatusReason defines the reason of the status
	// +optional
	StatusReason string `json:"statusReason,omitempty"`

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

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

	// LastFailedDeliveryReason defines the reason of failed delivery
	// +optional
	LastFailedDeliveryReason string `json:"lastFailedDeliveryReason,omitempty"`
}

func (*EmsSubscriptionStatus) DeepCopy

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

func (*EmsSubscriptionStatus) DeepCopyInto

func (in *EmsSubscriptionStatus) DeepCopyInto(out *EmsSubscriptionStatus)

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

type EventMeshTypes

type EventMeshTypes struct {
	OriginalType  string `json:"originalType"`
	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 {
	OriginalType string `json:"originalType"`
	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 {
	OriginalType string `json:"originalType"`
	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 New

func New(opts ...SubscriptionOption) *Subscription

New helps to build a Subscription uitilizing SubscriptionOptions.

func ToSubscription

func ToSubscription(object *unstructured.Unstructured) (*Subscription, error)

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) 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) ToUnstructuredSub

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

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 (*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 SubscriptionOption

type SubscriptionOption func(*Subscription)

func WithConfig

func WithConfig(key, value string) SubscriptionOption

WithConfig is a SubscriptionOption that allows to add one Config (key and value) at a time.

func WithGeneratedTypes

func WithGeneratedTypes(format string, count, start, increment int) SubscriptionOption

WithGeneratedTypes is a SubscriptionOption that automatically generates and adds a number of types of the form `<event>.v<n>` where <n> is a calculated number; it starts at <start>, gets incremented by <increase> and stops at a total of <count>.

func WithLabel

func WithLabel(key, value string) SubscriptionOption

WithLabel is a SubscriptionOption that allows to add one label (key and value) at a time.

func WithName

func WithName(name string) SubscriptionOption

WithName is a SubscriptionOption that allow to define the name of a Subscription. Be adviced that the default name of a Subscription is a auto-generated UUI.

func WithNamespace

func WithNamespace(namespace string) SubscriptionOption

WithNamespace is a SubscriptionOption that allows to define the namespace of a Subscription. Be adviced that the defaut namespace of a Subscription is `default`.

func WithSink

func WithSink(sink string) SubscriptionOption

WithSink is a SubscriptionOption that allows to define the sink of a Subscription.

func WithSource

func WithSource(source string) SubscriptionOption

WithSource is a SusbscriptionOption that allows to define the source of a Subscription.

func WithType

func WithType(eventType string) SubscriptionOption

WithType is a SubscriptionOption that allows to add one Type at a time.

func WithTypeMatching

func WithTypeMatching(typeMatching TypeMatching) SubscriptionOption

WithTypeMatching is a Subscription to define the TypeMatching of a Subscription. Be advissed that the default value for a Subscription is `standard`.

func WithTypes

func WithTypes(types ...string) SubscriptionOption

WithTypes is a SubscriptionOption that allows to add a number of Types to a Subscription at once.

type SubscriptionSpec

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

	// Sink defines endpoint of the subscriber
	Sink string `json:"sink"`

	// TypeMatching defines the type of matching to be done for the event types
	TypeMatching TypeMatching `json:"typeMatching,omitempty"`

	// Source Defines the source of the event originated from
	Source string `json:"source"`

	// Types defines the list of event names for the topics we need to subscribe for messages
	Types []string `json:"types"`

	// Config defines the configurations that can be applied to the eventing backend
	// +optional
	Config map[string]string `json:"config,omitempty"`
}

SubscriptionSpec defines the desired state of 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 {
	// Conditions defines the status conditions
	// +optional
	Conditions []Condition `json:"conditions,omitempty"`

	// Ready defines the overall readiness status of a subscription
	Ready bool `json:"ready"`

	// Types defines the filter's event types after cleanup for use with the configured backend
	Types []EventType `json:"types"`

	// Backend contains backend specific status which are only applicable to the active backend
	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