duck

package
Version: v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 25 Imported by: 56

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DomainToURL

func DomainToURL(domain string) string

DomainToURL converts a domain into an HTTP URL.

func NewPhysicalChannel added in v0.21.0

func NewPhysicalChannel(typeMeta metav1.TypeMeta, objMeta metav1.ObjectMeta, opts ...PhysicalChannelOption) (*unstructured.Unstructured, error)

NewPhysicalChannel returns a new physical channel as unstructured.Unstructured, starting from the provided meta and ducks. When developing components that needs to spawn underlying (physical) channels (e.g. the Channel type, brokers backed by channels, parallel, sequence) you should use this function to create the underlying channels. Any physical channel CRD is composed by TypeMeta, ObjectMeta and a Spec, which includes a ChannelableSpec and optionally additional fields (e.g. like KafkaChannel includes partitionCount). You can set the ChannelableSpec using WithChannelableSpec and you can set all the additional fields using WithPhysicalChannelSpec This function returns the channel with the provided TypeMeta and ObjectMeta and with the additional provided options.

For example, providing the TypeMeta of an InMemoryChannel and a ChannelableSpec with delivery configured, the return value will look like:

apiVersion: messaging.knative.dev/v1 kind: InMemoryChannel metadata:

name: "hello"
namespace: "world"

spec:

delivery:
  retry: 3

func ObjectReference

func ObjectReference(ctx context.Context, dynamicClient dynamic.Interface, namespace string, ref *corev1.ObjectReference) (json.Marshaler, error)

ObjectReference resolves an object based on an ObjectReference.

func ResourceInterface

func ResourceInterface(dynamicClient dynamic.Interface, namespace string, gvk schema.GroupVersionKind) (dynamic.ResourceInterface, error)

ResourceInterface creates a resource interface for the given ObjectReference.

Types

type ListableTracker added in v0.10.0

type ListableTracker interface {
	// TrackInNamespace returns a function that can be used to watch arbitrary apis.Listable resources in the same
	// namespace as obj. Any change will cause a callback for obj.
	TrackInNamespace(ctx context.Context, obj metav1.Object) Track
	// TrackInNamespaceKReference returns a function that can be used to watch arbitrary apis.Listable resources
	// in the same namespace as obj. Any change will cause a callback for obj.
	TrackInNamespaceKReference(ctx context.Context, obj metav1.Object) TrackKReference
	// ListerFor returns the lister for the object reference. It returns an error if the lister does not exist.
	ListerFor(ref corev1.ObjectReference) (cache.GenericLister, error)
	// InformerFor returns the informer for the object reference. It returns an error if the informer does not exist.
	InformerFor(ref corev1.ObjectReference) (cache.SharedIndexInformer, error)
	// ListerFor returns the lister for the KReference. It returns an error if the lister does not exist.
	ListerForKReference(ref duckv1.KReference) (cache.GenericLister, error)
	// InformerFor returns the informer for the KReference. It returns an error if the informer does not exist.
	InformerForKReference(ref duckv1.KReference) (cache.SharedIndexInformer, error)
}

ListableTracker is a tracker capable of tracking any object that implements the apis.Listable interface.

func NewListableTracker deprecated added in v0.10.0

func NewListableTracker(ctx context.Context, getter func(context.Context) duck.InformerFactory, callback func(types.NamespacedName), lease time.Duration) ListableTracker

NewListableTracker creates a new ListableTracker, backed by a TypedInformerFactory. Deprecated: use NewListableTrackerFromTracker instead.

func NewListableTrackerFromTracker added in v0.26.0

func NewListableTrackerFromTracker(ctx context.Context, getter func(context.Context) duck.InformerFactory, t tracker.Interface) ListableTracker

NewListableTrackerFromTracker creates a new ListableTracker, backed by a TypedInformerFactory.

type PhysicalChannelOption added in v0.21.0

type PhysicalChannelOption func(*channelTemplateSpecInternal)

PhysicalChannelOption represents an option for NewPhysicalChannel.

func WithChannelableSpec added in v0.21.0

func WithChannelableSpec(channelableSpec duckv1.ChannelableSpec) PhysicalChannelOption

WithChannelableSpec sets the ChannelableSpec of the physical channel.

func WithPhysicalChannelSpec added in v0.21.0

func WithPhysicalChannelSpec(physicalChannelSpec *runtime.RawExtension) PhysicalChannelOption

WithPhysicalChannelSpec sets the ChannelableSpec of the physical channel.

type Track

type Track func(corev1.ObjectReference) error

type TrackKReference added in v0.15.0

type TrackKReference func(duckv1.KReference) error

Jump to

Keyboard shortcuts

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