knative

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// KnownChannelKinds are known channel kinds belonging to Knative.
	KnownChannelKinds = []GroupVersionKindResource{
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "Channel",
				Group:   "messaging.knative.dev",
				Version: "v1",
			},
			Resource: "channels",
		},
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "Channel",
				Group:   "messaging.knative.dev",
				Version: "v1beta1",
			},
			Resource: "channels",
		},
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "InMemoryChannel",
				Group:   "messaging.knative.dev",
				Version: "v1",
			},
			Resource: "inmemorychannels",
		},
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "InMemoryChannel",
				Group:   "messaging.knative.dev",
				Version: "v1beta1",
			},
			Resource: "inmemorychannels",
		},
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "KafkaChannel",
				Group:   "messaging.knative.dev",
				Version: "v1beta1",
			},
			Resource: "kafkachannels",
		},
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "KafkaChannel",
				Group:   "messaging.knative.dev",
				Version: "v1alpha1",
			},
			Resource: "kafkachannels",
		},
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "NatssChannel",
				Group:   "messaging.knative.dev",
				Version: "v1alpha1",
			},
			Resource: "natsschannels",
		},
	}

	// KnownEndpointKinds are known endpoint kinds belonging to Knative.
	KnownEndpointKinds = []GroupVersionKindResource{
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "Service",
				Group:   "serving.knative.dev",
				Version: "v1",
			},
			Resource: "services",
		},
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "Service",
				Group:   "serving.knative.dev",
				Version: "v1beta1",
			},
			Resource: "services",
		},
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "Service",
				Group:   "serving.knative.dev",
				Version: "v1alpha1",
			},
			Resource: "services",
		},
	}

	// KnownBrokerKinds are known broker kinds belonging to Knative.
	KnownBrokerKinds = []GroupVersionKindResource{
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "Broker",
				Group:   "eventing.knative.dev",
				Version: "v1",
			},
			Resource: "brokers",
		},
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "Broker",
				Group:   "eventing.knative.dev",
				Version: "v1beta1",
			},
			Resource: "brokers",
		},
	}
)

Functions

func CreateKnativeServiceTrigger added in v2.3.1

func CreateKnativeServiceTrigger(brokerReference corev1.ObjectReference, serviceName string, eventType string, path string) (*eventing.Trigger, error)

CreateKnativeServiceTrigger create Knative trigger with Knative Serving Service as a subscriber - default option when Knative Serving is available on the cluster.

func CreateServiceTrigger added in v2.3.1

func CreateServiceTrigger(brokerReference corev1.ObjectReference, serviceName string, eventType string, path string) (*eventing.Trigger, error)

CreateServiceTrigger create Knative trigger with arbitrary Kubernetes Service as a subscriber - usually used when no Knative Serving is available on the cluster.

func CreateSinkBinding

func CreateSinkBinding(source corev1.ObjectReference, target corev1.ObjectReference) *sources.SinkBinding

func CreateSubscription

func CreateSubscription(channelReference corev1.ObjectReference, serviceName string, path string) *messaging.Subscription

func CreateTrigger

func CreateTrigger(brokerReference corev1.ObjectReference, subscriberRef duckv1.KReference, eventType string, path string) (*eventing.Trigger, error)

func EnableKnativeBindInNamespace

func EnableKnativeBindInNamespace(ctx context.Context, client client.Client, namespace string) (bool, error)

EnableKnativeBindInNamespace sets the "bindings.knative.dev/include=true" label to the namespace, only if there aren't any of these labels bindings.knative.dev/include bindings.knative.dev/exclude in the namespace Returns true if the label was set in the namespace https://knative.dev/docs/eventing/custom-event-source/sinkbinding/create-a-sinkbinding

func ExtractEventType

func ExtractEventType(uri string) string

ExtractEventType extract the eventType from a event URI.

func ExtractObjectReference

func ExtractObjectReference(uri string) (v1.ObjectReference, error)

ExtractObjectReference returns a reference to the object described in the Knative URI.

func FillMissingReferenceData

func FillMissingReferenceData(serviceType knativev1.CamelServiceType, ref v1.ObjectReference) []v1.ObjectReference

FillMissingReferenceData returns all possible combinations of ObjectReference that can be obtained by filling the missing fields with known data.

func FilterURIs

func FilterURIs(uris []string, kind knativev1.CamelServiceType) []string

FilterURIs returns all Knative URIs of the given type from a slice.

func GetAddressableReference

func GetAddressableReference(ctx context.Context, c client.Client,
	possibleReferences []corev1.ObjectReference, namespace string, name string) (*corev1.ObjectReference, error)

GetAddressableReference looks up the resource among all given types and returns an object reference to it.

func GetServiceType

func GetServiceType(ref v1.ObjectReference) (*knativev1.CamelServiceType, error)

func GetSinkURL

func GetSinkURL(ctx context.Context, c client.Client, sink *corev1.ObjectReference, namespace string) (*url.URL, error)

GetSinkURL returns the sink as *url.URL.

func IsEventingInstalled added in v2.3.0

func IsEventingInstalled(c kubernetes.Interface) (bool, error)

IsEventingInstalled returns true if we are connected to a cluster with Knative Eventing installed.

func IsInstalled

func IsInstalled(c kubernetes.Interface) (bool, error)

IsInstalled returns true if we are connected to a cluster with either Knative Serving or Eventing installed.

func IsRefKindInstalled added in v2.3.0

func IsRefKindInstalled(c kubernetes.Interface, ref corev1.ObjectReference) (bool, error)

IsRefKindInstalled returns true if the cluster has the referenced Kind installed.

func IsServingInstalled added in v2.3.0

func IsServingInstalled(c kubernetes.Interface) (bool, error)

IsServingInstalled returns true if we are connected to a cluster with Knative Serving installed.

func NormalizeToURI

func NormalizeToURI(kind knativev1.CamelServiceType, uriOrString string) string

NormalizeToURI produces a Knative uri of the given service type if the argument is a plain string.

Types

type GroupVersionKindResource

type GroupVersionKindResource struct {
	schema.GroupVersionKind
	Resource string
}

GroupVersionKindResource --.

Jump to

Keyboard shortcuts

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