knative

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 26 Imported by: 10

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",
		},
	}

	// RequiredKinds are Knative kinds used by Camel K for materializing integrations.
	// They must be present on the cluster.
	RequiredKinds = []GroupVersionKindResource{
		{
			GroupVersionKind: schema.GroupVersionKind{
				Kind:    "Service",
				Group:   "serving.knative.dev",
				Version: "v1",
			},
			Resource: "services",
		},
	}
)

Functions

func CreateSinkBinding added in v1.2.0

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, serviceName string, eventType string, path string) *eventing.Trigger

func EnableKnativeBindInNamespace added in v1.12.1

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 added in v1.2.0

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 IsInstalled

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

IsInstalled returns true if we are connected to a cluster with Knative 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