transfer

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreFilteredPodsHealthy

func AreFilteredPodsHealthy(c client.Client, namespace string, labels fields.Set) (bool, error)

AreFilteredPodsHealthy is a utility function that can be used by various implementations to check if the server pods deployed with some label selectors are healthy. If atleast 1 replica will be healthy the function will return true

func ConnectionHostname

func ConnectionHostname(t Transfer) string

func ConnectionPort

func ConnectionPort(t Transfer) int32

func CreateClient

func CreateClient(t Transfer) error

func CreateServer

func CreateServer(t Transfer) error

func DeleteClient

func DeleteClient(t Transfer) error

func DeleteServer

func DeleteServer(t Transfer) error

func IsPodHealthy

func IsPodHealthy(c client.Client, pod client.ObjectKey) (bool, error)

IsPodHealthy is a utility function that can be used by various implementations to check if the server pod deployed is healthy

Types

type PVC

type PVC interface {
	// Claim returns the v1.PersistentVolumeClaim reference this PVC is associated with
	Claim() *v1.PersistentVolumeClaim
	// LabelSafeName returns a name for the PVC that can be used as a label value
	// it may be validated differently by different transfers
	LabelSafeName() string
}

PVC knows how to return v1.PersistentVolumeClaim and an additional validated name which can be used by different transfers as per their own requirements

type PVCPair

type PVCPair interface {
	// Source returns PVC representing source PersistentVolumeClaim
	Source() PVC
	// Destination returns PVC representing destination PersistentVolumeClaim
	Destination() PVC
}

PVCPair knows how to return source and destination PVC objects for a state transfer

func NewPVCPair

NewPVCPair when given references to a source and a destination PersistentVolumeClaim, returns a PVCPair to be used in transfers

type PVCPairList

type PVCPairList []PVCPair

PVCPairList defines a managed list of PVCPair

func NewPVCPairList

func NewPVCPairList(pvcs ...PVCPair) (PVCPairList, error)

NewPVCPairList when given a list of PVCPair, returns a managed list

func (PVCPairList) GetDestinationNamespaces

func (p PVCPairList) GetDestinationNamespaces() (namespaces []string)

GetDestinationNamespaces returns all destination namespaces present in the list of pvcs

func (PVCPairList) GetSourceNamespaces

func (p PVCPairList) GetSourceNamespaces() (namespaces []string)

GetSourceNamespaces returns all source namespaces present in the list of pvcs

func (PVCPairList) GetSourcePVC

func (p PVCPairList) GetSourcePVC(nsName types.NamespacedName) *PVCPair

GetSourcePVC returns matching PVC from the managed list

func (PVCPairList) GroupBySourceNamespaces

func (p PVCPairList) GroupBySourceNamespaces() map[string][]PVCPair

GroupBySourceNamespaces returns lists of PVCs indexed by their source namespaces

func (PVCPairList) InDestinationNamespace

func (p PVCPairList) InDestinationNamespace(ns string) []PVCPair

InDestinationNamespace given a destination namespace, returns a list of pvcs that will be migrated to it

func (PVCPairList) InSourceNamespace

func (p PVCPairList) InSourceNamespace(ns string) []PVCPair

InSourceNamespace given a source namspace, returns a list of pvcs belonging to that namespace

type ResourceMetadata

type ResourceMetadata struct {
	Annotations     map[string]string
	Labels          map[string]string
	OwnerReferences []metav1.OwnerReference
}

ResourceMetadata defines any metadata used to create intermediary resources for state transfer

type Transfer

type Transfer interface {
	// Source returns a source client
	Source() *rest.Config
	// Destination returns a destination client
	Destination() *rest.Config
	// Endpoint returns the endpoint used by the transfer
	Endpoint() endpoint.Endpoint
	// Transport returns the transport used by the transfer
	Transport() transport.Transport
	// CreateServer creates a transfer server either on source or the destination
	CreateServer(client.Client) error
	// CreateClient creates a transfer client either on source or the destination
	CreateClient(client.Client) error
	IsServerHealthy(c client.Client) (bool, error)
	// PVCs returns the list of PVCs the transfer will migrate
	PVCs() PVCPairList
}

Transfer knows how to transfer PV data from a source to a destination

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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