Documentation ¶
Index ¶
- func NewCachingClusterReader(reader client.Reader, mapper meta.RESTMapper, ...) (engine.ClusterReader, error)
- func NewDirectClusterReader(reader client.Reader, _ meta.RESTMapper, _ object.ObjMetadataSet) (engine.ClusterReader, error)
- type CachingClusterReader
- func (c *CachingClusterReader) Get(_ context.Context, key client.ObjectKey, obj *unstructured.Unstructured) error
- func (c *CachingClusterReader) ListClusterScoped(ctx context.Context, list *unstructured.UnstructuredList, ...) error
- func (c *CachingClusterReader) ListNamespaceScoped(_ context.Context, list *unstructured.UnstructuredList, namespace string, ...) error
- func (c *CachingClusterReader) Sync(ctx context.Context) error
- type DirectClusterReader
- func (n *DirectClusterReader) Get(ctx context.Context, key client.ObjectKey, obj *unstructured.Unstructured) error
- func (n *DirectClusterReader) ListClusterScoped(ctx context.Context, list *unstructured.UnstructuredList, ...) error
- func (n *DirectClusterReader) ListNamespaceScoped(ctx context.Context, list *unstructured.UnstructuredList, namespace string, ...) error
- func (n *DirectClusterReader) Sync(_ context.Context) error
- type DynamicClusterReader
- func (n *DynamicClusterReader) Get(ctx context.Context, key client.ObjectKey, obj *unstructured.Unstructured) error
- func (n *DynamicClusterReader) ListClusterScoped(ctx context.Context, list *unstructured.UnstructuredList, ...) error
- func (n *DynamicClusterReader) ListNamespaceScoped(ctx context.Context, list *unstructured.UnstructuredList, namespace string, ...) error
- func (n *DynamicClusterReader) Sync(_ context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCachingClusterReader ¶
func NewCachingClusterReader(reader client.Reader, mapper meta.RESTMapper, identifiers object.ObjMetadataSet) (engine.ClusterReader, error)
NewCachingClusterReader returns a new instance of the ClusterReader. The ClusterReader needs will use the clusterreader to fetch resources from the cluster, while the mapper is used to resolve the version for GroupKinds. The set of identifiers is needed so the ClusterReader can figure out which GroupKind and namespace combinations it needs to cache when the Sync function is called. We only want to fetch the resources that are actually needed.
func NewDirectClusterReader ¶ added in v0.28.0
func NewDirectClusterReader(reader client.Reader, _ meta.RESTMapper, _ object.ObjMetadataSet) (engine.ClusterReader, error)
NewDirectClusterReader creates a new implementation of the engine.ClusterReader interface that makes calls directly to the cluster without any caching.
Types ¶
type CachingClusterReader ¶
type CachingClusterReader struct {
// contains filtered or unexported fields
}
CachingClusterReader is an implementation of the ObserverReader interface that will pre-fetch all resources needed before every sync loop. The resources needed are decided by finding all combinations of GroupVersionKind and namespace referenced by the provided identifiers. This list is then expanded to include any known generated resource types.
func (*CachingClusterReader) Get ¶
func (c *CachingClusterReader) Get(_ context.Context, key client.ObjectKey, obj *unstructured.Unstructured) error
Get looks up the resource identified by the key and the object GVK in the cache. If the needed combination of GVK and namespace is not part of the cache, that is considered an error.
func (*CachingClusterReader) ListClusterScoped ¶
func (c *CachingClusterReader) ListClusterScoped(ctx context.Context, list *unstructured.UnstructuredList, selector labels.Selector) error
ListClusterScoped lists all resource identifier by the GVK of the list and selector from the cache. If the needed combination of GVK and namespace (which for clusterscoped resources will always be the empty string) is not part of the cache, that is considered an error.
func (*CachingClusterReader) ListNamespaceScoped ¶
func (c *CachingClusterReader) ListNamespaceScoped(_ context.Context, list *unstructured.UnstructuredList, namespace string, selector labels.Selector) error
ListNamespaceScoped lists all resource identifier by the GVK of the list, the namespace and the selector from the cache. If the needed combination of GVK and namespace is not part of the cache, that is considered an error.
type DirectClusterReader ¶
DirectClusterReader is an implementation of the ClusterReader that just delegates all calls directly to the underlying clusterreader. No caching.
func (*DirectClusterReader) Get ¶
func (n *DirectClusterReader) Get(ctx context.Context, key client.ObjectKey, obj *unstructured.Unstructured) error
func (*DirectClusterReader) ListClusterScoped ¶
func (n *DirectClusterReader) ListClusterScoped(ctx context.Context, list *unstructured.UnstructuredList, selector labels.Selector) error
func (*DirectClusterReader) ListNamespaceScoped ¶
func (n *DirectClusterReader) ListNamespaceScoped(ctx context.Context, list *unstructured.UnstructuredList, namespace string, selector labels.Selector) error
type DynamicClusterReader ¶ added in v0.31.0
type DynamicClusterReader struct { DynamicClient dynamic.Interface Mapper meta.RESTMapper }
DynamicClusterReader is an implementation of the ClusterReader that delegates all calls directly to the underlying DynamicClient. No caching.
func (*DynamicClusterReader) Get ¶ added in v0.31.0
func (n *DynamicClusterReader) Get(ctx context.Context, key client.ObjectKey, obj *unstructured.Unstructured) error
func (*DynamicClusterReader) ListClusterScoped ¶ added in v0.31.0
func (n *DynamicClusterReader) ListClusterScoped(ctx context.Context, list *unstructured.UnstructuredList, selector labels.Selector) error
func (*DynamicClusterReader) ListNamespaceScoped ¶ added in v0.31.0
func (n *DynamicClusterReader) ListNamespaceScoped(ctx context.Context, list *unstructured.UnstructuredList, namespace string, selector labels.Selector) error