knative

package
v0.0.0-...-ded4385 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: Apache-2.0 Imports: 27 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",
		},
	}

	// 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

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

CreateSinkBinding ---

func CreateSubscription

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

CreateSubscription ---

func CreateTrigger

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

CreateTrigger ---

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 IsEnabledInNamespace

func IsEnabledInNamespace(ctx context.Context, c client.Client, namespace string) bool

IsEnabledInNamespace returns true if we can list some basic knative objects in the given namespace.

This method can be used at operator level to check if knative resources can be accessed.

func IsInstalled

func IsInstalled(ctx context.Context, c kubernetes.Interface) (bool, error)

IsInstalled returns true if we are connected to a cluster with Knative installed

This method should not be called from the operator, as it might require permissions that are not available.

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