storage

package
v0.9.8-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

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 CloudListingPool

type CloudListingPool struct {

	// The pool that is re-populated via re-list from cloud, and written to
	// from controller
	*InMemoryPool
	// contains filtered or unexported fields
}

CloudListingPool wraps InMemoryPool but relists from the cloud periodically.

func NewCloudListingPool

func NewCloudListingPool(name string, k keyFunc, lister cloudLister, relistPeriod time.Duration) *CloudListingPool

NewCloudListingPool replenishes the InMemoryPool through a background goroutine that lists from the given cloudLister.

func (*CloudListingPool) Add

func (c *CloudListingPool) Add(key string, obj interface{})

Add simply adds to the underlying pool.

func (*CloudListingPool) Delete

func (c *CloudListingPool) Delete(key string)

Delete just deletes from underlying pool.

func (*CloudListingPool) ReplenishPool

func (c *CloudListingPool) ReplenishPool()

ReplenishPool lists through the cloudLister and inserts into the pool. This is especially useful in scenarios like deleting an Ingress while the controller is restarting. As long as the resource exists in the shared memory pool, it is visible to the caller and they can take corrective actions, eg: backend pool deletes backends with non-matching node ports in its sync method.

func (*CloudListingPool) Snapshot

func (c *CloudListingPool) Snapshot() map[string]interface{}

Snapshot just snapshots the underlying pool.

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) error

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

type InMemoryPool

type InMemoryPool struct {
	cache.ThreadSafeStore
}

InMemoryPool is used as a cache for cluster resource pools.

func NewInMemoryPool

func NewInMemoryPool() *InMemoryPool

NewInMemoryPool creates an InMemoryPool.

func (*InMemoryPool) Snapshot

func (p *InMemoryPool) Snapshot() map[string]interface{}

Snapshot returns a read only copy of the k:v pairs in the store. Caller beware: Violates traditional snapshot guarantees.

type Snapshotter

type Snapshotter interface {
	Snapshot() map[string]interface{}
	cache.ThreadSafeStore
}

Snapshotter is an interface capable of providing a consistent snapshot of the underlying storage implementation of a pool. It does not guarantee thread safety of snapshots, so they should be treated as read only unless the implementation specifies otherwise.

Jump to

Keyboard shortcuts

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