storage

package
v0.0.0-...-83bd9c0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoServerSideApply

func DoServerSideApply(ctx context.Context, r ResourceInfo, live *unstructured.Unstructured, patchYAML []byte, options metav1.PatchOptions) (*unstructured.Unstructured, bool, error)

Types

type Clock

type Clock interface {
	Now() metav1.Time
}

type Hook

type Hook interface {
	OnWatchEvent(ev *WatchEvent)
}

A Hook implements a lightweight watch on all objects, intended for use to mock controller behaviour.

type ListFilter

type ListFilter struct {
	Namespace string
}

type RandomUIDGenerator

type RandomUIDGenerator struct {
}

func (*RandomUIDGenerator) NewUID

func (c *RandomUIDGenerator) NewUID() types.UID

type RealClock

type RealClock struct {
}

func (*RealClock) Now

func (c *RealClock) Now() metav1.Time

type ResourceInfo

ResourceInfo exposes the storage for a particular resource (group-kind), supporting CRUD operations for accessing the objects of that kind.

type Storage

type Storage interface {
	// FindResource returns the ResourceInfo for a group-resource.
	// The ResourceInfo allows CRUD operations on that resource.
	FindResource(gr schema.GroupResource) ResourceInfo

	// AllResources returns the metadata for all resources.
	AllResources() []metav1.APIResource

	// AddObject can be called to "sideload" an object, useful for testing.
	AddObject(obj *unstructured.Unstructured) error

	// RegisterType is used to register a built-in type.
	RegisterType(gvk schema.GroupVersionKind, resource string, scope meta.RESTScope)

	// AddStorageHook registers a hook, that will be called whenever any object changes.
	AddStorageHook(hook Hook)

	// UpdateCRD should be called whenever a CRD changes (likely by a hook).
	UpdateCRD(ev *WatchEvent) error
}

Storage is a pluggable store of objects

type TestClock

type TestClock struct {
	// contains filtered or unexported fields
}

func NewTestClock

func NewTestClock() *TestClock

func (*TestClock) Now

func (c *TestClock) Now() metav1.Time

type TestUIDGenerator

type TestUIDGenerator struct {
	// contains filtered or unexported fields
}

func NewTestUIDGenerator

func NewTestUIDGenerator() *TestUIDGenerator

func (*TestUIDGenerator) NewUID

func (c *TestUIDGenerator) NewUID() types.UID

type UIDGenerator

type UIDGenerator interface {
	NewUID() types.UID
}

type WatchCallback

type WatchCallback func(ev *WatchEvent) error

WatchCallback is the function signature for the callback function when objects are changed.

type WatchEvent

type WatchEvent struct {
	Namespace string
	// contains filtered or unexported fields
}

func BuildWatchEvent

func BuildWatchEvent(gvk schema.GroupVersionKind, evType string, u *unstructured.Unstructured) *WatchEvent

func (*WatchEvent) GroupKind

func (ev *WatchEvent) GroupKind() schema.GroupKind

func (*WatchEvent) JSON

func (ev *WatchEvent) JSON() []byte

func (*WatchEvent) PartialObjectMetadataJSON

func (ev *WatchEvent) PartialObjectMetadataJSON() []byte

Constructs the message for a PartialObjectMetadata response

func (*WatchEvent) Unstructured

func (ev *WatchEvent) Unstructured() *unstructured.Unstructured

type WatchOptions

type WatchOptions struct {
	Namespace string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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