clusterreader

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 18 Imported by: 4

Documentation

Index

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

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.

func (*CachingClusterReader) Sync

Sync loops over the list of gkNamespace we know of, and uses list calls to fetch the resources. This information populates the cache.

type DirectClusterReader

type DirectClusterReader struct {
	Reader client.Reader
}

DirectClusterReader is an implementation of the ClusterReader that just delegates all calls directly to the underlying clusterreader. No caching.

func (*DirectClusterReader) Get

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

func (*DirectClusterReader) Sync

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 (*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

func (*DynamicClusterReader) Sync added in v0.31.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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