v1alpha1

package
v0.1.62 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package v1alpha1 contains interfaces and types common to all API groups.

Index

Constants

View Source
const (
	// ConditionReady has status True when the component is ready to receive/send events.
	ConditionReady = apis.ConditionReady
	// ConditionSinkProvided has status True when the component has been configured with an event sink.
	ConditionSinkProvided apis.ConditionType = "SinkProvided"
	// ConditionDeployed has status True when the component's adapter is up and running.
	ConditionDeployed apis.ConditionType = "Deployed"
)

Status conditions

View Source
const (
	// ReasonRBACNotBound is set on a Deployed condition when an adapter's
	// ServiceAccount cannot be bound.
	ReasonRBACNotBound = "RBACNotBound"
	// ReasonUnavailable is set on a Deployed condition when an adapter in unavailable.
	ReasonUnavailable = "AdapterUnavailable"

	// ReasonSinkNotFound is set on a SinkProvided condition when a sink does not exist.
	ReasonSinkNotFound = "SinkNotFound"
	// ReasonSinkEmpty is set on a SinkProvided condition when a sink URI is empty.
	ReasonSinkEmpty = "EmptySinkURI"
)

Reasons for status conditions

Variables

View Source
var DefaultConditionSet = NewConditionSet()

DefaultConditionSet is a generic set of status conditions used by default in all components.

View Source
var EventSenderConditionSet = NewConditionSet(
	ConditionSinkProvided,
)

EventSenderConditionSet is a set of conditions for instances that send events to a sink.

Functions

func IsMultiTenant

func IsMultiTenant(r Reconcilable) bool

IsMultiTenant returns whether the given component type is multi-tenant.

func NewConditionSet

func NewConditionSet(cts ...apis.ConditionType) apis.ConditionSet

NewConditionSet returns a set of status conditions for a component type. Default conditions can be augmented by passing condition types as function arguments.

func ServiceAccountOptions

func ServiceAccountOptions(r Reconcilable) []resource.ServiceAccountOption

ServiceAccountOptions returns functional options for mutating the ServiceAccount associated with a given component instance.

func WantsOwnServiceAccount

func WantsOwnServiceAccount(r Reconcilable) bool

WantsOwnServiceAccount returns whether the given component instance should have a dedicated ServiceAccount associated with its receive adapter.

func WithReconcilable

func WithReconcilable(ctx context.Context, r Reconcilable) context.Context

WithReconcilable returns a copy of the parent context in which the value associated with the reconcilableInstanceKey is the given component instance.

Types

type AdapterConfigurable

type AdapterConfigurable interface {
	// GetAdapterOverrides returns the adapter overrides.
	GetAdapterOverrides() *AdapterOverrides
}

AdapterConfigurable is implemented by types that can override the default configuration of their receive adapter.

type AdapterOverrides

type AdapterOverrides struct {
	// Public value indicates if the adapter backed by a Kn Service should have
	// its network visibility scope set to public. Default scope is cluster-local.
	Public *bool `json:"public,omitempty"`
	// Resources limits and requirements applied on adapter container.
	Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
	// Pod tolerations.
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
	// NodeSelector to control which nodes the pod can be scheduled on.
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`
	// Pod affinity.
	Affinity *corev1.Affinity `json:"affinity,omitempty"`
	// Environment variables applied on adapter container.
	Env []corev1.EnvVar `json:"env,omitempty"`
	// Labels applied on adapter container.
	Labels map[string]string `json:"labels,omitempty"`
	// Annotations applied on adapter container.
	Annotations map[string]string `json:"annotations,omitempty"`
}

AdapterOverrides are applied on top of the default adapter parameters.

+k8s:deepcopy-gen=true

func (*AdapterOverrides) DeepCopy

func (in *AdapterOverrides) DeepCopy() *AdapterOverrides

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

func (*AdapterOverrides) DeepCopyInto

func (in *AdapterOverrides) DeepCopyInto(out *AdapterOverrides)

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

type CloudEventStatus

type CloudEventStatus struct {
	// AcceptedEventTypes are the CloudEvent types that a component can process.
	// +optional
	AcceptedEventTypes []string `json:"acceptedEventTypes,omitempty"`
}

CloudEventStatus contains attributes that event receivers can embed to declare the event types they accept.

+k8s:deepcopy-gen=true

func (*CloudEventStatus) DeepCopy

func (in *CloudEventStatus) DeepCopy() *CloudEventStatus

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

func (*CloudEventStatus) DeepCopyInto

func (in *CloudEventStatus) DeepCopyInto(out *CloudEventStatus)

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

type EventReceiver

type EventReceiver interface {
	// AcceptedEventTypes returns the event types accepted by the target.
	AcceptedEventTypes() []string
}

EventReceiver is implemented by types that receive and process events.

type EventSender

type EventSender interface {
	// GetSink returns the component's event sink.
	GetSink() *duckv1.Destination
}

EventSender is implemented by types that send events to a sink.

type EventSource

type EventSource interface {
	// GetEventTypes returns the event types generated by the component.
	GetEventTypes() []string
	// AsEventSource returns a unique reference to the component suitable
	// for use as a CloudEvent 'source' attribute.
	AsEventSource() string
}

EventSource is implemented by types that emit events, either by sending them to a sink or by replying to incoming event requests.

type GroupObject

type GroupObject struct {
	Single, List runtime.Object
}

GroupObject holds the API group object types.

+k8s:deepcopy-gen=false

type MultiTenant

type MultiTenant interface {
	IsMultiTenant() bool
}

MultiTenant is implemented by all multi-tenant component types.

type Reconcilable

type Reconcilable interface {
	metav1.Object
	runtime.Object
	// OwnerRefable is used to construct a generic reconciler for each
	// component type, and convert custom objects to owner references.
	kmeta.OwnerRefable
	// KRShaped is used by generated reconcilers to perform pre and
	// post-reconcile status updates.
	duckv1.KRShaped

	// GetStatusManager returns a manager for the component's status.
	GetStatusManager() *StatusManager
}

Reconcilable is implemented by all components.

func ReconcilableFromContext

func ReconcilableFromContext(ctx context.Context) Reconcilable

ReconcilableFromContext returns the component instance stored in the context.

type ServiceAccountProvider

type ServiceAccountProvider interface {
	WantsOwnServiceAccount() bool
	ServiceAccountOptions() []resource.ServiceAccountOption
}

ServiceAccountProvider is implemented by types which are able to influence the shape of the ServiceAccount used by their own receive adapter.

type Status

type Status struct {
	duckv1.SourceStatus  `json:",inline"`
	duckv1.AddressStatus `json:",inline"`

	// Accepted CloudEvent attributes
	CloudEventStatus `json:",inline"`
}

Status defines the observed state of a component instance.

+k8s:deepcopy-gen=true

func (*Status) DeepCopy

func (in *Status) DeepCopy() *Status

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

func (*Status) DeepCopyInto

func (in *Status) DeepCopyInto(out *Status)

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

type StatusManager

type StatusManager struct {
	apis.ConditionSet
	*Status
}

StatusManager manages the status of a component.

func (*StatusManager) MarkNoSink

func (m *StatusManager) MarkNoSink()

MarkNoSink sets the SinkProvided condition to False.

func (*StatusManager) MarkRBACNotBound

func (m *StatusManager) MarkRBACNotBound()

MarkRBACNotBound sets the Deployed condition to False, indicating that the adapter's ServiceAccount couldn't be bound.

func (*StatusManager) MarkSink

func (m *StatusManager) MarkSink(uri *apis.URL)

MarkSink sets the SinkProvided condition to True using the given URI.

func (*StatusManager) PropagateDeploymentAvailability

func (m *StatusManager) PropagateDeploymentAvailability(ctx context.Context,
	d *appsv1.Deployment, pl corelistersv1.PodNamespaceLister,
)

PropagateDeploymentAvailability uses the readiness of the provided Deployment to determine whether the Deployed condition should be marked as True or False. Given an optional PodLister interface, the status of dependant Pods is inspected to generate a more meaningful failure reason in case of non-ready status of the Deployment.

func (*StatusManager) PropagateServiceAvailability

func (m *StatusManager) PropagateServiceAvailability(ksvc *servingv1.Service)

PropagateServiceAvailability uses the readiness of the provided Service to determine whether the Deployed condition should be marked as True or False.

func (*StatusManager) SetRoute

func (m *StatusManager) SetRoute(urlPath string)

SetRoute appends the given URL path to the current target's URL.

type ValueFromField

type ValueFromField struct {

	// Field value.
	// +optional
	Value string `json:"value,omitempty"`
	// Field value from a Kubernetes Secret.
	// +optional
	ValueFromSecret *corev1.SecretKeySelector `json:"valueFromSecret,omitempty"`
}

ValueFromField is a struct field that can have its value either defined explicitly or sourced from another entity.

+k8s:deepcopy-gen=true

func (*ValueFromField) DeepCopy

func (in *ValueFromField) DeepCopy() *ValueFromField

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

func (*ValueFromField) DeepCopyInto

func (in *ValueFromField) DeepCopyInto(out *ValueFromField)

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

Jump to

Keyboard shortcuts

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