transfer

package
v0.0.0-...-5f9e29a Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreFilteredPodsHealthy

func AreFilteredPodsHealthy(ctx context.Context, 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 IsPodCompleted

func IsPodCompleted(ctx context.Context, c client.Client, podKey client.ObjectKey, containerName string) (bool, error)

IsPodCompleted is a utility function that can be used by various implementations to check if the server pod deployed is completed. if containerName is empty string then it will check for completion of all the containers

func IsPodHealthy

func IsPodHealthy(ctx context.Context, 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

func NamespaceHashForNames

func NamespaceHashForNames(pvcs PVCList) map[string]string

NamespaceHashForNames takes PVCList and returns a map with a unique md5 hash for each namespace based on the members in PVCList for that namespace.

Types

type Client

type Client interface {
	// Transport returns the transport used by the transfer
	Transport() transport.Transport
	// PVCs returns the list of PVCs the transfer will migrate
	PVCs() []*corev1.PersistentVolumeClaim
	// IsCompleted returns whether the client is done
	Status(ctx context.Context, c client.Client) (*Status, error)
	// MarkForCleanup adds a key-value label to all the resources to be cleaned up
	MarkForCleanup(ctx context.Context, c client.Client, key, value string) error
}

type CommandOptions

type CommandOptions interface {
	Options() ([]string, error)
}

type Completed

type Completed struct {
	Successful bool
	Failure    bool
	FinishedAt *metav1.Time
}

type PVC

type PVC interface {
	// Claim returns the v1.PersistentVolumeClaim reference this PVC is associated with
	Claim() *corev1.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 PVCList

type PVCList interface {
	Namespaces() []string
	InNamespace(ns string) PVCList
	PVCs() []PVC
}

func NewPVCList

func NewPVCList(pvcs ...*corev1.PersistentVolumeClaim) (PVCList, error)

NewPVCList when given a list of pvcs, returns a managed list

func NewSingletonPVC

func NewSingletonPVC(pvc *corev1.PersistentVolumeClaim) PVCList

type PodOptions

type PodOptions struct {
	// users can pass in the SA for transfer pods to use
	ServiceAccountName string
	// PodSecurityContext determines what GID the rsync process gets
	// In case of shared storage SupplementalGroups is configured to get the gid
	// In case of block storage FSGroup is configured to get the gid
	PodSecurityContext corev1.PodSecurityContext
	// ContainerSecurityContext determines what selinux labels, UID and drop capabilities
	// are required for the containers in rsync transfer pod via SELinuxOptions, RunAsUser and
	// Capabilities fields respectively
	ContainerSecurityContext corev1.SecurityContext
	// NodeName allows pods to be scheduled on a specific node. This is especially required in
	// client pods where the PVC's are bound to a specific regions and the node where the pod runs on
	// has to be in the same region as the PVC to be scheduled and bound.
	NodeName string
	// NodeSelector is a wider net for scheduling the pods on node than NodeName.
	NodeSelector map[string]string
	// Resources allows for configuring the resources consumed by the transfer pods. In general
	// it is good to provision destination transfer pod with same or larger resources than the source
	// so that the network is not congested.
	Resources corev1.ResourceRequirements
	// Image allows specifying an alternate image for transfers
	Image string
	// TerminateOnCompletion determines whether transfer containers will terminate after transfer is complete
	TerminateOnCompletion *bool
	// CommandOptions allow configuring the additional options that are passed to entrypoint commands
	// of transfer containers.
	CommandOptions
}

PodOptions allow callers to pass custom configuration for the transfer pods

type Running

type Running struct {
	StartedAt *metav1.Time
}

type Server

type Server interface {
	// Endpoint returns the endpoint used by the transfer
	Endpoint() endpoint.Endpoint
	// Transport returns the transport used by the transfer
	Transport() transport.Transport
	// ListenPort returns the port on which transfer server pod is listening on
	ListenPort() int32
	// IsHealthy returns whether or not all Kube resources used by endpoint are healthy
	IsHealthy(ctx context.Context, c client.Client) (bool, error)
	// Completed returns whether or not the current attempt of transfer is completed
	Completed(ctx context.Context, c client.Client) (bool, error)
	// PVCs returns the list of PVCs the transfer will migrate
	PVCs() []*corev1.PersistentVolumeClaim
	// MarkForCleanup add the required labels to all the resources for
	// cleaning up
	MarkForCleanup(ctx context.Context, c client.Client, key, value string) error
}

Transfer knows how to transfer PV data from a source to a destination Server creates an rsync server on the destination

type Status

type Status struct {
	Running   *Running
	Completed *Completed
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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