persistentstore

package
v19.10.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyNotFoundErr        = "Unable to find key"
	KeyExistsErr          = "Key already exists"
	UnavailableClusterErr = "Unavailable etcd cluster"
	NotSupported          = "Unsupported operation"
)
View Source
const (
	BackendSecretSource = "tridentbackends.trident.netapp.io"
)

Variables

View Source
var (
	//TODO: Change for the later versions of etcd (etcd v3.1.5 doesn't return any error unfound keys but later versions do)
	ErrKeyNotFound = errors.New("etcdserver: key not found")
)

Functions

func IsStatusError

func IsStatusError(err error) bool

func IsStatusNotFoundError

func IsStatusNotFoundError(err error) bool

func MatchKeyNotFoundErr

func MatchKeyNotFoundErr(err error) bool

func MatchUnavailableClusterErr

func MatchUnavailableClusterErr(err error) bool

Types

type CRDClient

type CRDClient interface {
	Client
	HasBackends() (bool, error)
	AddStorageClassPersistent(b *storageclass.Persistent) error
	HasStorageClasses() (bool, error)
	HasVolumes() (bool, error)
	HasVolumeTransactions() (bool, error)
}

type CRDClientV1

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

CRDClientV1 stores persistent state in CRD objects in Kubernetes

func NewCRDClientV1

func NewCRDClientV1(apiServerIP, kubeConfigPath string) (*CRDClientV1, error)

func NewCRDClientV1InCluster

func NewCRDClientV1InCluster() (*CRDClientV1, error)

func (*CRDClientV1) AddBackend

func (k *CRDClientV1) AddBackend(backend *storage.Backend) error

AddBackend accepts a Backend object and persists it in a custom resource with all of its sensitive data redacted and written to a corresponding K8S Secret.

func (*CRDClientV1) AddBackendPersistent

func (k *CRDClientV1) AddBackendPersistent(backendPersistent *storage.BackendPersistent) error

AddBackendPersistent accepts a BackendPersistent object and persists it in a custom resource with all of its sensitive data redacted and written to a corresponding K8S Secret.

func (*CRDClientV1) AddOrUpdateNode

func (k *CRDClientV1) AddOrUpdateNode(node *utils.Node) error

func (*CRDClientV1) AddSnapshot

func (k *CRDClientV1) AddSnapshot(snapshot *storage.Snapshot) error

func (*CRDClientV1) AddStorageClass

func (k *CRDClientV1) AddStorageClass(sc *storageclass.StorageClass) error

func (*CRDClientV1) AddStorageClassPersistent

func (k *CRDClientV1) AddStorageClassPersistent(scp *storageclass.Persistent) error

func (*CRDClientV1) AddVolume

func (k *CRDClientV1) AddVolume(volume *storage.Volume) error

func (*CRDClientV1) AddVolumePersistent

func (k *CRDClientV1) AddVolumePersistent(volume *storage.VolumeExternal) error

AddVolumePersistent saves a volume's persistent state to the persistent store

func (*CRDClientV1) AddVolumeTransaction

func (k *CRDClientV1) AddVolumeTransaction(txn *storage.VolumeTransaction) error

func (*CRDClientV1) DeleteBackend

func (k *CRDClientV1) DeleteBackend(b *storage.Backend) error

DeleteBackend accepts a Backend object and deletes the custom resource from Kubernetes along with its corresponding secret.

func (*CRDClientV1) DeleteBackends

func (k *CRDClientV1) DeleteBackends() error

DeleteBackend deletes all backend custom resources from Kubernetes along with their corresponding secrets.

func (*CRDClientV1) DeleteNode

func (k *CRDClientV1) DeleteNode(n *utils.Node) error

func (*CRDClientV1) DeleteSnapshot

func (k *CRDClientV1) DeleteSnapshot(snapshot *storage.Snapshot) error

func (*CRDClientV1) DeleteSnapshotIgnoreNotFound

func (k *CRDClientV1) DeleteSnapshotIgnoreNotFound(snapshot *storage.Snapshot) error

func (*CRDClientV1) DeleteSnapshots

func (k *CRDClientV1) DeleteSnapshots() error

func (*CRDClientV1) DeleteStorageClass

func (k *CRDClientV1) DeleteStorageClass(sc *storageclass.StorageClass) error

func (*CRDClientV1) DeleteVolume

func (k *CRDClientV1) DeleteVolume(volume *storage.Volume) error

func (*CRDClientV1) DeleteVolumeIgnoreNotFound

func (k *CRDClientV1) DeleteVolumeIgnoreNotFound(volume *storage.Volume) error

func (*CRDClientV1) DeleteVolumeTransaction

func (k *CRDClientV1) DeleteVolumeTransaction(volTxn *storage.VolumeTransaction) error

func (*CRDClientV1) DeleteVolumes

func (k *CRDClientV1) DeleteVolumes() error

func (*CRDClientV1) GetBackend

func (k *CRDClientV1) GetBackend(backendName string) (*storage.BackendPersistent, error)

GetBackend retrieves the list of backends persisted as custom resources, finds the one with the specified backend name, and returns the BackendPersistent form of the object with all of its sensitive fields filled in from the corresponding K8S secret.

func (*CRDClientV1) GetBackends

func (k *CRDClientV1) GetBackends() ([]*storage.BackendPersistent, error)

GetBackends retrieves the list of backends persisted as custom resources and returns them as BackendPersistent objects with all of their sensitive fields filled in from their corresponding K8S secrets.

func (*CRDClientV1) GetConfig

func (k *CRDClientV1) GetConfig() *ClientConfig

func (*CRDClientV1) GetExistingVolumeTransaction

func (k *CRDClientV1) GetExistingVolumeTransaction(
	volTxn *storage.VolumeTransaction,
) (*storage.VolumeTransaction, error)

func (*CRDClientV1) GetNode

func (k *CRDClientV1) GetNode(nName string) (*utils.Node, error)

func (*CRDClientV1) GetNodes

func (k *CRDClientV1) GetNodes() ([]*utils.Node, error)

func (*CRDClientV1) GetSnapshot

func (k *CRDClientV1) GetSnapshot(volumeName, snapshotName string) (*storage.SnapshotPersistent, error)

func (*CRDClientV1) GetSnapshots

func (k *CRDClientV1) GetSnapshots() ([]*storage.SnapshotPersistent, error)

func (*CRDClientV1) GetStorageClass

func (k *CRDClientV1) GetStorageClass(scName string) (*storageclass.Persistent, error)

func (*CRDClientV1) GetStorageClasses

func (k *CRDClientV1) GetStorageClasses() ([]*storageclass.Persistent, error)

func (*CRDClientV1) GetType

func (k *CRDClientV1) GetType() StoreType

func (*CRDClientV1) GetVersion

func (k *CRDClientV1) GetVersion() (*config.PersistentStateVersion, error)

func (*CRDClientV1) GetVolume

func (k *CRDClientV1) GetVolume(volName string) (*storage.VolumeExternal, error)

func (*CRDClientV1) GetVolumeTransactions

func (k *CRDClientV1) GetVolumeTransactions() ([]*storage.VolumeTransaction, error)

func (*CRDClientV1) GetVolumes

func (k *CRDClientV1) GetVolumes() ([]*storage.VolumeExternal, error)

func (*CRDClientV1) HasBackends

func (k *CRDClientV1) HasBackends() (bool, error)

HasBackends returns true if any backend objects have been persisted as custom resources in the current namespace.

func (*CRDClientV1) HasStorageClasses

func (k *CRDClientV1) HasStorageClasses() (bool, error)

func (*CRDClientV1) HasVolumeTransactions

func (k *CRDClientV1) HasVolumeTransactions() (bool, error)

func (*CRDClientV1) HasVolumes

func (k *CRDClientV1) HasVolumes() (bool, error)

func (*CRDClientV1) ReplaceBackendAndUpdateVolumes

func (k *CRDClientV1) ReplaceBackendAndUpdateVolumes(origBackend, newBackend *storage.Backend) error

ReplaceBackendAndUpdateVolumes accepts two backend objects (origBackend and newBackend) and uses the new backend object to replace the original one.

func (*CRDClientV1) SetVersion

func (k *CRDClientV1) SetVersion(version *config.PersistentStateVersion) error

func (*CRDClientV1) Stop

func (k *CRDClientV1) Stop() error

func (*CRDClientV1) UpdateBackend

func (k *CRDClientV1) UpdateBackend(update *storage.Backend) error

UpdateBackend uses a Backend object to update a backend's persistent state

func (*CRDClientV1) UpdateBackendPersistent

func (k *CRDClientV1) UpdateBackendPersistent(update *storage.BackendPersistent) error

UpdateBackendPersistent uses a BackendPersistent object to update a backend's persistent state

func (*CRDClientV1) UpdateVolume

func (k *CRDClientV1) UpdateVolume(update *storage.Volume) error

func (*CRDClientV1) UpdateVolumePersistent

func (k *CRDClientV1) UpdateVolumePersistent(update *storage.VolumeExternal) error

UpdateVolumePersistent updates a volume's persistent state

type CRDDataMigrator

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

func NewCRDDataMigrator

func NewCRDDataMigrator(etcdClient EtcdClient, crdClient CRDClient, dryRun bool, t *EtcdDataTransformer) *CRDDataMigrator

func (*CRDDataMigrator) Run

func (m *CRDDataMigrator) Run() error

func (*CRDDataMigrator) RunPrechecks

func (m *CRDDataMigrator) RunPrechecks() error

type Client

type Client interface {
	GetVersion() (*config.PersistentStateVersion, error)
	SetVersion(version *config.PersistentStateVersion) error
	GetConfig() *ClientConfig
	GetType() StoreType
	Stop() error

	AddBackend(b *storage.Backend) error
	AddBackendPersistent(b *storage.BackendPersistent) error
	GetBackend(backendName string) (*storage.BackendPersistent, error)
	UpdateBackend(b *storage.Backend) error
	UpdateBackendPersistent(b *storage.BackendPersistent) error
	DeleteBackend(backend *storage.Backend) error
	GetBackends() ([]*storage.BackendPersistent, error)
	DeleteBackends() error
	ReplaceBackendAndUpdateVolumes(origBackend, newBackend *storage.Backend) error

	AddVolume(vol *storage.Volume) error
	AddVolumePersistent(vol *storage.VolumeExternal) error
	GetVolume(volName string) (*storage.VolumeExternal, error)
	UpdateVolume(vol *storage.Volume) error
	UpdateVolumePersistent(vol *storage.VolumeExternal) error
	DeleteVolume(vol *storage.Volume) error
	DeleteVolumeIgnoreNotFound(vol *storage.Volume) error
	GetVolumes() ([]*storage.VolumeExternal, error)
	DeleteVolumes() error

	AddVolumeTransaction(volTxn *storage.VolumeTransaction) error
	GetVolumeTransactions() ([]*storage.VolumeTransaction, error)
	GetExistingVolumeTransaction(volTxn *storage.VolumeTransaction) (*storage.VolumeTransaction, error)
	DeleteVolumeTransaction(volTxn *storage.VolumeTransaction) error

	AddStorageClass(sc *storageclass.StorageClass) error
	GetStorageClass(scName string) (*storageclass.Persistent, error)
	GetStorageClasses() ([]*storageclass.Persistent, error)
	DeleteStorageClass(sc *storageclass.StorageClass) error

	AddOrUpdateNode(n *utils.Node) error
	GetNode(nName string) (*utils.Node, error)
	GetNodes() ([]*utils.Node, error)
	DeleteNode(n *utils.Node) error

	AddSnapshot(snapshot *storage.Snapshot) error
	GetSnapshot(volumeName, snapshotName string) (*storage.SnapshotPersistent, error)
	GetSnapshots() ([]*storage.SnapshotPersistent, error)
	DeleteSnapshot(snapshot *storage.Snapshot) error
	DeleteSnapshotIgnoreNotFound(snapshot *storage.Snapshot) error
	DeleteSnapshots() error
}

type ClientConfig

type ClientConfig struct {
	TLSConfig *tls.Config
	// contains filtered or unexported fields
}

type DataMigrator

type DataMigrator struct {
	SourceClient Client
	DestClient   Client
	// contains filtered or unexported fields
}

func NewDataMigrator

func NewDataMigrator(SourceClient, DestClient Client, dryRun bool) *DataMigrator

func (*DataMigrator) Run

func (m *DataMigrator) Run() error

type Error

type Error struct {
	Message string
	Key     string
}

Error is used to turn etcd errors into something that callers can understand without having to import the client library

func NewPersistentStoreError

func NewPersistentStoreError(message, key string) *Error

func (*Error) Error

func (e *Error) Error() string

type EtcdClient

type EtcdClient interface {
	Client
	Create(key, value string) error
	Read(key string) (string, error)
	ReadKeys(keyPrefix string) ([]string, error)
	Update(key, value string) error
	Set(key, value string) error
	Delete(key string) error
	DeleteKeys(keyPrefix string) error
}

type EtcdClientV2

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

func NewEtcdClientV2

func NewEtcdClientV2(endpoints string) (*EtcdClientV2, error)

func NewEtcdClientV2FromConfig

func NewEtcdClientV2FromConfig(etcdConfig *ClientConfig) (*EtcdClientV2, error)

func (*EtcdClientV2) AddBackend

func (p *EtcdClientV2) AddBackend(b *storage.Backend) error

AddBackend saves the minimally required backend state to the persistent store

func (*EtcdClientV2) AddBackendPersistent

func (p *EtcdClientV2) AddBackendPersistent(backend *storage.BackendPersistent) error

func (*EtcdClientV2) AddOrUpdateNode

func (p *EtcdClientV2) AddOrUpdateNode(n *utils.Node) error

AddOrUpdateNode adds a CSI node object to the persistent store

func (*EtcdClientV2) AddSnapshot

func (p *EtcdClientV2) AddSnapshot(snapshot *storage.Snapshot) error

AddSnapshot adds a snapshot's state to the persistent store

func (*EtcdClientV2) AddStorageClass

func (p *EtcdClientV2) AddStorageClass(sc *storageclass.StorageClass) error

func (*EtcdClientV2) AddVolume

func (p *EtcdClientV2) AddVolume(vol *storage.Volume) error

AddVolume saves a volume's state to the persistent store

func (*EtcdClientV2) AddVolumePersistent

func (p *EtcdClientV2) AddVolumePersistent(volume *storage.VolumeExternal) error

AddVolumePersistent saves a volume's persistent state to the persistent store

func (*EtcdClientV2) AddVolumeTransaction

func (p *EtcdClientV2) AddVolumeTransaction(volTxn *storage.VolumeTransaction) error

AddVolumeTransaction logs an AddVolume operation

func (*EtcdClientV2) Create

func (p *EtcdClientV2) Create(key, value string) error

Create is the abstract CRUD interface

func (*EtcdClientV2) Delete

func (p *EtcdClientV2) Delete(key string) error

func (*EtcdClientV2) DeleteBackend

func (p *EtcdClientV2) DeleteBackend(backend *storage.Backend) error

DeleteBackend deletes the backend state on the persistent store

func (*EtcdClientV2) DeleteBackends

func (p *EtcdClientV2) DeleteBackends() error

DeleteBackends deletes all backends

func (*EtcdClientV2) DeleteKeys

func (p *EtcdClientV2) DeleteKeys(keyPrefix string) error

DeleteKeys deletes all the keys with the designated prefix

func (*EtcdClientV2) DeleteNode

func (p *EtcdClientV2) DeleteNode(n *utils.Node) error

DeleteNode deletes a node from the persistent store

func (*EtcdClientV2) DeleteSnapshot

func (p *EtcdClientV2) DeleteSnapshot(snapshot *storage.Snapshot) error

DeleteSnapshot deletes a snapshot from the persistent store

func (*EtcdClientV2) DeleteSnapshotIgnoreNotFound

func (p *EtcdClientV2) DeleteSnapshotIgnoreNotFound(snapshot *storage.Snapshot) error

DeleteVolumeIgnoreNotFound deletes a snapshot from the persistent store, returning no error if the record does not exist.

func (*EtcdClientV2) DeleteSnapshots

func (p *EtcdClientV2) DeleteSnapshots() error

DeleteSnapshots deletes all snapshots

func (*EtcdClientV2) DeleteStorageClass

func (p *EtcdClientV2) DeleteStorageClass(sc *storageclass.StorageClass) error

DeleteStorageClass deletes a storage class's state from the persistent store

func (*EtcdClientV2) DeleteVolume

func (p *EtcdClientV2) DeleteVolume(vol *storage.Volume) error

DeleteVolume deletes a volume's state from the persistent store

func (*EtcdClientV2) DeleteVolumeIgnoreNotFound

func (p *EtcdClientV2) DeleteVolumeIgnoreNotFound(vol *storage.Volume) error

func (*EtcdClientV2) DeleteVolumeTransaction

func (p *EtcdClientV2) DeleteVolumeTransaction(volTxn *storage.VolumeTransaction) error

DeleteVolumeTransaction deletes an AddVolume log

func (*EtcdClientV2) DeleteVolumes

func (p *EtcdClientV2) DeleteVolumes() error

DeleteVolumes deletes all volumes

func (*EtcdClientV2) GetBackend

func (p *EtcdClientV2) GetBackend(backendName string) (*storage.BackendPersistent, error)

GetBackend retrieves a backend from the persistent store

func (*EtcdClientV2) GetBackends

func (p *EtcdClientV2) GetBackends() ([]*storage.BackendPersistent, error)

GetBackends retrieves all backends

func (*EtcdClientV2) GetConfig

func (p *EtcdClientV2) GetConfig() *ClientConfig

GetConfig returns the configuration for the etcd client

func (*EtcdClientV2) GetExistingVolumeTransaction

func (p *EtcdClientV2) GetExistingVolumeTransaction(
	volTxn *storage.VolumeTransaction,
) (*storage.VolumeTransaction, error)

GetExistingVolumeTransaction returns an existing version of the current volume transaction, if it exists. If no volume transaction with the same key exists, it returns nil.

func (*EtcdClientV2) GetNode

func (p *EtcdClientV2) GetNode(nName string) (*utils.Node, error)

func (*EtcdClientV2) GetNodes

func (p *EtcdClientV2) GetNodes() ([]*utils.Node, error)

func (*EtcdClientV2) GetSnapshot

func (p *EtcdClientV2) GetSnapshot(volumeName, snapshotName string) (*storage.SnapshotPersistent, error)

GetSnapshot fetches a snapshot's state from the persistent store

func (*EtcdClientV2) GetSnapshots

func (p *EtcdClientV2) GetSnapshots() ([]*storage.SnapshotPersistent, error)

GetSnapshots retrieves all snapshots

func (*EtcdClientV2) GetStorageClass

func (p *EtcdClientV2) GetStorageClass(scName string) (*storageclass.Persistent, error)

func (*EtcdClientV2) GetStorageClasses

func (p *EtcdClientV2) GetStorageClasses() ([]*storageclass.Persistent, error)

func (*EtcdClientV2) GetType

func (p *EtcdClientV2) GetType() StoreType

GetType returns the persistent store type

func (*EtcdClientV2) GetVersion

func (p *EtcdClientV2) GetVersion() (*config.PersistentStateVersion, error)

GetVersion returns the version of the persistent data

func (*EtcdClientV2) GetVolume

func (p *EtcdClientV2) GetVolume(volName string) (*storage.VolumeExternal, error)

GetVolume retrieves a volume's state from the persistent store

func (*EtcdClientV2) GetVolumeTransactions

func (p *EtcdClientV2) GetVolumeTransactions() ([]*storage.VolumeTransaction, error)

GetVolumeTransactions retrieves AddVolume logs

func (*EtcdClientV2) GetVolumes

func (p *EtcdClientV2) GetVolumes() ([]*storage.VolumeExternal, error)

GetVolumes retrieves all volumes

func (*EtcdClientV2) Read

func (p *EtcdClientV2) Read(key string) (string, error)

func (*EtcdClientV2) ReadKeys

func (p *EtcdClientV2) ReadKeys(keyPrefix string) ([]string, error)

ReadKeys returns all the keys with the designated prefix

func (*EtcdClientV2) ReplaceBackendAndUpdateVolumes

func (p *EtcdClientV2) ReplaceBackendAndUpdateVolumes(
	origBackend, newBackend *storage.Backend) error

ReplaceBackendAndUpdateVolumes renames a backend and updates all volumes to reflect the new backend name

func (*EtcdClientV2) Set

func (p *EtcdClientV2) Set(key, value string) error

func (*EtcdClientV2) SetVersion

func (p *EtcdClientV2) SetVersion(version *config.PersistentStateVersion) error

SetVersion sets the version of the persistent data

func (*EtcdClientV2) Stop

func (p *EtcdClientV2) Stop() error

Stop shuts down the etcd client

func (*EtcdClientV2) Update

func (p *EtcdClientV2) Update(key, value string) error

func (*EtcdClientV2) UpdateBackend

func (p *EtcdClientV2) UpdateBackend(b *storage.Backend) error

UpdateBackend updates the backend state on the persistent store

func (*EtcdClientV2) UpdateBackendPersistent

func (p *EtcdClientV2) UpdateBackendPersistent(update *storage.BackendPersistent) error

UpdateBackendPersistent updates a backend's persistent state

func (*EtcdClientV2) UpdateVolume

func (p *EtcdClientV2) UpdateVolume(vol *storage.Volume) error

UpdateVolume updates a volume's state on the persistent store

func (*EtcdClientV2) UpdateVolumePersistent

func (p *EtcdClientV2) UpdateVolumePersistent(volume *storage.VolumeExternal) error

UpdateVolumePersistent updates a volume's persistent state

type EtcdClientV3

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

func NewEtcdClientV3

func NewEtcdClientV3(endpoints string) (*EtcdClientV3, error)

func NewEtcdClientV3FromConfig

func NewEtcdClientV3FromConfig(etcdConfig *ClientConfig) (*EtcdClientV3, error)

func NewEtcdClientV3WithTLS

func NewEtcdClientV3WithTLS(endpoints, etcdV3Cert, etcdV3CACert, etcdV3Key string) (*EtcdClientV3, error)

func (*EtcdClientV3) AddBackend

func (p *EtcdClientV3) AddBackend(b *storage.Backend) error

AddBackend saves the minimally required backend state to the persistent store

func (*EtcdClientV3) AddBackendPersistent

func (p *EtcdClientV3) AddBackendPersistent(backend *storage.BackendPersistent) error

func (*EtcdClientV3) AddBackendSTM

func (p *EtcdClientV3) AddBackendSTM(s conc.STM, b *storage.Backend) error

AddBackendSTM saves the minimally required backend state to the persistent store using STM

func (*EtcdClientV3) AddOrUpdateNode

func (p *EtcdClientV3) AddOrUpdateNode(n *utils.Node) error

AddOrUpdateNode adds/updates a CSI node object to the persistent store

func (*EtcdClientV3) AddSnapshot

func (p *EtcdClientV3) AddSnapshot(snapshot *storage.Snapshot) error

AddSnapshot adds a snapshot's state to the persistent store

func (*EtcdClientV3) AddStorageClass

func (p *EtcdClientV3) AddStorageClass(sc *storageclass.StorageClass) error

func (*EtcdClientV3) AddVolume

func (p *EtcdClientV3) AddVolume(vol *storage.Volume) error

AddVolume saves a volume's state to the persistent store

func (*EtcdClientV3) AddVolumePersistent

func (p *EtcdClientV3) AddVolumePersistent(volExternal *storage.VolumeExternal) error

AddVolumePersistent saves a volume's persistent state to the persistent store

func (*EtcdClientV3) AddVolumeTransaction

func (p *EtcdClientV3) AddVolumeTransaction(volTxn *storage.VolumeTransaction) error

AddVolumeTransaction logs an AddVolume operation

func (*EtcdClientV3) Create

func (p *EtcdClientV3) Create(key, value string) error

Create creates a key in etcd

func (*EtcdClientV3) CreateSTM

func (p *EtcdClientV3) CreateSTM(s conc.STM, key, value string) error

Create creates a key in etcd using STM

func (*EtcdClientV3) Delete

func (p *EtcdClientV3) Delete(key string) error

func (*EtcdClientV3) DeleteBackend

func (p *EtcdClientV3) DeleteBackend(backend *storage.Backend) error

DeleteBackend deletes the backend state on the persistent store

func (*EtcdClientV3) DeleteBackendSTM

func (p *EtcdClientV3) DeleteBackendSTM(s conc.STM, backend *storage.Backend) error

DeleteBackendSTM deletes the backend state on the persistent store using STM

func (*EtcdClientV3) DeleteBackends

func (p *EtcdClientV3) DeleteBackends() error

DeleteBackends deletes all backends

func (*EtcdClientV3) DeleteKeys

func (p *EtcdClientV3) DeleteKeys(keyPrefix string) error

DeleteKeys deletes all the keys with the designated prefix

func (*EtcdClientV3) DeleteNode

func (p *EtcdClientV3) DeleteNode(n *utils.Node) error

DeleteNode deletes a node from the persistent store

func (*EtcdClientV3) DeleteSTM

func (p *EtcdClientV3) DeleteSTM(s conc.STM, key string) error

func (*EtcdClientV3) DeleteSnapshot

func (p *EtcdClientV3) DeleteSnapshot(snapshot *storage.Snapshot) error

DeleteSnapshot deletes a snapshot from the persistent store

func (*EtcdClientV3) DeleteSnapshotIgnoreNotFound

func (p *EtcdClientV3) DeleteSnapshotIgnoreNotFound(snapshot *storage.Snapshot) error

DeleteVolumeIgnoreNotFound deletes a snapshot from the persistent store, returning no error if the record does not exist.

func (*EtcdClientV3) DeleteSnapshots

func (p *EtcdClientV3) DeleteSnapshots() error

DeleteSnapshots deletes all snapshots

func (*EtcdClientV3) DeleteStorageClass

func (p *EtcdClientV3) DeleteStorageClass(sc *storageclass.StorageClass) error

DeleteStorageClass deletes a storage class's state from the persistent store

func (*EtcdClientV3) DeleteVolume

func (p *EtcdClientV3) DeleteVolume(vol *storage.Volume) error

DeleteVolume deletes a volume's state from the persistent store

func (*EtcdClientV3) DeleteVolumeIgnoreNotFound

func (p *EtcdClientV3) DeleteVolumeIgnoreNotFound(vol *storage.Volume) error

func (*EtcdClientV3) DeleteVolumeTransaction

func (p *EtcdClientV3) DeleteVolumeTransaction(volTxn *storage.VolumeTransaction) error

DeleteVolumeTransaction deletes an AddVolume log

func (*EtcdClientV3) DeleteVolumes

func (p *EtcdClientV3) DeleteVolumes() error

DeleteVolumes deletes all volumes

func (*EtcdClientV3) GetBackend

func (p *EtcdClientV3) GetBackend(backendName string) (*storage.BackendPersistent, error)

GetBackend retrieves a backend from the persistent store

func (*EtcdClientV3) GetBackends

func (p *EtcdClientV3) GetBackends() ([]*storage.BackendPersistent, error)

GetBackends retrieves all backends

func (*EtcdClientV3) GetConfig

func (p *EtcdClientV3) GetConfig() *ClientConfig

GetConfig returns the configuration for the etcd client

func (*EtcdClientV3) GetExistingVolumeTransaction

func (p *EtcdClientV3) GetExistingVolumeTransaction(
	volTxn *storage.VolumeTransaction,
) (*storage.VolumeTransaction, error)

GetExistingVolumeTransaction returns an existing version of the current volume transaction, if it exists. If no volume transaction with the same key exists, it returns nil.

func (*EtcdClientV3) GetNode

func (p *EtcdClientV3) GetNode(nName string) (*utils.Node, error)

func (*EtcdClientV3) GetNodes

func (p *EtcdClientV3) GetNodes() ([]*utils.Node, error)

func (*EtcdClientV3) GetSnapshot

func (p *EtcdClientV3) GetSnapshot(volumeName, snapshotName string) (*storage.SnapshotPersistent, error)

GetSnapshot fetches a snapshot's state from the persistent store

func (*EtcdClientV3) GetSnapshots

func (p *EtcdClientV3) GetSnapshots() ([]*storage.SnapshotPersistent, error)

GetSnapshots retrieves all snapshots

func (*EtcdClientV3) GetStorageClass

func (p *EtcdClientV3) GetStorageClass(scName string) (*storageclass.Persistent, error)

func (*EtcdClientV3) GetStorageClasses

func (p *EtcdClientV3) GetStorageClasses() ([]*storageclass.Persistent, error)

func (*EtcdClientV3) GetType

func (p *EtcdClientV3) GetType() StoreType

GetType returns the persistent store type

func (*EtcdClientV3) GetVersion

func (p *EtcdClientV3) GetVersion() (*config.PersistentStateVersion, error)

GetVersion returns the version of the persistent data

func (*EtcdClientV3) GetVolume

func (p *EtcdClientV3) GetVolume(volName string) (*storage.VolumeExternal, error)

GetVolume retrieves a volume's state from the persistent store

func (*EtcdClientV3) GetVolumeSTM

func (p *EtcdClientV3) GetVolumeSTM(s conc.STM, volName string) (*storage.VolumeExternal, error)

GetVolumeSTM retrieves a volume's state from the persistent store using STM

func (*EtcdClientV3) GetVolumeTransactions

func (p *EtcdClientV3) GetVolumeTransactions() ([]*storage.VolumeTransaction, error)

GetVolumeTransactions retrieves AddVolume logs

func (*EtcdClientV3) GetVolumes

func (p *EtcdClientV3) GetVolumes() ([]*storage.VolumeExternal, error)

GetVolumes retrieves all volumes

func (*EtcdClientV3) GetVolumesSTM

func (p *EtcdClientV3) GetVolumesSTM(s conc.STM) ([]*storage.VolumeExternal, error)

GetVolumesSTM retrieves all volumes using STM

func (*EtcdClientV3) Read

func (p *EtcdClientV3) Read(key string) (string, error)

Read reads a key from etcd

func (*EtcdClientV3) ReadKeys

func (p *EtcdClientV3) ReadKeys(keyPrefix string) ([]string, error)

ReadKeys returns all the keys with the designated prefix

func (*EtcdClientV3) ReadSTM

func (p *EtcdClientV3) ReadSTM(s conc.STM, key string) (string, error)

Read reads a key from etcd using STM

func (*EtcdClientV3) ReplaceBackendAndUpdateVolumes

func (p *EtcdClientV3) ReplaceBackendAndUpdateVolumes(origBackend, newBackend *storage.Backend) error

ReplaceBackendAndUpdateVolumes replaces a backend and updates all volumes to reflect the new backend.

func (*EtcdClientV3) Set

func (p *EtcdClientV3) Set(key, value string) error

func (*EtcdClientV3) SetSTM

func (p *EtcdClientV3) SetSTM(s conc.STM, key, value string) error

func (*EtcdClientV3) SetVersion

func (p *EtcdClientV3) SetVersion(version *config.PersistentStateVersion) error

SetVersion sets the version of the persistent data

func (*EtcdClientV3) Stop

func (p *EtcdClientV3) Stop() error

Stop shuts down the etcd client

func (*EtcdClientV3) Update

func (p *EtcdClientV3) Update(key, value string) error

func (*EtcdClientV3) UpdateBackend

func (p *EtcdClientV3) UpdateBackend(b *storage.Backend) error

UpdateBackend updates the backend state on the persistent store

func (*EtcdClientV3) UpdateBackendPersistent

func (p *EtcdClientV3) UpdateBackendPersistent(backend *storage.BackendPersistent) error

UpdateBackendPersistent updates a backend's persistent state

func (*EtcdClientV3) UpdateSTM

func (p *EtcdClientV3) UpdateSTM(s conc.STM, key, value string) error

func (*EtcdClientV3) UpdateVolume

func (p *EtcdClientV3) UpdateVolume(vol *storage.Volume) error

UpdateVolume updates a volume's state on the persistent store

func (*EtcdClientV3) UpdateVolumePersistent

func (p *EtcdClientV3) UpdateVolumePersistent(volExternal *storage.VolumeExternal) error

UpdateVolumePersistent updates a volume's persistent state

func (*EtcdClientV3) UpdateVolumeSTM

func (p *EtcdClientV3) UpdateVolumeSTM(s conc.STM, vol *storage.Volume) error

UpdateVolumeSTM updates a volume's state on the persistent store using STM

type EtcdDataMigrator

type EtcdDataMigrator struct {
	SourceClient EtcdClient
	DestClient   EtcdClient
}

func NewEtcdDataMigrator

func NewEtcdDataMigrator(SourceClient, DestClient EtcdClient) *EtcdDataMigrator

func (*EtcdDataMigrator) Start

func (m *EtcdDataMigrator) Start(keyPrefix string, deleteSrc bool) error

func (*EtcdDataMigrator) Stop

func (m *EtcdDataMigrator) Stop() error

type EtcdDataTransformer

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

func NewEtcdDataTransformer

func NewEtcdDataTransformer(etcdClient Client, dryRun, shouldPersist bool) *EtcdDataTransformer

func (*EtcdDataTransformer) Run

func (*EtcdDataTransformer) RunPrechecks

func (m *EtcdDataTransformer) RunPrechecks() error

type EtcdDataTransformerResult

type EtcdDataTransformerResult struct {
	Backends []*storage.BackendPersistent
	Volumes  []*storage.VolumeExternal
}

type InMemoryClient

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

func NewInMemoryClient

func NewInMemoryClient() *InMemoryClient

func (*InMemoryClient) AddBackend

func (c *InMemoryClient) AddBackend(b *storage.Backend) error

func (*InMemoryClient) AddBackendPersistent

func (c *InMemoryClient) AddBackendPersistent(backend *storage.BackendPersistent) error

func (*InMemoryClient) AddOrUpdateNode

func (c *InMemoryClient) AddOrUpdateNode(n *utils.Node) error

func (*InMemoryClient) AddSnapshot

func (c *InMemoryClient) AddSnapshot(snapshot *storage.Snapshot) error

func (*InMemoryClient) AddStorageClass

func (c *InMemoryClient) AddStorageClass(s *sc.StorageClass) error

func (*InMemoryClient) AddVolume

func (c *InMemoryClient) AddVolume(vol *storage.Volume) error

func (*InMemoryClient) AddVolumePersistent

func (c *InMemoryClient) AddVolumePersistent(volume *storage.VolumeExternal) error

AddVolumePersistent saves a volume's persistent state to the persistent store

func (*InMemoryClient) AddVolumeTransaction

func (c *InMemoryClient) AddVolumeTransaction(volTxn *storage.VolumeTransaction) error

func (*InMemoryClient) DeleteBackend

func (c *InMemoryClient) DeleteBackend(b *storage.Backend) error

func (*InMemoryClient) DeleteBackends

func (c *InMemoryClient) DeleteBackends() error

func (*InMemoryClient) DeleteNode

func (c *InMemoryClient) DeleteNode(n *utils.Node) error

func (*InMemoryClient) DeleteSnapshot

func (c *InMemoryClient) DeleteSnapshot(snapshot *storage.Snapshot) error

DeleteSnapshot deletes a snapshot from the persistent store

func (*InMemoryClient) DeleteSnapshotIgnoreNotFound

func (c *InMemoryClient) DeleteSnapshotIgnoreNotFound(snapshot *storage.Snapshot) error

DeleteVolumeIgnoreNotFound deletes a snapshot from the persistent store, returning no error if the record does not exist.

func (*InMemoryClient) DeleteSnapshots

func (c *InMemoryClient) DeleteSnapshots() error

DeleteSnapshots deletes all snapshots

func (*InMemoryClient) DeleteStorageClass

func (c *InMemoryClient) DeleteStorageClass(s *sc.StorageClass) error

func (*InMemoryClient) DeleteVolume

func (c *InMemoryClient) DeleteVolume(vol *storage.Volume) error

func (*InMemoryClient) DeleteVolumeIgnoreNotFound

func (c *InMemoryClient) DeleteVolumeIgnoreNotFound(vol *storage.Volume) error

func (*InMemoryClient) DeleteVolumeTransaction

func (c *InMemoryClient) DeleteVolumeTransaction(volTxn *storage.VolumeTransaction) error

func (*InMemoryClient) DeleteVolumes

func (c *InMemoryClient) DeleteVolumes() error

func (*InMemoryClient) GetBackend

func (c *InMemoryClient) GetBackend(backendName string) (*storage.BackendPersistent, error)

func (*InMemoryClient) GetBackends

func (c *InMemoryClient) GetBackends() ([]*storage.BackendPersistent, error)

func (*InMemoryClient) GetConfig

func (c *InMemoryClient) GetConfig() *ClientConfig

func (*InMemoryClient) GetExistingVolumeTransaction

func (c *InMemoryClient) GetExistingVolumeTransaction(
	volTxn *storage.VolumeTransaction) (*storage.VolumeTransaction, error,
)

func (*InMemoryClient) GetNode

func (c *InMemoryClient) GetNode(nName string) (*utils.Node, error)

func (*InMemoryClient) GetNodes

func (c *InMemoryClient) GetNodes() ([]*utils.Node, error)

func (*InMemoryClient) GetSnapshot

func (c *InMemoryClient) GetSnapshot(volumeName, snapshotName string) (*storage.SnapshotPersistent, error)

GetSnapshot retrieves a snapshot state from the persistent store

func (*InMemoryClient) GetSnapshots

func (c *InMemoryClient) GetSnapshots() ([]*storage.SnapshotPersistent, error)

GetSnapshots retrieves all snapshots for all volumes

func (*InMemoryClient) GetStorageClass

func (c *InMemoryClient) GetStorageClass(scName string) (
	*sc.Persistent, error,
)

func (*InMemoryClient) GetStorageClasses

func (c *InMemoryClient) GetStorageClasses() (
	[]*sc.Persistent, error,
)

func (*InMemoryClient) GetType

func (c *InMemoryClient) GetType() StoreType

func (*InMemoryClient) GetVersion

func (c *InMemoryClient) GetVersion() (*config.PersistentStateVersion, error)

func (*InMemoryClient) GetVolume

func (c *InMemoryClient) GetVolume(volumeName string) (
	*storage.VolumeExternal, error,
)

func (*InMemoryClient) GetVolumeTransactions

func (c *InMemoryClient) GetVolumeTransactions() ([]*storage.VolumeTransaction, error)

func (*InMemoryClient) GetVolumes

func (c *InMemoryClient) GetVolumes() ([]*storage.VolumeExternal, error)

func (*InMemoryClient) ReplaceBackendAndUpdateVolumes

func (c *InMemoryClient) ReplaceBackendAndUpdateVolumes(
	origBackend, newBackend *storage.Backend) error

ReplaceBackendAndUpdateVolumes renames a backend and updates all volumes to reflect the new backend name

func (*InMemoryClient) SetVersion

func (c *InMemoryClient) SetVersion(version *config.PersistentStateVersion) error

func (*InMemoryClient) Stop

func (c *InMemoryClient) Stop() error

func (*InMemoryClient) UpdateBackend

func (c *InMemoryClient) UpdateBackend(b *storage.Backend) error

func (*InMemoryClient) UpdateBackendPersistent

func (c *InMemoryClient) UpdateBackendPersistent(update *storage.BackendPersistent) error

UpdateBackendPersistent updates a backend's persistent state

func (*InMemoryClient) UpdateVolume

func (c *InMemoryClient) UpdateVolume(vol *storage.Volume) error

func (*InMemoryClient) UpdateVolumePersistent

func (c *InMemoryClient) UpdateVolumePersistent(volume *storage.VolumeExternal) error

UpdateVolumePersistent updates a volume's persistent state

type PassthroughClient

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

func NewPassthroughClient

func NewPassthroughClient(configPath string) (*PassthroughClient, error)

NewPassthroughClient returns a client that satisfies the persistent_store.Client interface, which is used by the orchestrator during bootstrapping. The passthrough store uses the storage as the source of truth, so it doesn't actually store anything. Instead, the store is pre-populated with backend objects from one or more backend config files prior to bootstrapping. The volume info is then read directly from the storage controllers during the bootstrapping process. The passthrough store does not need to persist any objects, including transactions and storage classes, once the orchestrator has started. The passthrough store is primarily useful for the Docker Volume Plugin use case, which doesn't easily support a separate persistence layer and has no support for storage classes.

func (*PassthroughClient) AddBackend

func (c *PassthroughClient) AddBackend(backend *storage.Backend) error

func (*PassthroughClient) AddBackendPersistent

func (c *PassthroughClient) AddBackendPersistent(backend *storage.BackendPersistent) error

func (*PassthroughClient) AddOrUpdateNode

func (c *PassthroughClient) AddOrUpdateNode(n *utils.Node) error

func (*PassthroughClient) AddSnapshot

func (c *PassthroughClient) AddSnapshot(snapshot *storage.Snapshot) error

func (*PassthroughClient) AddStorageClass

func (c *PassthroughClient) AddStorageClass(sc *sc.StorageClass) error

func (*PassthroughClient) AddVolume

func (c *PassthroughClient) AddVolume(vol *storage.Volume) error

func (*PassthroughClient) AddVolumePersistent

func (c *PassthroughClient) AddVolumePersistent(volume *storage.VolumeExternal) error

AddVolumePersistent saves a volume's persistent state to the persistent store

func (*PassthroughClient) AddVolumeTransaction

func (c *PassthroughClient) AddVolumeTransaction(volTxn *storage.VolumeTransaction) error

func (*PassthroughClient) DeleteBackend

func (c *PassthroughClient) DeleteBackend(backend *storage.Backend) error

func (*PassthroughClient) DeleteBackends

func (c *PassthroughClient) DeleteBackends() error

func (*PassthroughClient) DeleteNode

func (c *PassthroughClient) DeleteNode(n *utils.Node) error

func (*PassthroughClient) DeleteSnapshot

func (c *PassthroughClient) DeleteSnapshot(snapshot *storage.Snapshot) error

func (*PassthroughClient) DeleteSnapshotIgnoreNotFound

func (c *PassthroughClient) DeleteSnapshotIgnoreNotFound(snapshot *storage.Snapshot) error

func (*PassthroughClient) DeleteSnapshots

func (c *PassthroughClient) DeleteSnapshots() error

func (*PassthroughClient) DeleteStorageClass

func (c *PassthroughClient) DeleteStorageClass(sc *sc.StorageClass) error

func (*PassthroughClient) DeleteVolume

func (c *PassthroughClient) DeleteVolume(vol *storage.Volume) error

func (*PassthroughClient) DeleteVolumeIgnoreNotFound

func (c *PassthroughClient) DeleteVolumeIgnoreNotFound(vol *storage.Volume) error

func (*PassthroughClient) DeleteVolumeTransaction

func (c *PassthroughClient) DeleteVolumeTransaction(volTxn *storage.VolumeTransaction) error

func (*PassthroughClient) DeleteVolumes

func (c *PassthroughClient) DeleteVolumes() error

func (*PassthroughClient) GetBackend

func (c *PassthroughClient) GetBackend(backendName string) (*storage.BackendPersistent, error)

func (*PassthroughClient) GetBackends

func (c *PassthroughClient) GetBackends() ([]*storage.BackendPersistent, error)

GetBackends is called by the orchestrator during bootstrapping, so the passthrough store returns the persistent backend objects it read from config files.

func (*PassthroughClient) GetConfig

func (c *PassthroughClient) GetConfig() *ClientConfig

func (*PassthroughClient) GetExistingVolumeTransaction

func (c *PassthroughClient) GetExistingVolumeTransaction(volTxn *storage.VolumeTransaction) (*storage.VolumeTransaction, error)

func (*PassthroughClient) GetNode

func (c *PassthroughClient) GetNode(nName string) (*utils.Node, error)

func (*PassthroughClient) GetNodes

func (c *PassthroughClient) GetNodes() ([]*utils.Node, error)

func (*PassthroughClient) GetSnapshot

func (c *PassthroughClient) GetSnapshot(volumeName, snapshotName string) (*storage.SnapshotPersistent, error)

func (*PassthroughClient) GetSnapshots

func (c *PassthroughClient) GetSnapshots() ([]*storage.SnapshotPersistent, error)

GetSnapshots retrieves all snapshots

func (*PassthroughClient) GetStorageClass

func (c *PassthroughClient) GetStorageClass(scName string) (*sc.Persistent, error)

func (*PassthroughClient) GetStorageClasses

func (c *PassthroughClient) GetStorageClasses() ([]*sc.Persistent, error)

func (*PassthroughClient) GetType

func (c *PassthroughClient) GetType() StoreType

func (*PassthroughClient) GetVersion

func (*PassthroughClient) GetVolume

func (c *PassthroughClient) GetVolume(volName string) (*storage.VolumeExternal, error)

GetVolume is not called by the orchestrator, which caches all volumes in memory after bootstrapping. So this method need not do anything.

func (*PassthroughClient) GetVolumeTransactions

func (c *PassthroughClient) GetVolumeTransactions() ([]*storage.VolumeTransaction, error)

func (*PassthroughClient) GetVolumes

func (c *PassthroughClient) GetVolumes() ([]*storage.VolumeExternal, error)

GetVolumes gets up-to-date volume info from each storage backend. To increase efficiency, it contacts each backend in a separate goroutine. Because multiple backends may be managed by the orchestrator, the passthrough layer should remain as responsive as possible even if a backend is unavailable or returns an error during volume discovery.

func (*PassthroughClient) ReplaceBackendAndUpdateVolumes

func (c *PassthroughClient) ReplaceBackendAndUpdateVolumes(
	origBackend, newBackend *storage.Backend) error

ReplaceBackendAndUpdateVolumes renames a backend and updates all volumes to reflect the new backend name

func (*PassthroughClient) SetVersion

func (c *PassthroughClient) SetVersion(version *config.PersistentStateVersion) error

func (*PassthroughClient) Stop

func (c *PassthroughClient) Stop() error

func (*PassthroughClient) UpdateBackend

func (c *PassthroughClient) UpdateBackend(backend *storage.Backend) error

func (*PassthroughClient) UpdateBackendPersistent

func (c *PassthroughClient) UpdateBackendPersistent(update *storage.BackendPersistent) error

UpdateBackendPersistent updates a backend's persistent state

func (*PassthroughClient) UpdateVolume

func (c *PassthroughClient) UpdateVolume(vol *storage.Volume) error

func (*PassthroughClient) UpdateVolumePersistent

func (c *PassthroughClient) UpdateVolumePersistent(volume *storage.VolumeExternal) error

UpdateVolumePersistent updates a volume's persistent state

type StoreType

type StoreType string
const (
	MemoryStore      StoreType = "memory"
	EtcdV2Store      StoreType = "etcdv2"
	EtcdV3Store      StoreType = "etcdv3"
	EtcdV3bStore     StoreType = "etcdv3b"
	PassthroughStore StoreType = "passthrough"
	CRDV1Store       StoreType = "crdv1"
)

Directories

Path Synopsis
crd
apis/netapp/v1
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/netapp/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/netapp/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

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