directvolumemigration

package
v0.0.0-...-25f5b1c Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TRANSFER_POD_CPU_LIMIT       = "TRANSFER_POD_CPU_LIMIT"
	TRANSFER_POD_MEMORY_LIMIT    = "TRANSFER_POD_MEMORY_LIMIT"
	TRANSFER_POD_CPU_REQUESTS    = "TRANSFER_POD_CPU_REQUEST"
	TRANSFER_POD_MEMORY_REQUESTS = "TRANSFER_POD_MEMORY_REQUEST"
	CLIENT_POD_CPU_LIMIT         = "CLIENT_POD_CPU_LIMIT"
	CLIENT_POD_MEMORY_LIMIT      = "CLIENT_POD_MEMORY_LIMIT"
	CLIENT_POD_CPU_REQUESTS      = "CLIENT_POD_CPU_REQUEST"
	CLIENT_POD_MEMORY_REQUESTS   = "CLIENT_POD_MEMORY_REQUEST"
)
View Source
const (
	// DefaultStunnelTimout is when stunnel timesout on establishing connection from source to destination.
	//  When this timeout is reached, the rsync client will still see "connection reset by peer". It is a red-herring
	// it does not conclusively mean the destination rsyncd is unhealthy but stunnel is dropping this in between
	DefaultStunnelTimeout = 20
	// DefaultRsyncBackOffLimit defines default limit on number of retries on Rsync Pods
	DefaultRsyncBackOffLimit = 20
	// DefaultRsyncOperationConcurrency defines number of Rsync operations that can be processed concurrently
	DefaultRsyncOperationConcurrency = 5
	// PendingPodWarningTimeLimit time threshold for Rsync Pods in Pending state to show warning
	PendingPodWarningTimeLimit = 10 * time.Minute
	// SuperPrivilegedContainerType is the selinux SPC type string
	SuperPrivilegedContainerType = "spc_t"
)
View Source
const (
	Created                                     = ""
	Started                                     = "Started"
	Prepare                                     = "Prepare"
	CleanStaleRsyncResources                    = "CleanStaleRsyncResources"
	CreateDestinationNamespaces                 = "CreateDestinationNamespaces"
	DestinationNamespacesCreated                = "DestinationNamespacesCreated"
	CreateDestinationPVCs                       = "CreateDestinationPVCs"
	DestinationPVCsCreated                      = "DestinationPVCsCreated"
	CreateStunnelConfig                         = "CreateStunnelConfig"
	CreateRsyncConfig                           = "CreateRsyncConfig"
	CreateRsyncRoute                            = "CreateRsyncRoute"
	EnsureRsyncRouteAdmitted                    = "EnsureRsyncRouteAdmitted"
	CreateRsyncTransferPods                     = "CreateRsyncTransferPods"
	WaitForRsyncTransferPodsRunning             = "WaitForRsyncTransferPodsRunning"
	CreatePVProgressCRs                         = "CreatePVProgressCRs"
	RunRsyncOperations                          = "RunRsyncOperations"
	DeleteRsyncResources                        = "DeleteRsyncResources"
	WaitForRsyncResourcesTerminated             = "WaitForRsyncResourcesTerminated"
	WaitForStaleRsyncResourcesTerminated        = "WaitForStaleRsyncResourcesTerminated"
	Completed                                   = "Completed"
	MigrationFailed                             = "MigrationFailed"
	DeleteStaleVirtualMachineInstanceMigrations = "DeleteStaleVirtualMachineInstanceMigrations"
)

Phases

View Source
const (
	DirectVolumeMigration                        = "directvolumemigration"
	DirectVolumeMigrationRsyncTransfer           = "directvolumemigration-rsync-transfer"
	DirectVolumeMigrationRsyncTransferBlock      = "directvolumemigration-rsync-transfer-block"
	DirectVolumeMigrationRsyncConfig             = "directvolumemigration-rsync-config"
	DirectVolumeMigrationRsyncCreds              = "directvolumemigration-rsync-creds"
	DirectVolumeMigrationRsyncTransferSvc        = "directvolumemigration-rsync-transfer-svc"
	DirectVolumeMigrationRsyncTransferSvcBlock   = "directvolumemigration-rsync-transfer-svc-block"
	DirectVolumeMigrationRsyncTransferRoute      = "dvm"
	DirectVolumeMigrationRsyncTransferRouteBlock = "dvm-block"
	DirectVolumeMigrationStunnelConfig           = "crane2-stunnel-config"
	DirectVolumeMigrationStunnelCerts            = "crane2-stunnel-secret"
	DirectVolumeMigrationRsyncPass               = "directvolumemigration-rsync-pass"
	DirectVolumeMigrationStunnelTransfer         = "directvolumemigration-stunnel-transfer"
	DirectVolumeMigrationRsync                   = "rsync"
	DirectVolumeMigrationRsyncClient             = "rsync-client"
	DirectVolumeMigrationStunnel                 = "stunnel"
	MigratedByDirectVolumeMigration              = "migration.openshift.io/migrated-by-directvolumemigration" // (dvm UID)
	MigrationSourceFor                           = "migration.openshift.io/source-for-directvolumemigration"  // (dvm UID)
)

labels

View Source
const (
	VolumeMigrationItinerary         = "VolumeMigration"
	VolumeMigrationFailedItinerary   = "VolumeMigrationFailed"
	VolumeMigrationRollbackItinerary = "VolumeMigrationRollback"
)

Itinerary names

View Source
const (
	InvalidSourceClusterRef         = "InvalidSourceClusterRef"
	InvalidDestinationClusterRef    = "InvalidDestinationClusterRef"
	InvalidSourceCluster            = "InvalidSourceCluster"
	InvalidDestinationCluster       = "InvalidDestinationCluster"
	InvalidPVCs                     = "InvalidPVCs"
	SourceClusterNotReady           = "SourceClusterNotReady"
	DestinationClusterNotReady      = "DestinationClusterNotReady"
	PVCsNotFoundOnSourceCluster     = "PodsNotFoundOnSourceCluster"
	StunnelClientPodsPending        = "StunnelClientPodsPending"
	RsyncTransferPodsPending        = "RsyncTransferPodsPending"
	RsyncRouteNotAdmitted           = "RsyncRouteNotAdmitted"
	Running                         = "Running"
	Failed                          = "Failed"
	RsyncClientPodsPending          = "RsyncClientPodsPending"
	LiveMigrationsPending           = "LiveMigrationsPending"
	Succeeded                       = "Succeeded"
	SourceToDestinationNetworkError = "SourceToDestinationNetworkError"
	FailedCreatingRsyncPods         = "FailedCreatingRsyncPods"
	FailedDeletingRsyncPods         = "FailedDeletingRsyncPods"
	RsyncServerPodsRunningAsNonRoot = "RsyncServerPodsRunningAsNonRoot"
)

Types

View Source
const (
	NotFound           = "NotFound"
	NotSet             = "NotSet"
	NotDistinct        = "NotDistinct"
	NotReady           = "NotReady"
	RsyncTimeout       = "RsyncTimedOut"
	RsyncNoRouteToHost = "RsyncNoRouteToHost"
	NotSupported       = "NotSupported"
)

Reasons

View Source
const (
	ReadyMessage                              = "Direct migration is ready"
	RunningMessage                            = "Step: %d/%d"
	InvalidSourceClusterReferenceMessage      = "The source cluster reference is invalid"
	InvalidDestinationClusterReferenceMessage = "The destination cluster reference is invalid"
	InvalidSourceClusterMessage               = "The source cluster is invalid"
	InvalidDestinationClusterMessage          = "The destination cluster is invalid"
	InvalidPVCsMessage                        = "The set of persistent volume claims is invalid"
	SourceClusterNotReadyMessage              = "The source cluster is not ready"
	DestinationClusterNotReadyMessage         = "The destination cluster is not ready"
	PVCsNotFoundOnSourceClusterMessage        = "The set of pvcs were not found on source cluster"
	SucceededMessage                          = "The migration has succeeded"
	FailedMessage                             = "The migration has failed.  See: Errors."
)

Messages

View Source
const (
	Critical = migapi.Critical
	Advisory = migapi.Advisory
	Warn     = migapi.Warn
)

Categories

View Source
const (
	True  = migapi.True
	False = migapi.False
)

Statuses

View Source
const (
	// RsyncAttemptLabel is used to associate an Rsync Pod with the attempts
	RsyncAttemptLabel = "migration.openshift.io/rsync-attempt"
)

labels

View Source
const (
	VMIKind = "VirtualMachineInstance"
)

Variables

View Source
var (
	ErrVolumesDoNotMatch    = errors.New("volumes do not match")
	ErrNamespacesDoNotMatch = errors.New("source and target namespaces must match")
)
View Source
var FailedItinerary = Itinerary{
	Name: VolumeMigrationFailedItinerary,
	Steps: []Step{
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
	},
}
View Source
var FastReQ = time.Duration(time.Millisecond * 100)

Requeue

View Source
var NoReQ = time.Duration(0)
View Source
var PollReQ = time.Duration(time.Second * 3)
View Source
var RollbackItinerary = Itinerary{
	Name: VolumeMigrationRollbackItinerary,
	Steps: []Step{
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
	},
}
View Source
var VolumeMigration = Itinerary{
	Name: VolumeMigrationItinerary,
	Steps: []Step{
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
		{/* contains filtered or unexported fields */},
	},
}

Functions

func Add

func Add(mgr manager.Manager) error

Add creates a new DirectVolumeMigration Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller and Start it when the Manager is Started.

func AddFinalizer

func AddFinalizer(obj metav1.Object, name string)

AddFinalizer adds a finalizer to a resource

func CreateNewDataVolume

func CreateNewDataVolume(client k8sclient.Client, sourceDvName, targetDvName, ns string, log logr.Logger) error

func GetRsyncPodBackOffLimit

func GetRsyncPodBackOffLimit(dvm *migapi.DirectVolumeMigration) int

func GetRsyncPodSelector

func GetRsyncPodSelector(pvcName string) map[string]string

GetRsyncPodSelector returns pod selector used to identify sibling Rsync pods

func HasFinalizer

func HasFinalizer(object metav1.Object, value string) bool

HasFinalizer returns true if a resource has a specific finalizer

func RemoveFinalizer

func RemoveFinalizer(obj metav1.Object, name string)

RemoveFinalizer removes a finalizer from a resource

func Union

func Union(m1 map[string]string, m2 map[string]string) map[string]string

Types

type ExtraOpts

type ExtraOpts []string

func (ExtraOpts) ApplyTo

func (e ExtraOpts) ApplyTo(opts *rsynctransfer.TransferOptions) error
type HardLinks bool

func (HardLinks) ApplyTo

func (h HardLinks) ApplyTo(opts *rsynctransfer.TransferOptions) error

type Itinerary

type Itinerary struct {
	Name  string
	Steps []Step
}

type Partial

type Partial bool

func (Partial) ApplyTo

func (p Partial) ApplyTo(opts *rsynctransfer.TransferOptions) error

type ReconcileDirectVolumeMigration

type ReconcileDirectVolumeMigration struct {
	*rest.Config
	client.Client
	// contains filtered or unexported fields
}

ReconcileDirectVolumeMigration reconciles a DirectVolumeMigration object

func (*ReconcileDirectVolumeMigration) Reconcile

Reconcile reads that state of the cluster for a DirectVolumeMigration object and makes changes based on the state read and what is in the DirectVolumeMigration.Spec a Deployment as an example Automatically generate RBAC rules to allow the Controller to read and write Deployments +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=apps,resources=deployments/status,verbs=get;update;patch +kubebuilder:rbac:groups=migration.openshift.io,resources=directvolumemigrations,verbs=get;list;watch;create;update;patch;delete; +kubebuilder:rbac:groups=migration.openshift.io,resources=directvolumemigrations/status,verbs=get;update;patch

type RsyncBwLimit

type RsyncBwLimit int

func (RsyncBwLimit) ApplyTo

type Step

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

Step

type Task

type Task struct {
	Log           logr.Logger
	Client        k8sclient.Client
	PrometheusAPI prometheusv1.API

	Owner                        *migapi.DirectVolumeMigration
	SSHKeys                      *sshKeys
	EndpointType                 migapi.EndpointType
	RsyncRoutes                  map[string]string
	Phase                        string
	PhaseDescription             string
	PlanResources                *migapi.PlanResources
	Requeue                      time.Duration
	Itinerary                    Itinerary
	Errors                       []string
	SparseFileMap                sparseFilePVCMap
	SourceLimitRangeMapping      limitRangeMap
	DestinationLimitRangeMapping limitRangeMap
	VirtualMachineMappings       VirtualMachineMappings
	PromQuery                    func(ctx context.Context, query string, ts time.Time, opts ...prometheusv1.Option) (model.Value, prometheusv1.Warnings, error)
	Tracer                       opentracing.Tracer
	ReconcileSpan                opentracing.Span
	// contains filtered or unexported fields
}

A task that provides the complete migration workflow. Log - A controller's logger. Client - A controller's (local) client. Owner - A DirectVolumeMigration resource. Phase - The task phase. Requeue - The requeueAfter duration. 0 indicates no requeue. Itinerary - The phase itinerary. Errors - Migration errors. Failed - Task phase has failed.

func (*Task) Run

func (t *Task) Run(ctx context.Context) error

type VirtualMachineMappings

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

Jump to

Keyboard shortcuts

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