Documentation ¶
Index ¶
- func NewConflictHandler() conflict.Handler
- func NewDiscoveryClient(gvks ...schema.GroupVersionKind) discoveryutil.ServerResourcer
- func NewDiscoveryClientWithError(wantedErr error, gvks ...schema.GroupVersionKind) discoveryutil.ServerResourcer
- func NewErrorClient(err error) client.Client
- func NewFightHandler() fight.Handler
- func RealNow() metav1.Time
- func StartWatchSupervisor(t *testing.T, supervisor *WatchSupervisor)
- func StartWatcher(t *testing.T, watcher *Watcher)
- type Applier
- func (a *Applier) Create(ctx context.Context, obj *unstructured.Unstructured) status.Error
- func (a *Applier) Delete(ctx context.Context, obj *unstructured.Unstructured) status.Error
- func (a *Applier) GetClient() client.Client
- func (a *Applier) RemoveNomosMeta(ctx context.Context, intent *unstructured.Unstructured, _ string) status.Error
- func (a *Applier) Update(ctx context.Context, intendedState, _ *unstructured.Unstructured) status.Error
- type Cache
- func (c *Cache) Get(ctx context.Context, key client.ObjectKey, out client.Object, ...) error
- func (c *Cache) GetInformer(ctx context.Context, obj client.Object) (cache.Informer, error)
- func (c *Cache) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (cache.Informer, error)
- func (c *Cache) HasSyncedFuncs() []k8scache.InformerSynced
- func (c *Cache) IndexField(ctx context.Context, obj client.Object, field string, ...) error
- func (c *Cache) List(ctx context.Context, out client.ObjectList, opts ...client.ListOption) error
- func (c *Cache) Start(ctx context.Context) error
- func (c *Cache) WaitForCacheSync(ctx context.Context) bool
- type CacheOptions
- type Client
- func (c *Client) Applier() reconcile.Applier
- func (c *Client) Check(t *testing.T, wants ...client.Object)
- func (c *Client) Codecs() serializer.CodecFactory
- func (c *Client) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (c *Client) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (c *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (c *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object, ...) error
- func (c *Client) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
- func (c *Client) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (c *Client) RESTMapper() meta.RESTMapper
- func (c *Client) Scheme() *runtime.Scheme
- func (c *Client) Status() client.SubResourceWriter
- func (c *Client) Storage() *MemoryStorage
- func (c *Client) SubResource(subResource string) client.SubResourceClient
- func (c *Client) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- func (c *Client) Watch(ctx context.Context, exampleList client.ObjectList, opts ...client.ListOption) (watch.Interface, error)
- type ClientSet
- type ConflictHandler
- type DynamicClient
- func (dc *DynamicClient) Check(t *testing.T, wants ...client.Object)
- func (dc *DynamicClient) Put(t *testing.T, obj *unstructured.Unstructured)
- func (dc *DynamicClient) PutAll(t *testing.T, objs ...*unstructured.Unstructured)
- func (dc *DynamicClient) RESTMapper() meta.RESTMapper
- func (dc *DynamicClient) Scheme() *runtime.Scheme
- func (dc *DynamicClient) Storage() *MemoryStorage
- type ErrorClient
- func (e ErrorClient) Create(_ context.Context, _ client.Object, _ ...client.CreateOption) error
- func (e ErrorClient) Delete(_ context.Context, _ client.Object, _ ...client.DeleteOption) error
- func (e ErrorClient) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error
- func (e ErrorClient) Get(_ context.Context, _ client.ObjectKey, _ client.Object, _ ...client.GetOption) error
- func (e ErrorClient) List(_ context.Context, _ client.ObjectList, _ ...client.ListOption) error
- func (e ErrorClient) Patch(_ context.Context, _ client.Object, _ client.Patch, _ ...client.PatchOption) error
- func (e ErrorClient) RESTMapper() meta.RESTMapper
- func (e ErrorClient) Scheme() *runtime.Scheme
- func (e ErrorClient) Status() client.StatusWriter
- func (e ErrorClient) SubResource(_ string) client.SubResourceClient
- func (e ErrorClient) Update(_ context.Context, _ client.Object, _ ...client.UpdateOption) error
- type FightHandler
- type MapEntry
- type MemoryStorage
- func (ms *MemoryStorage) Check(t *testing.T, wants ...client.Object)
- func (ms *MemoryStorage) Create(ctx context.Context, obj client.Object, opts *client.CreateOptions) error
- func (ms *MemoryStorage) Delete(ctx context.Context, obj client.Object, opts *client.DeleteOptions) error
- func (ms *MemoryStorage) DeleteAllOf(_ context.Context, _ client.ObjectList, _ *client.DeleteAllOfOptions) error
- func (ms *MemoryStorage) Get(_ context.Context, gvk schema.GroupVersionKind, key client.ObjectKey, ...) error
- func (ms *MemoryStorage) List(_ context.Context, list client.ObjectList, opts *client.ListOptions) error
- func (ms *MemoryStorage) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (ms *MemoryStorage) Subresource(field string) *SubresourceStorage
- func (ms *MemoryStorage) TestGet(id core.ID) (*unstructured.Unstructured, bool)
- func (ms *MemoryStorage) TestGetAll() map[core.ID]*unstructured.Unstructured
- func (ms *MemoryStorage) TestPut(obj client.Object) error
- func (ms *MemoryStorage) TestPutAll(objs ...client.Object) error
- func (ms *MemoryStorage) Update(ctx context.Context, obj client.Object, opts *client.UpdateOptions) error
- func (ms *MemoryStorage) Watch(_ context.Context, exampleList client.ObjectList, opts *client.ListOptions) (watch.Interface, error)
- type SubResourceErrorClient
- func (e SubResourceErrorClient) Create(_ context.Context, _ client.Object, _ client.Object, ...) error
- func (e SubResourceErrorClient) Get(_ context.Context, _ client.Object, _ client.Object, ...) error
- func (e SubResourceErrorClient) Patch(_ context.Context, _ client.Object, _ client.Patch, ...) error
- func (e SubResourceErrorClient) Update(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error
- type SubresourceStorage
- type UnstructuredFields
- type WatchSupervisor
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConflictHandler ¶ added in v1.15.1
NewConflictHandler initiates a fake implementation of conflict.Handler.
func NewDiscoveryClient ¶
func NewDiscoveryClient(gvks ...schema.GroupVersionKind) discoveryutil.ServerResourcer
NewDiscoveryClient returns a discoveryClient that reports types available to the API Server with no errors
Does not report the scope of each GVK as no tests requiring a discoveryClient use scope information.
func NewDiscoveryClientWithError ¶ added in v1.15.1
func NewDiscoveryClientWithError(wantedErr error, gvks ...schema.GroupVersionKind) discoveryutil.ServerResourcer
NewDiscoveryClientWithError returns a discoveryClient that reports types available to the API Server with no errors, or ErrGroupDiscoveryFailed error with the specified wantedErr
Does not report the scope of each GVK as no tests requiring a discoveryClient use scope information.
func NewErrorClient ¶
NewErrorClient returns a Client that always returns an error.
func NewFightHandler ¶ added in v1.15.1
NewFightHandler initiates a fake implementation of fight.Handler.
func StartWatchSupervisor ¶ added in v1.16.0
func StartWatchSupervisor(t *testing.T, supervisor *WatchSupervisor)
StartWatchSupervisor starts a watchSupervisor and stops it in test cleanup.
func StartWatcher ¶ added in v1.16.0
StartWatcher starts a watchSupervisor and stops it in test cleanup.
Types ¶
type Applier ¶ added in v1.15.1
type Applier struct { Client *Client CreateError status.Error UpdateError status.Error DeleteError status.Error }
Applier implements a fake reconcile.Applier for use in testing.
reconcile.Applier not imported due to import cycle considerations.
func (*Applier) Create ¶ added in v1.15.1
func (a *Applier) Create(ctx context.Context, obj *unstructured.Unstructured) status.Error
Create implements reconcile.Applier.
func (*Applier) Delete ¶ added in v1.15.1
func (a *Applier) Delete(ctx context.Context, obj *unstructured.Unstructured) status.Error
Delete implements reconcile.Applier.
func (*Applier) RemoveNomosMeta ¶ added in v1.15.1
func (a *Applier) RemoveNomosMeta(ctx context.Context, intent *unstructured.Unstructured, _ string) status.Error
RemoveNomosMeta implements reconcile.Applier.
func (*Applier) Update ¶ added in v1.15.1
func (a *Applier) Update(ctx context.Context, intendedState, _ *unstructured.Unstructured) status.Error
Update implements reconcile.Applier.
type Cache ¶ added in v1.16.0
type Cache struct { *Client // contains filtered or unexported fields }
Cache is a fake implementation of cache.Cache.
func NewCache ¶ added in v1.16.0
func NewCache(fakeClient *Client, opts CacheOptions) *Cache
NewCache constructs a new Cache
func (*Cache) Get ¶ added in v1.16.0
func (c *Cache) Get(ctx context.Context, key client.ObjectKey, out client.Object, opts ...client.GetOption) error
Get implements client.Reader.Get.
func (*Cache) GetInformer ¶ added in v1.16.0
GetInformer constructs or retrieves from cache an informer to watch the specified resource.
func (*Cache) GetInformerForKind ¶ added in v1.16.0
func (c *Cache) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (cache.Informer, error)
GetInformerForKind returns the informer for the GroupVersionKind.
func (*Cache) HasSyncedFuncs ¶ added in v1.16.0
func (c *Cache) HasSyncedFuncs() []k8scache.InformerSynced
HasSyncedFuncs returns all the HasSynced functions for the informers in this map.
func (*Cache) IndexField ¶ added in v1.16.0
func (c *Cache) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error
IndexField adds an indexer to the underlying cache, using extraction function to get value(s) from the given field. This index can then be used by passing a field selector to List. For one-to-one compatibility with "normal" field selectors, only return one value. The values may be anything. They will automatically be prefixed with the namespace of the given object, if present. The objects passed are guaranteed to be objects of the correct type.
func (*Cache) List ¶ added in v1.16.0
func (c *Cache) List(ctx context.Context, out client.ObjectList, opts ...client.ListOption) error
List implements client.Reader.List.
type CacheOptions ¶ added in v1.16.0
type CacheOptions struct { // Namespace restricts the cache's ListWatch to the desired namespace // Default watches all namespaces Namespace string // ResyncPeriod is how often the objects are retrieved to re-synchronize, // in case any events were missed. // If zero or less, re-sync is disabled. ResyncPeriod time.Duration }
CacheOptions are the optional arguments for creating a new Cache object.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a fake implementation of client.Client.
Known Unimplemented features (update as discovered/added): - DeletePropagationBackground (performs foreground instead) - DeletePropagationOrphan (returns error if used) - ListOptions.Limit & Continue (ignored - all objects are returned) - Status().Patch
func NewClient ¶
NewClient instantiates a new fake.Client pre-populated with the specified objects.
Calls t.Fatal if unable to properly instantiate Client.
func (*Client) Applier ¶
Applier returns a fake.Applier wrapping this fake.Client. Callers using the resulting Applier will read from/write to the original fake.Client.
func (*Client) Check ¶
Check reports an error to `t` if the passed objects in wants do not match the expected set of objects in the fake.Client, and only the passed updates to Status fields were recorded.
func (*Client) Codecs ¶ added in v1.16.0
func (c *Client) Codecs() serializer.CodecFactory
Codecs returns the CodecFactory.
func (*Client) DeleteAllOf ¶
func (c *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
DeleteAllOf implements client.Client.
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
Get implements client.Client.
func (*Client) List ¶
func (c *Client) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
List implements client.Client.
Does not paginate results.
func (*Client) Patch ¶
func (c *Client) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
Patch implements client.Client.
func (*Client) RESTMapper ¶
func (c *Client) RESTMapper() meta.RESTMapper
RESTMapper returns the RESTMapper.
func (*Client) Status ¶
func (c *Client) Status() client.SubResourceWriter
Status implements client.Client.
func (*Client) Storage ¶ added in v1.16.0
func (c *Client) Storage() *MemoryStorage
Storage returns the backing Storage layer
func (*Client) SubResource ¶ added in v1.16.0
func (c *Client) SubResource(subResource string) client.SubResourceClient
SubResource implements client.Client
type ClientSet ¶ added in v1.16.0
type ClientSet struct { // Client is a fake implementation of client.Client. Client *Client // DynamicClient is a fake implementation of dynamic.Interface. DynamicClient *DynamicClient // Storage is the in-memory storage backing both the Client & DynamicClient. Storage *MemoryStorage }
ClientSet is a wrapper that contains a client.Client & dynamic.Interface with the same backing MemoryStorage. This enables usage of both client types in the same tests.
type ConflictHandler ¶ added in v1.15.1
type ConflictHandler struct{}
ConflictHandler is a fake implementation of conflict.Handler.
func (*ConflictHandler) AddConflictError ¶ added in v1.15.1
func (h *ConflictHandler) AddConflictError(queue.GVKNN, status.ManagementConflictError)
AddConflictError is a fake implementation of AddConflictError of conflict.Handler.
func (*ConflictHandler) ConflictErrors ¶ added in v1.15.1
func (h *ConflictHandler) ConflictErrors() []status.ManagementConflictError
ConflictErrors is a fake implementation of ConflictErrors of conflict.Handler.
func (*ConflictHandler) RemoveAllConflictErrors ¶ added in v1.15.1
func (h *ConflictHandler) RemoveAllConflictErrors(schema.GroupVersionKind)
RemoveAllConflictErrors is a fake implementation of RemoveAllConflictErrors of conflict.Handler.
func (*ConflictHandler) RemoveConflictError ¶ added in v1.15.1
func (h *ConflictHandler) RemoveConflictError(queue.GVKNN)
RemoveConflictError is a fake implementation of the RemoveConflictError of conflict.Handler.
type DynamicClient ¶ added in v1.15.1
type DynamicClient struct { *dynamicfake.FakeDynamicClient // contains filtered or unexported fields }
DynamicClient is a fake implementation of dynamic.Interface
func NewDynamicClient ¶ added in v1.15.1
func NewDynamicClient(t *testing.T, scheme *runtime.Scheme) *DynamicClient
NewDynamicClient instantiates a new fake.DynamicClient
func (*DynamicClient) Check ¶ added in v1.15.1
func (dc *DynamicClient) Check(t *testing.T, wants ...client.Object)
Check reports an error to `t` if the passed objects in wants do not match the expected set of objects in the fake.Client, and only the passed updates to Status fields were recorded.
func (*DynamicClient) Put ¶ added in v1.15.1
func (dc *DynamicClient) Put(t *testing.T, obj *unstructured.Unstructured)
Put adds the object to the cache, with metadata validation.
Use for test initialization to simulate exact cluster state. Does not trigger events or garbage collection.
func (*DynamicClient) PutAll ¶ added in v1.15.1
func (dc *DynamicClient) PutAll(t *testing.T, objs ...*unstructured.Unstructured)
PutAll loops through the objects and adds them to the cache, with metadata validation.
Use for test initialization to simulate exact cluster state.
func (*DynamicClient) RESTMapper ¶ added in v1.17.2
func (dc *DynamicClient) RESTMapper() meta.RESTMapper
RESTMapper returns the backing RESTMapper.
func (*DynamicClient) Scheme ¶ added in v1.17.2
func (dc *DynamicClient) Scheme() *runtime.Scheme
Scheme returns the backing Scheme.
func (*DynamicClient) Storage ¶ added in v1.17.2
func (dc *DynamicClient) Storage() *MemoryStorage
Storage returns the backing Storage layer
type ErrorClient ¶
type ErrorClient struct {
// contains filtered or unexported fields
}
ErrorClient is a Client that always returns a specified error.
func (ErrorClient) Create ¶
func (e ErrorClient) Create(_ context.Context, _ client.Object, _ ...client.CreateOption) error
Create implements client.Client.
func (ErrorClient) Delete ¶
func (e ErrorClient) Delete(_ context.Context, _ client.Object, _ ...client.DeleteOption) error
Delete implements client.Client.
func (ErrorClient) DeleteAllOf ¶
func (e ErrorClient) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error
DeleteAllOf implements client.Client.
func (ErrorClient) Get ¶
func (e ErrorClient) Get(_ context.Context, _ client.ObjectKey, _ client.Object, _ ...client.GetOption) error
Get implements client.Client.
func (ErrorClient) List ¶
func (e ErrorClient) List(_ context.Context, _ client.ObjectList, _ ...client.ListOption) error
List implements client.Client.
func (ErrorClient) Patch ¶
func (e ErrorClient) Patch(_ context.Context, _ client.Object, _ client.Patch, _ ...client.PatchOption) error
Patch implements client.Client.
func (ErrorClient) RESTMapper ¶
func (e ErrorClient) RESTMapper() meta.RESTMapper
RESTMapper implements client.Client.
func (ErrorClient) Scheme ¶
func (e ErrorClient) Scheme() *runtime.Scheme
Scheme implements client.Client.
func (ErrorClient) Status ¶
func (e ErrorClient) Status() client.StatusWriter
Status implements client.Client.
func (ErrorClient) SubResource ¶ added in v1.16.0
func (e ErrorClient) SubResource(_ string) client.SubResourceClient
SubResource implements client.Client.
func (ErrorClient) Update ¶
func (e ErrorClient) Update(_ context.Context, _ client.Object, _ ...client.UpdateOption) error
Update implements client.Client.
type FightHandler ¶ added in v1.15.1
type FightHandler struct{}
FightHandler is a fake implementation of fight.Handler.
func (*FightHandler) AddFightError ¶ added in v1.15.1
func (h *FightHandler) AddFightError(core.ID, status.Error)
AddFightError is a fake implementation of the AddFightError of fight.Handler.
func (*FightHandler) FightErrors ¶ added in v1.15.1
func (h *FightHandler) FightErrors() []status.Error
FightErrors is a fake implementation of the FightErrors of fight.Handler.
func (*FightHandler) RemoveFightError ¶ added in v1.15.1
func (h *FightHandler) RemoveFightError(core.ID)
RemoveFightError is a fake implementation of the RemoveFightError of fight.Handler.
type MapEntry ¶ added in v1.16.0
type MapEntry struct { // Informer is the cached informer Informer k8scache.SharedIndexInformer // CacheReader wraps Informer and implements the CacheReader interface for a single type Reader client.Reader }
MapEntry contains the cached data for an Informer.
type MemoryStorage ¶ added in v1.16.0
type MemoryStorage struct { // Now is a hook to replace time.Now for testing. // Default impl is RealNow. Now func() metav1.Time // contains filtered or unexported fields }
MemoryStorage is an in-memory simulation of the Kubernetes APIServer.
Many resource-agnostic features are implemented to facilitate testing controllers and other libraries. No resource-specific controller behaviors are implemented.
func NewInMemoryStorage ¶ added in v1.16.0
func NewInMemoryStorage(scheme *runtime.Scheme, watchSupervisor *WatchSupervisor) *MemoryStorage
NewInMemoryStorage constructs a new MemoryStorage
func (*MemoryStorage) Check ¶ added in v1.16.0
func (ms *MemoryStorage) Check(t *testing.T, wants ...client.Object)
Check reports a test error if the passed objects (wants) do not match the expected set of objects in storage. Objects will be converted to the scheme-preferred version and minimized before comparison.
func (*MemoryStorage) Create ¶ added in v1.16.0
func (ms *MemoryStorage) Create(ctx context.Context, obj client.Object, opts *client.CreateOptions) error
Create an object in storage
func (*MemoryStorage) Delete ¶ added in v1.16.0
func (ms *MemoryStorage) Delete(ctx context.Context, obj client.Object, opts *client.DeleteOptions) error
Delete an object in storage
func (*MemoryStorage) DeleteAllOf ¶ added in v1.16.0
func (ms *MemoryStorage) DeleteAllOf(_ context.Context, _ client.ObjectList, _ *client.DeleteAllOfOptions) error
DeleteAllOf deletes all the objects of the specified resource.
func (*MemoryStorage) Get ¶ added in v1.16.0
func (ms *MemoryStorage) Get(_ context.Context, gvk schema.GroupVersionKind, key client.ObjectKey, obj client.Object, opts *client.GetOptions) error
Get an object from storage
func (*MemoryStorage) List ¶ added in v1.16.0
func (ms *MemoryStorage) List(_ context.Context, list client.ObjectList, opts *client.ListOptions) error
List all the objects in storage that match the resource type and list objects.
func (*MemoryStorage) Patch ¶ added in v1.16.0
func (ms *MemoryStorage) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts *client.PatchOptions) error
Patch an object in storage
func (*MemoryStorage) Subresource ¶ added in v1.16.0
func (ms *MemoryStorage) Subresource(field string) *SubresourceStorage
Subresource returns a new SubresourceStorage, which can be used to update the sub-resource field, without updating any other fields.
func (*MemoryStorage) TestGet ¶ added in v1.16.0
func (ms *MemoryStorage) TestGet(id core.ID) (*unstructured.Unstructured, bool)
TestGet gets an object from storage, without validation or type conversion. Use for testing what exactly is in storage. The object is NOT a copy. Use with caution.
func (*MemoryStorage) TestGetAll ¶ added in v1.16.0
func (ms *MemoryStorage) TestGetAll() map[core.ID]*unstructured.Unstructured
TestGetAll gets all objects from storage, without validation or type conversion. Use for testing what exactly is in storage. The map is a copy, but the objects are NOT copies. Use with caution.
func (*MemoryStorage) TestPut ¶ added in v1.16.0
func (ms *MemoryStorage) TestPut(obj client.Object) error
TestPut adds or replaces an object in storage without sending events or triggering garbage collection. Use for initializing or replacing what exactly is in storage.
func (*MemoryStorage) TestPutAll ¶ added in v1.16.0
func (ms *MemoryStorage) TestPutAll(objs ...client.Object) error
TestPutAll adds or replaces multiple objects in storage without sending events or triggering garbage collection. Use for initializing or replacing what exactly is in storage.
func (*MemoryStorage) Update ¶ added in v1.16.0
func (ms *MemoryStorage) Update(ctx context.Context, obj client.Object, opts *client.UpdateOptions) error
Update an object in storage
func (*MemoryStorage) Watch ¶ added in v1.16.0
func (ms *MemoryStorage) Watch(_ context.Context, exampleList client.ObjectList, opts *client.ListOptions) (watch.Interface, error)
Watch the specified objects. The returned watcher will stream events to the ResultChan until Stop is called.
type SubResourceErrorClient ¶ added in v1.16.0
type SubResourceErrorClient struct {
// contains filtered or unexported fields
}
SubResourceErrorClient is a SubResourceClient that always returns a specified error.
func (SubResourceErrorClient) Create ¶ added in v1.16.0
func (e SubResourceErrorClient) Create(_ context.Context, _ client.Object, _ client.Object, _ ...client.SubResourceCreateOption) error
Create implements client.SubResourceWriter
func (SubResourceErrorClient) Get ¶ added in v1.16.0
func (e SubResourceErrorClient) Get(_ context.Context, _ client.Object, _ client.Object, _ ...client.SubResourceGetOption) error
Get implements client.SubResourceReader
func (SubResourceErrorClient) Patch ¶ added in v1.16.0
func (e SubResourceErrorClient) Patch(_ context.Context, _ client.Object, _ client.Patch, _ ...client.SubResourcePatchOption) error
Patch implements client.SubResourceWriter
func (SubResourceErrorClient) Update ¶ added in v1.16.0
func (e SubResourceErrorClient) Update(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error
Update implements client.SubResourceWriter
type SubresourceStorage ¶ added in v1.16.0
type SubresourceStorage struct { // Storage is the backing store for full resource objects Storage *MemoryStorage // Field is the sub-resource field managed by this SubresourceStorage Field string }
SubresourceStorage is a wrapper around MemoryStorage that allows modifying a specific top-level field without updating any other fields.
func (*SubresourceStorage) Patch ¶ added in v1.16.0
func (ss *SubresourceStorage) Patch(_ context.Context, _ client.Object, _ client.Patch, _ *client.SubResourcePatchOptions) error
Patch the sub-resource field. All other fields are ignored.
func (*SubresourceStorage) Update ¶ added in v1.16.0
func (ss *SubresourceStorage) Update(ctx context.Context, obj client.Object, opts *client.SubResourceUpdateOptions) error
Update the sub-resource field. All other fields are ignored.
type UnstructuredFields ¶ added in v1.15.1
type UnstructuredFields struct {
Object *unstructured.Unstructured
}
UnstructuredFields Implements fields.Fields to do field selection on any field in an unstructured object.
func (*UnstructuredFields) Get ¶ added in v1.15.1
func (uf *UnstructuredFields) Get(field string) (value string)
Get returns the value for the provided field.
func (*UnstructuredFields) Has ¶ added in v1.15.1
func (uf *UnstructuredFields) Has(field string) (exists bool)
Has returns whether the provided field exists.
type WatchSupervisor ¶ added in v1.16.0
type WatchSupervisor struct {
// contains filtered or unexported fields
}
WatchSupervisor supervises watches for all resources in a scheme.
Once started, the supervisor handles fan-out of events to all current watchers. Watches are version-agnostic. Any events for a specific GroupKind will be propagated to all watchers of that GroupKind.
func NewWatchSupervisor ¶ added in v1.16.0
func NewWatchSupervisor(scheme *runtime.Scheme) *WatchSupervisor
NewWatchSupervisor constructs a new WatchSupervisor
func (*WatchSupervisor) Done ¶ added in v1.16.0
func (ws *WatchSupervisor) Done() <-chan struct{}
Done returns a channel that will be closed when Run has exited.
func (*WatchSupervisor) Run ¶ added in v1.16.0
func (ws *WatchSupervisor) Run(ctx context.Context)
Run propagates events to watchers until the context is done.
type Watcher ¶ added in v1.16.0
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is a fake implementation of watch.Interface.
func NewWatcher ¶ added in v1.16.0
func NewWatcher(supervisor *WatchSupervisor, gk schema.GroupKind, exampleList client.ObjectList, options *client.ListOptions) *Watcher
NewWatcher constructs a new Watcher
func (*Watcher) ResultChan ¶ added in v1.16.0
ResultChan returns the event channel. The event channel will be closed when the watcher is stopped.
func (*Watcher) Start ¶ added in v1.16.0
Start adds the watcher to the supervisor and starts a background goroutine to handle events until the context is done or the Watcher is stopped, then the watcher is removed from the supervisor. Returns a done channel that will be closed event handling had stopped and the watcher has been removed from the supervisor.