migmigration

package
v0.0.0-...-ec8378c Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 56 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MigRegistryAnnotationKey    string = "openshift.io/migration-registry"
	MigRegistryDirAnnotationKey string = "openshift.io/migration-registry-dir"
)

Annotations

View Source
const (
	Created                                = ""
	Started                                = "Started"
	CleanStaleAnnotations                  = "CleanStaleAnnotations"
	CleanStaleVeleroCRs                    = "CleanStaleVeleroCRs"
	CleanStaleResticCRs                    = "CleanStaleResticCRs"
	CleanStaleStagePods                    = "CleanStaleStagePods"
	WaitForStaleStagePodsTerminated        = "WaitForStaleStagePodsTerminated"
	StartRefresh                           = "StartRefresh"
	WaitForRefresh                         = "WaitForRefresh"
	CreateRegistries                       = "CreateRegistries"
	CreateDirectImageMigration             = "CreateDirectImageMigration"
	WaitForDirectImageMigrationToComplete  = "WaitForDirectImageMigrationToComplete"
	EnsureCloudSecretPropagated            = "EnsureCloudSecretPropagated"
	PreBackupHooks                         = "PreBackupHooks"
	PostBackupHooks                        = "PostBackupHooks"
	PreRestoreHooks                        = "PreRestoreHooks"
	PostRestoreHooks                       = "PostRestoreHooks"
	PreBackupHooksFailed                   = "PreBackupHooksFailed"
	PostBackupHooksFailed                  = "PostBackupHooksFailed"
	PreRestoreHooksFailed                  = "PreRestoreHooksFailed"
	PostRestoreHooksFailed                 = "PostRestoreHooksFailed"
	EnsureInitialBackup                    = "EnsureInitialBackup"
	InitialBackupCreated                   = "InitialBackupCreated"
	InitialBackupFailed                    = "InitialBackupFailed"
	AnnotateResources                      = "AnnotateResources"
	EnsureStagePodsFromRunning             = "EnsureStagePodsFromRunning"
	EnsureStagePodsFromTemplates           = "EnsureStagePodsFromTemplates"
	EnsureStagePodsFromOrphanedPVCs        = "EnsureStagePodsFromOrphanedPVCs"
	StagePodsCreated                       = "StagePodsCreated"
	StagePodsFailed                        = "StagePodsFailed"
	SourceStagePodsFailed                  = "SourceStagePodsFailed"
	RestartVelero                          = "RestartVelero"
	WaitForVeleroReady                     = "WaitForVeleroReady"
	RestartRestic                          = "RestartRestic"
	WaitForResticReady                     = "WaitForResticReady"
	QuiesceApplications                    = "QuiesceApplications"
	EnsureQuiesced                         = "EnsureQuiesced"
	UnQuiesceSrcApplications               = "UnQuiesceSrcApplications"
	UnQuiesceDestApplications              = "UnQuiesceDestApplications"
	SwapPVCReferences                      = "SwapPVCReferences"
	WaitForRegistriesReady                 = "WaitForRegistriesReady"
	EnsureStageBackup                      = "EnsureStageBackup"
	StageBackupCreated                     = "StageBackupCreated"
	StageBackupFailed                      = "StageBackupFailed"
	EnsureInitialBackupReplicated          = "EnsureInitialBackupReplicated"
	EnsureStageBackupReplicated            = "EnsureStageBackupReplicated"
	EnsureStageRestore                     = "EnsureStageRestore"
	StageRestoreCreated                    = "StageRestoreCreated"
	StageRestoreFailed                     = "StageRestoreFailed"
	CreateDirectVolumeMigration            = "CreateDirectVolumeMigration"
	WaitForDirectVolumeMigrationToComplete = "WaitForDirectVolumeMigrationToComplete"
	DirectVolumeMigrationFailed            = "DirectVolumeMigrationFailed"
	EnsureFinalRestore                     = "EnsureFinalRestore"
	FinalRestoreCreated                    = "FinalRestoreCreated"
	FinalRestoreFailed                     = "FinalRestoreFailed"
	Verification                           = "Verification"
	EnsureStagePodsDeleted                 = "EnsureStagePodsDeleted"
	EnsureStagePodsTerminated              = "EnsureStagePodsTerminated"
	EnsureAnnotationsDeleted               = "EnsureAnnotationsDeleted"
	EnsureMigratedDeleted                  = "EnsureMigratedDeleted"
	DeleteRegistries                       = "DeleteRegistries"
	DeleteMigrated                         = "DeleteMigrated"
	DeleteBackups                          = "DeleteBackups"
	DeleteRestores                         = "DeleteRestores"
	DeleteHookJobs                         = "DeleteHookJobs"
	DeleteDirectVolumeMigrationResources   = "DeleteDirectVolumeMigrationResources"
	DeleteDirectImageMigrationResources    = "DeleteDirectImageMigrationResources"
	MigrationFailed                        = "MigrationFailed"
	Canceling                              = "Canceling"
	Canceled                               = "Canceled"
	Rollback                               = "Rollback"
	Completed                              = "Completed"
)

Phases

View Source
const (
	Quiesce             = 0x001   // Only when QuiescePods (true).
	HasStagePods        = 0x002   // Only when stage pods created.
	HasPVs              = 0x004   // Only when PVs migrated.
	HasVerify           = 0x008   // Only when the plan has enabled verification
	HasISs              = 0x010   // Only when ISs migrated
	DirectImage         = 0x020   // Only when using direct image migration
	IndirectImage       = 0x040   // Only when using indirect image migration
	DirectVolume        = 0x080   // Only when using direct volume migration
	IndirectVolume      = 0x100   // Only when using indirect volume migration
	HasStageBackup      = 0x200   // True when stage backup is needed
	EnableImage         = 0x400   // True when disable_image_migration is unset
	EnableVolume        = 0x800   // True when disable_volume is unset
	HasPreBackupHooks   = 0x1000  // True when prebackup hooks exist
	HasPostBackupHooks  = 0x2000  // True when postbackup hooks exist
	HasPreRestoreHooks  = 0x4000  // True when postbackup hooks exist
	HasPostRestoreHooks = 0x8000  // True when postbackup hooks exist
	StorageConversion   = 0x10000 // True when the migration is a storage conversion
)

Flags

View Source
const (
	StepPrepare          = "Prepare"
	StepDirectImage      = "DirectImage"
	StepDirectVolume     = "DirectVolume"
	StepBackup           = "Backup"
	StepStageBackup      = "StageBackup"
	StepStageRestore     = "StageRestore"
	StepRestore          = "Restore"
	StepCleanup          = "Cleanup"
	StepCleanupVelero    = "CleanupVelero"
	StepCleanupHelpers   = "CleanupHelpers"
	StepCleanupMigrated  = "CleanupMigrated"
	StepCleanupUnquiesce = "CleanupUnquiesce"
)

Migration steps

View Source
const (
	UnhealthyNamespaces                = "UnhealthyNamespaces"
	InvalidPlanRef                     = "InvalidPlanRef"
	PlanNotReady                       = "PlanNotReady"
	PlanClosed                         = "PlanClosed"
	HasFinalMigration                  = "HasFinalMigration"
	Postponed                          = "Postponed"
	SucceededWithWarnings              = "SucceededWithWarnings"
	ResticErrors                       = "ResticErrors"
	ResticVerifyErrors                 = "ResticVerifyErrors"
	VeleroInitialBackupPartiallyFailed = "VeleroInitialBackupPartiallyFailed"
	VeleroStageBackupPartiallyFailed   = "VeleroStageBackupPartiallyFailed"
	VeleroStageRestorePartiallyFailed  = "VeleroStageRestorePartiallyFailed"
	VeleroFinalRestorePartiallyFailed  = "VeleroFinalRestorePartiallyFailed"
	DirectImageMigrationFailed         = "DirectImageMigrationFailed"
	StageNoOp                          = "StageNoOp"
	RegistriesHealthy                  = "RegistriesHealthy"
	RegistriesUnhealthy                = "RegistriesUnhealthy"
	StaleSrcVeleroCRsDeleted           = "StaleSrcVeleroCRsDeleted"
	StaleDestVeleroCRsDeleted          = "StaleDestVeleroCRsDeleted"
	StaleResticCRsDeleted              = "StaleResticCRsDeleted"
	DirectVolumeMigrationBlocked       = "DirectVolumeMigrationBlocked"
	InvalidSpec                        = "InvalidSpec"
	ConflictingPVCMappings             = "ConflictingPVCMappings"
)

Types

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

Categories

View Source
const (
	NotSet         = "NotSet"
	NotFound       = "NotFound"
	Cancel         = "Cancel"
	ErrorsDetected = "ErrorsDetected"
	NotSupported   = "NotSupported"
	PvNameConflict = "PvNameConflict"
	NotDistinct    = "NotDistinct"
)

Reasons

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

Statuses

View Source
const AnnotationsPerReconcile = 50

Bucket limit for number of items annotated in one Reconcile

View Source
const BackoffLimitExceededError = "BackoffLimitExceeded"
View Source
const HookJobFailedLimit = 6

Variables

View Source
var CancelItinerary = Itinerary{
	Name: "Cancel",
	Phases: []Phase{
		{Name: Canceling, Step: StepCleanupVelero},
		{Name: DeleteBackups, Step: StepCleanupVelero},
		{Name: DeleteRestores, Step: StepCleanupVelero},
		{Name: DeleteRegistries, Step: StepCleanupHelpers},
		{Name: DeleteHookJobs, Step: StepCleanupHelpers},
		{Name: DeleteDirectVolumeMigrationResources, Step: StepCleanupHelpers, /* contains filtered or unexported fields */},
		{Name: DeleteDirectImageMigrationResources, Step: StepCleanupHelpers, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsDeleted, Step: StepCleanupHelpers, /* contains filtered or unexported fields */},
		{Name: EnsureAnnotationsDeleted, Step: StepCleanupHelpers, /* contains filtered or unexported fields */},
		{Name: Canceled, Step: StepCleanup},
		{Name: Completed, Step: StepCleanup},
	},
}
View Source
var FailedItinerary = Itinerary{
	Name: "Failed",
	Phases: []Phase{
		{Name: MigrationFailed, Step: StepCleanupHelpers},
		{Name: DeleteRegistries, Step: StepCleanupHelpers},
		{Name: EnsureAnnotationsDeleted, Step: StepCleanupHelpers, /* contains filtered or unexported fields */},
		{Name: Completed, Step: StepCleanup},
	},
}
View Source
var FastReQ = time.Duration(time.Millisecond * 100)

Requeue

View Source
var FinalItinerary = Itinerary{
	Name: "Final",
	Phases: []Phase{
		{Name: Created, Step: StepPrepare},
		{Name: Started, Step: StepPrepare},
		{Name: StartRefresh, Step: StepPrepare},
		{Name: WaitForRefresh, Step: StepPrepare},
		{Name: CleanStaleAnnotations, Step: StepPrepare},
		{Name: CleanStaleResticCRs, Step: StepPrepare},
		{Name: CleanStaleVeleroCRs, Step: StepPrepare},
		{Name: RestartVelero, Step: StepPrepare},
		{Name: CleanStaleStagePods, Step: StepPrepare},
		{Name: WaitForStaleStagePodsTerminated, Step: StepPrepare},
		{Name: CreateRegistries, Step: StepPrepare, /* contains filtered or unexported fields */},
		{Name: WaitForVeleroReady, Step: StepPrepare},
		{Name: WaitForRegistriesReady, Step: StepPrepare, /* contains filtered or unexported fields */},
		{Name: EnsureCloudSecretPropagated, Step: StepPrepare},
		{Name: PreBackupHooks, Step: PreBackupHooks, /* contains filtered or unexported fields */},
		{Name: CreateDirectImageMigration, Step: StepBackup, /* contains filtered or unexported fields */},
		{Name: EnsureInitialBackup, Step: StepBackup},
		{Name: InitialBackupCreated, Step: StepBackup},
		{Name: QuiesceApplications, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureQuiesced, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsFromRunning, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsFromTemplates, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsFromOrphanedPVCs, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: StagePodsCreated, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: RestartRestic, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: AnnotateResources, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: WaitForResticReady, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: CreateDirectVolumeMigration, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStageBackup, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: StageBackupCreated, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStageBackupReplicated, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStageRestore, Step: StepStageRestore, /* contains filtered or unexported fields */},
		{Name: StageRestoreCreated, Step: StepStageRestore, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsDeleted, Step: StepStageRestore, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsTerminated, Step: StepStageRestore, /* contains filtered or unexported fields */},
		{Name: EnsureAnnotationsDeleted, Step: StepStageRestore, /* contains filtered or unexported fields */},
		{Name: WaitForDirectImageMigrationToComplete, Step: StepDirectImage, /* contains filtered or unexported fields */},
		{Name: WaitForDirectVolumeMigrationToComplete, Step: StepDirectVolume, /* contains filtered or unexported fields */},
		{Name: PostBackupHooks, Step: PostBackupHooks, /* contains filtered or unexported fields */},
		{Name: PreRestoreHooks, Step: PreRestoreHooks, /* contains filtered or unexported fields */},
		{Name: EnsureInitialBackupReplicated, Step: StepRestore},
		{Name: EnsureFinalRestore, Step: StepRestore},
		{Name: FinalRestoreCreated, Step: StepRestore},
		{Name: UnQuiesceDestApplications, Step: StepRestore},
		{Name: PostRestoreHooks, Step: PostRestoreHooks, /* contains filtered or unexported fields */},
		{Name: SwapPVCReferences, Step: StepCleanup, /* contains filtered or unexported fields */},
		{Name: DeleteRegistries, Step: StepCleanup},
		{Name: Verification, Step: StepCleanup, /* contains filtered or unexported fields */},
		{Name: Completed, Step: StepCleanup},
	},
}
View Source
var NoReQ = time.Duration(0)
View Source
var PhaseDescriptions = map[string]string{
	Created:                                "Migration created.",
	Started:                                "Migration started.",
	StartRefresh:                           "Starting refresh on MigPlan, MigStorage and MigCluster resources",
	WaitForRefresh:                         "Waiting for refresh of MigPlan, MigStorage and MigCluster resources to complete",
	CleanStaleAnnotations:                  "Removing leftover migration annotations and labels from PVs, PVCs, Pods, ImageStreams, and Namespaces. Annotations and labels provide migration instructions to Velero, Velero Plugins and Restic.",
	CleanStaleResticCRs:                    "Deleting incomplete Restic PodVolumeBackups and PodVolumeRestores created by past migration attempts.",
	CleanStaleVeleroCRs:                    "Deleting incomplete Velero Backups and Restores created by past migration attempts.",
	CleanStaleStagePods:                    "Deleting any leftover stage Pods.",
	WaitForStaleStagePodsTerminated:        "Waiting for leftover stage Pod deletion to finish.",
	CreateRegistries:                       "Creating migration registries on source and target clusters.",
	WaitForRegistriesReady:                 "Waiting for migration registries on source and target clusters to become healthy.",
	DeleteRegistries:                       "Deleting migration registries on source and target clusters.",
	EnsureCloudSecretPropagated:            "Ensuring Velero has latest Replication Repository storage credentials.",
	PreBackupHooks:                         "Waiting for user-defined pre-backup hooks to complete.",
	PostBackupHooks:                        "Waiting for user-defined post-backup hooks to complete.",
	PreRestoreHooks:                        "Waiting for user-defined pre-restore hooks to complete.",
	PostRestoreHooks:                       "Waiting for user-defined post-restore hooks to complete.",
	PreBackupHooksFailed:                   "Migration failed while running user-defined pre-backup hooks.",
	PostBackupHooksFailed:                  "Migration failed while running user-defined post-backup hooks.",
	PreRestoreHooksFailed:                  "Migration failed while running user-defined pre-restore hooks.",
	PostRestoreHooksFailed:                 "Migration failed while running user-defined post-restore hooks.",
	EnsureInitialBackup:                    "Creating initial Velero backup.",
	InitialBackupCreated:                   "Waiting for initial Velero backup to complete.",
	InitialBackupFailed:                    "Migration failed during initial Velero backup.",
	AnnotateResources:                      "Adding migration annotations and labels to PVs, PVCs, Pods, ImageStreams, and Namespaces. Annotations and labels provide migration instructions to Velero, Velero Plugins and Restic.",
	EnsureStagePodsFromRunning:             "Creating Stage Pods and mounting PVC data from running Pods.",
	EnsureStagePodsFromTemplates:           "Creating Stage Pods and mounting PVC data using Pod templates from DeploymentTemplates, DeploymentConfigs, ReplicationControllers, DaemonSets, StatefulSets, ReplicaSets, CronJobs and Jobs.",
	EnsureStagePodsFromOrphanedPVCs:        "Creating Stage Pods and mounting PVC data from unmounted PVCs.",
	StagePodsCreated:                       "Waiting for all Stage Pods to start.",
	StagePodsFailed:                        "Migration failed due to some Stage Pods failing to start.",
	RestartRestic:                          "Restarting Restic Pods, ensuring latest PVC mounts are available for PVC backups.",
	WaitForResticReady:                     "Waiting for Restic Pods to restart, ensuring latest PVC mounts are available for PVC backups.",
	RestartVelero:                          "Restarting Velero Pods, ensuring work queue is empty.",
	WaitForVeleroReady:                     "Waiting for Velero Pods to restart, ensuring work queue is empty.",
	QuiesceApplications:                    "Quiescing (Scaling to 0 replicas): Deployments, DeploymentConfigs, StatefulSets, ReplicaSets, DaemonSets, CronJobs and Jobs.",
	EnsureQuiesced:                         "Waiting for Quiesce (Scaling to 0 replicas) to finish for Deployments, DeploymentConfigs, StatefulSets, ReplicaSets, DaemonSets, CronJobs and Jobs.",
	UnQuiesceSrcApplications:               "UnQuiescing (Scaling to N replicas) source cluster Deployments, DeploymentConfigs, StatefulSets, ReplicaSets, DaemonSets, CronJobs and Jobs.",
	UnQuiesceDestApplications:              "UnQuiescing (Scaling to N replicas) target cluster Deployments, DeploymentConfigs, StatefulSets, ReplicaSets, DaemonSets, CronJobs and Jobs.",
	EnsureStageBackup:                      "Creating a stage backup.",
	StageBackupCreated:                     "Waiting for stage backup to complete.",
	StageBackupFailed:                      "Migration failed during stage backup.",
	EnsureInitialBackupReplicated:          "Waiting for initial Velero backup replication to target cluster.",
	EnsureStageBackupReplicated:            "Waiting for stage Velero backup replication to target cluster.",
	EnsureStageRestore:                     "Creating a stage Velero restore including OpenShift resources and PVCs.",
	StageRestoreCreated:                    "Waiting for stage Velero restore to complete.",
	StageRestoreFailed:                     "Migration failed during stage Velero restore.",
	EnsureFinalRestore:                     "Creating final Velero restore.",
	FinalRestoreCreated:                    "Waiting for final Velero restore to complete.",
	FinalRestoreFailed:                     "Migration failed during final Velero restore.",
	Verification:                           "Verifying health of migrated Pods.",
	Rollback:                               "Starting rollback",
	CreateDirectImageMigration:             "Creating Direct Image Migration",
	CreateDirectVolumeMigration:            "Creating Direct Volume Migration",
	WaitForDirectImageMigrationToComplete:  "Waiting for Direct Image Migration to complete.",
	WaitForDirectVolumeMigrationToComplete: "Waiting for Direct Volume Migration to complete.",
	EnsureStagePodsDeleted:                 "Deleting any leftover stage Pods.",
	EnsureStagePodsTerminated:              "Waiting for leftover stage Pod deletion to finish.",
	EnsureAnnotationsDeleted:               "Removing migration annotations and labels from PVs, PVCs, Pods, ImageStreams, and Namespaces. Annotations and labels provide migration instructions to Velero, Velero Plugins and Restic.",
	EnsureMigratedDeleted:                  "Rolling back. Waiting for migrated resource deletion.",
	DeleteMigrated:                         "Rolling back. Deleting migrated resources from target cluster.",
	DeleteBackups:                          "Deleting Velero Backups created during migration.",
	DeleteRestores:                         "Deleting Velero Restores created during migration.",
	DeleteHookJobs:                         "Deleting user-defined hook Jobs and Pods created during migration.",
	MigrationFailed:                        "Migration failed.",
	Canceling:                              "Migration cancellation in progress.",
	Canceled:                               "Migration canceled.",
	Completed:                              "Migration completed.",
}

PhaseDescriptions are human readable strings that describe a phase

View Source
var PollReQ = time.Duration(time.Second * 3)
View Source
var RollbackItinerary = Itinerary{
	Name: "Rollback",
	Phases: []Phase{
		{Name: Rollback, Step: StepCleanupVelero},
		{Name: DeleteBackups, Step: StepCleanupVelero},
		{Name: DeleteRestores, Step: StepCleanupVelero},
		{Name: DeleteRegistries, Step: StepCleanupHelpers},
		{Name: EnsureStagePodsDeleted, Step: StepCleanupHelpers},
		{Name: EnsureAnnotationsDeleted, Step: StepCleanupHelpers, /* contains filtered or unexported fields */},
		{Name: SwapPVCReferences, Step: StepCleanupMigrated, /* contains filtered or unexported fields */},
		{Name: DeleteMigrated, Step: StepCleanupMigrated},
		{Name: EnsureMigratedDeleted, Step: StepCleanupMigrated},
		{Name: UnQuiesceSrcApplications, Step: StepCleanupUnquiesce},
		{Name: Completed, Step: StepCleanup},
	},
}
View Source
var Settings = &settings.Settings
View Source
var StageItinerary = Itinerary{
	Name: "Stage",
	Phases: []Phase{
		{Name: Created, Step: StepPrepare},
		{Name: Started, Step: StepPrepare},
		{Name: StartRefresh, Step: StepPrepare},
		{Name: WaitForRefresh, Step: StepPrepare},
		{Name: CleanStaleAnnotations, Step: StepPrepare},
		{Name: CleanStaleResticCRs, Step: StepPrepare},
		{Name: CleanStaleVeleroCRs, Step: StepPrepare},
		{Name: RestartVelero, Step: StepPrepare},
		{Name: CleanStaleStagePods, Step: StepPrepare},
		{Name: WaitForStaleStagePodsTerminated, Step: StepPrepare},
		{Name: CreateRegistries, Step: StepPrepare, /* contains filtered or unexported fields */},
		{Name: CreateDirectImageMigration, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: QuiesceApplications, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureQuiesced, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: CreateDirectVolumeMigration, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsFromRunning, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsFromTemplates, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsFromOrphanedPVCs, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: StagePodsCreated, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: RestartRestic, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: AnnotateResources, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: WaitForVeleroReady, Step: StepStageBackup},
		{Name: WaitForResticReady, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: WaitForRegistriesReady, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureCloudSecretPropagated, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStageBackup, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: StageBackupCreated, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStageBackupReplicated, Step: StepStageBackup, /* contains filtered or unexported fields */},
		{Name: EnsureStageRestore, Step: StepStageRestore, /* contains filtered or unexported fields */},
		{Name: StageRestoreCreated, Step: StepStageRestore, /* contains filtered or unexported fields */},
		{Name: WaitForDirectImageMigrationToComplete, Step: StepDirectImage, /* contains filtered or unexported fields */},
		{Name: WaitForDirectVolumeMigrationToComplete, Step: StepDirectVolume, /* contains filtered or unexported fields */},
		{Name: SwapPVCReferences, Step: StepCleanup, /* contains filtered or unexported fields */},
		{Name: DeleteRegistries, Step: StepCleanup},
		{Name: EnsureStagePodsDeleted, Step: StepCleanup, /* contains filtered or unexported fields */},
		{Name: EnsureStagePodsTerminated, Step: StepCleanup, /* contains filtered or unexported fields */},
		{Name: EnsureAnnotationsDeleted, Step: StepCleanup, /* contains filtered or unexported fields */},
		{Name: Completed, Step: StepCleanup},
	},
}

Functions

func Add

func Add(mgr manager.Manager) error

Add creates a new MigMigration 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 GetApplicationPodsWithStageLabels

func GetApplicationPodsWithStageLabels(labels map[string]string, pvcMapping map[k8sclient.ObjectKey]migapi.PV, list *[]corev1.Pod) []corev1.Pod

get the running application pods with attached PVC

Types

type Itinerary

type Itinerary struct {
	Name   string
	Phases []Phase
}

Itinerary defines itinerary

func (*Itinerary) GetStepForPhase

func (r *Itinerary) GetStepForPhase(phaseName string) string

GetStepForPhase returns which high level step current phase belongs to

type MigrationPredicate

type MigrationPredicate struct {
	predicate.Funcs
	Namespace string
}

func (MigrationPredicate) Create

func (MigrationPredicate) Delete

func (MigrationPredicate) Update

type Phase

type Phase struct {
	// A phase name.
	Name string
	// High level Step this phase belongs to
	Step string
	// contains filtered or unexported fields
}

Phase defines phase in the migration

type PlanPredicate

type PlanPredicate struct {
	predicate.Funcs
	Namespace string
}

func (PlanPredicate) Create

func (r PlanPredicate) Create(e event.CreateEvent) bool

func (PlanPredicate) Update

func (r PlanPredicate) Update(e event.UpdateEvent) bool

type PodStartReport

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

Stage pod start report.

type ReconcileMigMigration

type ReconcileMigMigration struct {
	client.Client
	record.EventRecorder
	// contains filtered or unexported fields
}

ReconcileMigMigration reconciles a MigMigration object

func (*ReconcileMigMigration) Reconcile

Reconcile performs Migrations based on the data in MigMigration

type ServiceAccounts

type ServiceAccounts map[string]map[string]bool

Set of Service Accounts. Keyed by namespace (name) with value of map keyed by SA name.

type StagePod

type StagePod struct {
	corev1.Pod
}

StagePod - wrapper for stage pod, allowing to compare two stage pods for equality

type StagePodList

type StagePodList []StagePod

StagePodList - a list of stage pods, with built-in stage pod deduplication

func BuildStagePods

func BuildStagePods(labels map[string]string,
	pvcMapping map[k8sclient.ObjectKey]migapi.PV,
	list *[]corev1.Pod, stagePodImage string,
	resourceLimitMapping map[string]map[string]resource.Quantity) StagePodList

BuildStagePods - creates a list of stage pods from a list of pods

type Task

type Task struct {
	Log             logr.Logger
	Client          k8sclient.Client
	Owner           *migapi.MigMigration
	PlanResources   *migapi.PlanResources
	Annotations     map[string]string
	BackupResources mapset.Set
	Phase           string
	Requeue         time.Duration
	Itinerary       Itinerary
	Errors          []string
	Step            string

	Tracer        opentracing.Tracer
	ReconcileSpan opentracing.Span
}

A Velero task that provides the complete backup & restore workflow. Log - A controller's logger. Client - A controller's (local) client. Owner - A MigMigration resource. PlanResources - A PlanRefResources. Annotations - Map of annotations to applied to the backup & restore BackupResources - Resource types to be included in the backup. 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

Run the task. Each call will:

  1. Run the current phase.
  2. Update the phase to the next phase.
  3. Set the Requeue (as appropriate).
  4. Return.

func (*Task) UID

func (t *Task) UID() string

Migration UID.

func (*Task) VerificationCompleted

func (t *Task) VerificationCompleted() (bool, error)

VerificationCompleted will determine when the verification should be stopped

Jump to

Keyboard shortcuts

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