controller

package
v0.0.0-...-4d862d3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInterface

type ClientInterface[T any, TList any] interface {
	Create(ctx context.Context, object *T, opts metav1.CreateOptions) (*T, error)
	Update(ctx context.Context, object *T, opts metav1.UpdateOptions) (*T, error)
	Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
	DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
	Get(ctx context.Context, name string, opts metav1.GetOptions) (*T, error)
	List(ctx context.Context, opts metav1.ListOptions) (*TList, error)
	Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
	Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *T, err error)
}

type ClientInterfaceWithApply

type ClientInterfaceWithApply[T any, TList any, TApplyConfiguration any] interface {
	ClientInterface[T, TList]
	Apply(ctx context.Context, object *TApplyConfiguration, opts metav1.ApplyOptions) (result *T, err error)
}

type ClientInterfaceWithStatus

type ClientInterfaceWithStatus[T any, TList any] interface {
	ClientInterface[T, TList]
	UpdateStatus(ctx context.Context, object *T, opts metav1.UpdateOptions) (*T, error)
}

type ClientInterfaceWithStatusAndApply

type ClientInterfaceWithStatusAndApply[T any, TList any, TApplyConfiguration any] interface {
	ClientInterfaceWithStatus[T, TList]
	ClientInterfaceWithApply[T, TList, TApplyConfiguration]
	ApplyStatus(ctx context.Context, object *TApplyConfiguration, opts metav1.ApplyOptions) (result *T, err error)
}

type ControllerOptions

type ControllerOptions struct {
	Name    string
	Workers uint
}

type Informer

type Informer[T any] interface {
	Informer() cache.SharedIndexInformer
	Lister() Lister[T]
}

func NewInformer

func NewInformer[T runtime.Object](informe cache.SharedIndexInformer) Informer[T]

type Interface

type Interface interface {
	// Meant to be run inside a goroutine
	// Waits for and reacts to changes in whatever type the controller
	// is concerned with.
	//
	// Returns an error always non-nil explaining why the worker stopped
	Run(ctx context.Context) error
}

func New

func New[T runtime.Object](
	informer Informer[T],
	reconciler func(namepace, name string, newObj T) error,
	options ControllerOptions,
) Interface

type Lister

type Lister[T any] interface {
	NamespacedLister[T]
	Namespaced(string) NamespacedLister[T]
}

TLister helps list Ts. All objects returned here must be treated as read-only.

func NewLister

func NewLister[T runtime.Object](indexer cache.Indexer) Lister[T]

type NamespacedLister

type NamespacedLister[T any] interface {
	// List lists all ValidationRuleSets in the indexer for a given namespace.
	// Objects returned here must be treated as read-only.
	List(selector labels.Selector) (ret []T, err error)
	// Get retrieves the ValidationRuleSet from the indexer for a given namespace and name.
	// Objects returned here must be treated as read-only.
	Get(name string) (T, error)
}

type TransformedClient

type TransformedClient[T any, TList any, TApplyConfiguration any, R any, RList any, RApplyConfiguration any] struct {
	TargetClient      ClientInterface[T, TList]
	ReplacementClient ClientInterface[R, RList]

	To   func(*R) (*T, error)
	From func(*T) (*R, error)
}

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Apply

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Apply(ctx context.Context, object *TApplyConfiguration, opts metav1.ApplyOptions) (result *T, err error)

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) ApplyStatus

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) ApplyStatus(ctx context.Context, object *TApplyConfiguration, opts metav1.ApplyOptions) (result *T, err error)

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Create

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Create(ctx context.Context, object *T, opts metav1.CreateOptions) (*T, error)

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Delete

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) DeleteCollection

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Get

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Get(ctx context.Context, name string, opts metav1.GetOptions) (*T, error)

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) List

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) List(ctx context.Context, opts metav1.ListOptions) (*TList, error)

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Patch

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *T, err error)

Ideally your replacement type is JSON compatible with your target type in case of validatingadmissionpolicy polyfill that is true. If we ever need this we can do something about it

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Update

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Update(ctx context.Context, object *T, opts metav1.UpdateOptions) (*T, error)

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) UpdateStatus

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) UpdateStatus(ctx context.Context, object *T, opts metav1.UpdateOptions) (*T, error)

func (TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Watch

func (c TransformedClient[T, TList, TApplyConfiguration, R, RList, RApplyConfiguration]) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)

Directories

Path Synopsis
admissionregistration.x-k8s.io

Jump to

Keyboard shortcuts

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