storage

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// UIDDataKey is the key used in config maps to store the UID.
	UIDDataKey = "uid"
	// ProviderDataKey is the key used in config maps to store the Provider
	// UID which we use to ensure unique firewalls.
	ProviderDataKey = "provider-uid"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIServerconfigMapStore

type APIServerconfigMapStore struct {
	// contains filtered or unexported fields
}

APIServerconfigMapStore only services Add and GetByKey from apiserver. TODO: Implement all the other store methods and make this a write through cache.

func (*APIServerconfigMapStore) Add

func (a *APIServerconfigMapStore) Add(obj interface{}) error

Add adds the given config map to the apiserver's store.

func (*APIServerconfigMapStore) Delete

func (a *APIServerconfigMapStore) Delete(obj interface{}) error

Delete deletes the existing config map object.

func (*APIServerconfigMapStore) GetByKey

func (a *APIServerconfigMapStore) GetByKey(key string) (item interface{}, exists bool, err error)

GetByKey returns the config map for a given key. The key must take the form namespace/name.

func (*APIServerconfigMapStore) Update

func (a *APIServerconfigMapStore) Update(obj interface{}) error

Update updates the existing config map object.

type ConfigMapVault

type ConfigMapVault struct {
	// contains filtered or unexported fields
}

ConfigMapVault stores cluster UIDs in config maps. It's a layer on top of configMapStore that just implements the utils.uidVault interface.

func NewConfigMapVault

func NewConfigMapVault(c kubernetes.Interface, uidNs, uidConfigMapName string) *ConfigMapVault

NewConfigMapVault creates a config map client. This client is essentially meant to abstract out the details of configmaps and the API, and just store/retrieve a single value, the cluster uid.

func NewFakeConfigMapVault

func NewFakeConfigMapVault(ns, name string) *ConfigMapVault

NewFakeConfigMapVault is an implementation of the configMapStore that doesn't persist configmaps. Only used in testing.

func (*ConfigMapVault) Delete

func (c *ConfigMapVault) Delete() error

Delete deletes the configMapStore.

func (*ConfigMapVault) Get

func (c *ConfigMapVault) Get(key string) (string, bool, error)

Get retrieves the value associated to the provided 'key' from the cluster config map. If this method returns an error, it's guaranteed to be apiserver flake. If the error is a not found error it sets the boolean to false and returns and error of nil instead.

func (*ConfigMapVault) Put

func (c *ConfigMapVault) Put(key, val string, createOnly bool) error

Put inserts a key/value pair in the cluster config map. If the key already exists, the value provided is stored.

Jump to

Keyboard shortcuts

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