store

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 18 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAs

func GetAs(ctx context.Context, o Store, key Key, as runtime.Object) (bool, error)

GetAs gets an object from the object store by key. If the object is not found, return false and a nil error.

Types

type Key

type Key struct {
	Namespace     string                `json:"namespace"`
	APIVersion    string                `json:"apiVersion"`
	Kind          string                `json:"kind"`
	Name          string                `json:"name"`
	Selector      *labels.Set           `json:"selector"`
	LabelSelector *metav1.LabelSelector `json:"labelSelector"`
}

Key is a key for the object store.

func KeyFromGroupVersionKind

func KeyFromGroupVersionKind(groupVersionKind schema.GroupVersionKind) Key

KeyFromGroupVersionKind creates a key from a group version kind.

func KeyFromObject

func KeyFromObject(object runtime.Object) (Key, error)

KeyFromObject creates a key from a runtime object.

func KeyFromPayload

func KeyFromPayload(payload action.Payload) (Key, error)

KeyFromPayload converts a payload into a Key.

func (Key) GroupVersionKind

func (k Key) GroupVersionKind() schema.GroupVersionKind

GroupVersionKind converts the Key to a GroupVersionKind.

func (Key) String

func (k Key) String() string

func (Key) ToActionPayload

func (k Key) ToActionPayload() action.Payload

ToActionPayload converts the Key to a payload.

func (Key) Validate added in v0.15.0

func (k Key) Validate() error

Validate validates the key.

type Store

type Store interface {
	List(ctx context.Context, key Key) (list *unstructured.UnstructuredList, loading bool, err error)
	Get(ctx context.Context, key Key) (object *unstructured.Unstructured, err error)
	Delete(ctx context.Context, key Key) error
	Watch(ctx context.Context, key Key, handler cache.ResourceEventHandler) error
	Unwatch(ctx context.Context, groupVersionKinds ...schema.GroupVersionKind) error
	UpdateClusterClient(ctx context.Context, client cluster.ClientInterface) error
	Update(ctx context.Context, key Key, updater func(*unstructured.Unstructured) error) error
	IsLoading(ctx context.Context, key Key) bool
	Create(ctx context.Context, object *unstructured.Unstructured) error
	// CreateOrUpdateFromYAML creates resources in the cluster from YAML input.
	// Resources are created in the order they are present in the YAML.
	// An error creating a resource halts resource creation.
	// A list of created resources is returned. You may have created resources AND a non-nil error.
	CreateOrUpdateFromYAML(ctx context.Context, namespace, input string) ([]string, error)
}

Store stores Kubernetes objects.

type UpdateFn

type UpdateFn func(store Store)

UpdateFn is a function that is called when

Directories

Path Synopsis
Package fake is a generated GoMock package.
Package fake is a generated GoMock package.

Jump to

Keyboard shortcuts

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