kubetypes

package
v0.0.0-...-75c6eaf Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyAPI

type ApplyAPI[T runtime.Object, TA runtime.Object] interface {
	Apply(ctx context.Context, secret TA, opts metav1.ApplyOptions) (result T, err error)
}

ApplyAPI exposes a generic API for a client go type for apply operations.

type CrdWatcher

type CrdWatcher interface {
	// HasSynced returns true once all existing state has been synced.
	HasSynced() bool
	// KnownOrCallback returns `true` immediately if the resource is known.
	// If it is not known, `false` is returned. If the resource is later added, the callback will be triggered.
	KnownOrCallback(s schema.GroupVersionResource, f func(stop <-chan struct{})) bool
	// WaitForCRD waits until the request CRD exists, and returns true on success. A false return value
	// indicates the CRD does not exist but the wait failed or was canceled.
	// This is useful to conditionally enable controllers based on CRDs being created.
	WaitForCRD(s schema.GroupVersionResource, stop <-chan struct{}) bool
	// Run starts the controller. This must be called.
	Run(stop <-chan struct{})
}

CrdWatcher exposes an interface to watch CRDs

type DelayedFilter

type DelayedFilter interface {
	HasSynced() bool
	KnownOrCallback(f func(stop <-chan struct{})) bool
}

DelayedFilter exposes an interface for a filter create delayed informers, which start once the underlying resource is available. See kclient.NewDelayedInformer.

type DynamicObjectFilter

type DynamicObjectFilter interface {
	// Filter returns true if the input object or namespace string resides in a namespace selected for discovery
	Filter(obj any) bool
	// AddHandler registers a handler on namespace, which will be triggered when namespace selected or deselected.
	AddHandler(func(selected, deselected sets.String))
}

func NewStaticObjectFilter

func NewStaticObjectFilter(f func(obj any) bool) DynamicObjectFilter

NewStaticObjectFilter returns a DynamicObjectFilter that does not ever change (so does not need an AddHandler)

type Filter

type Filter struct {
	// A selector to restrict the list of returned objects by their labels.
	// This is a *server side* filter.
	LabelSelector string
	// A selector to restrict the list of returned objects by their fields.
	// This is a *server side* filter.
	FieldSelector string
	// Namespace to watch.
	// This is a *server side* filter.
	Namespace string
	// ObjectFilter allows arbitrary filtering logic.
	// This is a *client side* filter. This means CPU/memory costs are still present for filtered objects.
	// Use LabelSelector or FieldSelector instead, if possible.
	ObjectFilter DynamicObjectFilter
	// ObjectTransform allows arbitrarily modifying objects stored in the underlying cache.
	// If unset, a default transform is provided to remove ManagedFields (high cost, low value)
	ObjectTransform func(obj any) (any, error)
}

Filter allows filtering read operations

type FullAPI

type FullAPI[T runtime.Object, TL runtime.Object, TA runtime.Object] interface {
	ReadAPI[T, TL]
	WriteAPI[T]
	ApplyAPI[T, TA]
}

FullAPI exposes a generic API for a client go type for all operations. Note each type can also have per-type specific "Expansions" not covered here.

type InformerOptions

type InformerOptions struct {
	// A selector to restrict the list of returned objects by their labels.
	LabelSelector string
	// A selector to restrict the list of returned objects by their fields.
	FieldSelector string
	// Namespace to watch.
	Namespace string
	// Cluster name for watch error handlers
	Cluster cluster.ID
	// ObjectTransform allows arbitrarily modifying objects stored in the underlying cache.
	// If unset, a default transform is provided to remove ManagedFields (high cost, low value)
	ObjectTransform func(obj any) (any, error)
	// InformerType dictates the type of informer that should be created.
	InformerType InformerType
}

type InformerType

type InformerType int
const (
	StandardInformer InformerType = iota
	DynamicInformer
	MetadataInformer
)

type ReadAPI

type ReadAPI[T runtime.Object, TL runtime.Object] interface {
	Get(ctx context.Context, name string, opts metav1.GetOptions) (T, error)
	List(ctx context.Context, opts metav1.ListOptions) (TL, error)
	Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
}

ReadAPI exposes a generic API for a client go type for read operations.

type ReadWriteAPI

type ReadWriteAPI[T runtime.Object, TL runtime.Object] interface {
	ReadAPI[T, TL]
	WriteAPI[T]
}

ReadWriteAPI exposes a generic API for read and write operations.

type WriteAPI

type WriteAPI[T runtime.Object] interface {
	Create(ctx context.Context, object T, opts metav1.CreateOptions) (T, error)
	Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result T, err error)
	Update(ctx context.Context, object T, opts metav1.UpdateOptions) (T, error)
	Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
}

WriteAPI exposes a generic API for a client go type for write operations.

type WriteStatusAPI

type WriteStatusAPI[T runtime.Object] interface {
	UpdateStatus(ctx context.Context, object T, opts metav1.UpdateOptions) (T, error)
}

WriteAPI exposes a generic API for a client go type for status operations. Not all types have status, so they need to be split out

Jump to

Keyboard shortcuts

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