k8sutil

package
v4.3.8 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldIndexName

func FieldIndexName(field string) string

FieldIndexName constructs the name of the index over the given field, for use with an indexer.

func KeyToNamespacedKey

func KeyToNamespacedKey(ns string, baseKey string) string

KeyToNamespacedKey prefixes the given index key with a namespace for use in field selector indexes.

func NewODLMCache

func NewODLMCache(isolatedModeEnable bool, namespaces []string, gvkLabelMap map[schema.GroupVersionKind]filteredcache.Selector) cache.NewCacheFunc

NewODLMCache implements a customized cache with a for ODLM

Types

type ODLMCache

type ODLMCache struct {
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

ODLMCache is the customized cache for ODLM

func (ODLMCache) Get

func (c ODLMCache) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error

Get implements Reader If the resource is in the cache, Get function get fetch in from the informer Otherwise, resource will be get by the k8s client

func (ODLMCache) GetInformer

func (c ODLMCache) GetInformer(ctx context.Context, obj client.Object) (cache.Informer, error)

GetInformer fetches or constructs an informer for the given object that corresponds to a single API kind and resource.

func (ODLMCache) GetInformerForKind

func (c ODLMCache) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (cache.Informer, error)

GetInformerForKind is similar to GetInformer, except that it takes a group-version-kind, instead of the underlying object.

func (ODLMCache) IndexField

func (c ODLMCache) 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. The filtered cache doesn't support the index yet.

func (ODLMCache) List

func (c ODLMCache) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

List lists items out of the indexer and writes them to list

func (ODLMCache) Start

func (c ODLMCache) Start(ctx context.Context) error

Start runs all the informers known to this cache until the given channel is closed. It blocks.

func (ODLMCache) WaitForCacheSync

func (c ODLMCache) WaitForCacheSync(ctx context.Context) bool

WaitForCacheSync waits for all the caches to sync. Returns false if it could not sync a cache.

Jump to

Keyboard shortcuts

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