Documentation ¶
Index ¶
- func DoServerSideApply(ctx context.Context, r ResourceInfo, live *unstructured.Unstructured, ...) (*unstructured.Unstructured, bool, error)
- type Clock
- type Hook
- type ListFilter
- type RandomUIDGenerator
- type RealClock
- type ResourceInfo
- type Storage
- type TestClock
- type TestUIDGenerator
- type UIDGenerator
- type WatchCallback
- type WatchEvent
- type WatchOptions
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 Hook ¶
type Hook interface { // OnWatchEvent is called whenever a watch event is created 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 ResourceInfo ¶
type ResourceInfo interface { GVK() schema.GroupVersionKind ListGVK() schema.GroupVersionKind ParseableType() *typed.ParseableType // SetsGeneration is true if we should automatically set metadata.generation for this resource kind. SetsGeneration() bool GetObject(ctx context.Context, id types.NamespacedName) (*unstructured.Unstructured, bool, error) ListObjects(ctx context.Context, filter ListFilter) (*unstructured.UnstructuredList, error) Watch(ctx context.Context, opt WatchOptions, callback WatchCallback) error CreateObject(ctx context.Context, id types.NamespacedName, u *unstructured.Unstructured) error UpdateObject(ctx context.Context, id types.NamespacedName, u *unstructured.Unstructured) error DeleteObject(ctx context.Context, id types.NamespacedName) (*unstructured.Unstructured, error) }
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
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 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
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.