cache

package
v0.37.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ACKRoleAccountMap is the name of the configmap map object storing
	// all the AWS Account IDs associated with their AWS Role ARNs.
	ACKRoleAccountMap = "ack-role-account-map"

	// ACKCARMMapV2 is the name of the v2 CARM map.
	// It stores the mapping for:
	// - Account ID to the AWS role ARNs.
	ACKCARMMapV2 = "ack-carm-map"
)

Variables

View Source
var (
	// ErrCARMConfigMapNotFound is an error that is returned when the CARM
	// configmap is not found.
	ErrCARMConfigMapNotFound = errors.New("CARM configmap not found")
	// ErrKeyNotFound is an error that is returned when the account ID
	// is not found in the CARM configmap.
	ErrKeyNotFound = errors.New("key not found in CARM configmap")
	// ErrEmptyValue is an error that is returned when the role ARN is empty
	// in the CARM configmap.
	ErrEmptyValue = errors.New("role value is empty in CARM configmap")
)

Functions

This section is empty.

Types

type CARMMap added in v0.37.0

type CARMMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CARMMap is responsible for caching the CARM configmap data. It is listening to all the events related to the CARM map and make the changes accordingly.

func NewCARMMapCache added in v0.37.0

func NewCARMMapCache(log logr.Logger) *CARMMap

NewCARMMapCache instanciate a new CARMMap.

func (*CARMMap) GetValue added in v0.37.0

func (c *CARMMap) GetValue(key string) (string, error)

GetValue queries the value from the cached CARM configmap. It will return an error if the configmap is not found, the key is not found or the value is empty.

This function is thread safe.

func (*CARMMap) Run added in v0.37.0

func (c *CARMMap) Run(name string, clientSet kubernetes.Interface, stopCh <-chan struct{})

Run instantiate a new SharedInformer for ConfigMaps and runs it to begin processing items.

type Caches

type Caches struct {

	// Accounts cache
	Accounts *CARMMap

	// CARMMaps v2 cache
	CARMMaps *CARMMap

	// Namespaces cache
	Namespaces *NamespaceCache
	// contains filtered or unexported fields
}

Caches is used to interact with the different caches

func New

func New(log logr.Logger, config Config, features featuregate.FeatureGates) Caches

New instantiate a new Caches object.

func (Caches) Run

func (c Caches) Run(clientSet kubernetes.Interface)

Run runs all the owned caches

func (Caches) Stop

func (c Caches) Stop()

Stop closes the stop channel and cause all the SharedInformers by caches to stop running

func (Caches) WaitForCachesToSync added in v0.36.0

func (c Caches) WaitForCachesToSync(ctx context.Context) bool

WaitForCachesToSync waits for both of the namespace and configMap informers to sync - by checking their hasSynced functions.

type Config added in v0.29.2

type Config struct {
	// WatchScope is a list of namespaces to watch for resources
	WatchScope []string
	// Ignored is a list of namespaces to ignore
	Ignored []string
}

Config is used to configure the caches.

type NamespaceCache

type NamespaceCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NamespaceCache is responsible of keeping track of namespaces annotations, and caching those related to the ACK controller.

func NewNamespaceCache

func NewNamespaceCache(log logr.Logger, watchScope []string, ignored []string) *NamespaceCache

NewNamespaceCache instanciate a new NamespaceCache.

func (*NamespaceCache) GetDefaultRegion

func (c *NamespaceCache) GetDefaultRegion(namespace string) (string, bool)

GetDefaultRegion returns the default region if it it exists

func (*NamespaceCache) GetDeletionPolicy added in v0.22.1

func (c *NamespaceCache) GetDeletionPolicy(namespace string, service string) (string, bool)

GetDeletionPolicy returns the deletion policy if it exists

func (*NamespaceCache) GetEndpointURL added in v0.8.0

func (c *NamespaceCache) GetEndpointURL(namespace string) (string, bool)

GetEndpointURL returns the endpoint URL if it exists

func (*NamespaceCache) GetOwnerAccountID

func (c *NamespaceCache) GetOwnerAccountID(namespace string) (string, bool)

GetOwnerAccountID returns the owner account ID if it exists

func (*NamespaceCache) GetTeamID added in v0.37.0

func (c *NamespaceCache) GetTeamID(namespace string) (string, bool)

GetTeamID returns the team-id if it exists

func (*NamespaceCache) Run

func (c *NamespaceCache) Run(clientSet kubernetes.Interface, stopCh <-chan struct{})

Run instantiate a new shared informer for namespaces and runs it to begin processing items.

Jump to

Keyboard shortcuts

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