Documentation
¶
Overview ¶
The Plan CR represents a planned migration of VMs. The plan defines the source and destination providers; the resource mapping and a list of VMs to be migrated. The plan controller watches Migration CRs. Each Migration CR represents a separate and ordered execution of the plan. During plan execution, all validations are suspended. The plan Status.Migration contains a snapshot of the specification (except secrets) which is used during the execution.
Each plan execution:
1. Update the Status.Migration snapshot. 2. Ensure the plan CR namespace exists on the destination. 3. Ensure the CNV Secret exists and configured correctly on the destination. 4. Ensure the CNV ResourceMapping CR exists and configured correctly on the destination. 5. Create a CNV Import CR for each incomplete VM. 6. Requeue the reconcile until all of the VMs have either succeeded or failed. 7. A VM has completed successfully when it reaches the `Complete` phase without an error.
Each plan execution is idempotent. Subsequent migrations will only affect incomplete or failed VM migrations.
Index ¶
- Constants
- Variables
- func Add(mgr manager.Manager) error
- func GetHyperVPvListSmb(dClient client.Client, planID string) (pvs *core.PersistentVolumeList, found bool, err error)
- func GetHyperVPvcListSmb(dClient client.Client, planID string, planNamespace string) (pvcs *core.PersistentVolumeClaimList, found bool, err error)
- func GetOvaPvListNfs(dClient client.Client, planID string) (pvs *core.PersistentVolumeList, found bool, err error)
- func GetOvaPvcListNfs(dClient client.Client, planID string, planNamespace string) (pvcs *core.PersistentVolumeClaimList, found bool, err error)
- func RequestForMigration(ctx context.Context, a client.Object) (list []reconcile.Request)
- type CNIIPAMConfig
- type CNINetworkConfig
- type CNIRoute
- type DsMapPredicate
- func (r DsMapPredicate) Create(e event.TypedCreateEvent[*api.StorageMap]) bool
- func (r DsMapPredicate) Delete(e event.TypedDeleteEvent[*api.StorageMap]) bool
- func (r DsMapPredicate) Generic(e event.TypedGenericEvent[*api.StorageMap]) bool
- func (r DsMapPredicate) Update(e event.TypedUpdateEvent[*api.StorageMap]) bool
- type ExtendedDataVolume
- type HookPredicate
- type HookRunner
- type KubeVirt
- func (r *KubeVirt) BuildPVCForNFS(pv *core.PersistentVolume, vm *plan.VMStatus) (pvc *core.PersistentVolumeClaim)
- func (r *KubeVirt) BuildPVCForSMB(pv *core.PersistentVolume, vm *plan.VMStatus) (pvc *core.PersistentVolumeClaim)
- func (r *KubeVirt) BuildPVForNFS(vm *plan.VMStatus) (pv *core.PersistentVolume)
- func (r *KubeVirt) BuildPVForSMB(vm *plan.VMStatus) (pv *core.PersistentVolume)
- func (r *KubeVirt) CancelConversion(vm *plan.VMStatus) error
- func (r *KubeVirt) CreateDeepInspectionConversion(vm *plan.VMStatus, snapshotMoref, planName, planID string, retryAllowed bool) (*api.Conversion, error)
- func (r *KubeVirt) DataVolumes(vm *plan.VMStatus) (dataVolumes []cdi.DataVolume, err error)
- func (r *KubeVirt) DeleteAllConversions(vm *plan.VMStatus) error
- func (r *KubeVirt) DeleteConfigMap(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DeleteConversion(cr *api.Conversion) error
- func (r *KubeVirt) DeleteDataVolumes(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DeleteGuestConversionPod(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DeleteHookJobs(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DeleteImporterPods(pvc *core.PersistentVolumeClaim) (err error)
- func (r *KubeVirt) DeleteJobs(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DeleteObject(object client.Object, vm *plan.VMStatus, message, objType string, ...) (err error)
- func (r *KubeVirt) DeletePVCConsumerPod(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DeletePopulatedPVCs(vm *plan.VMStatus) error
- func (r *KubeVirt) DeletePopulatorPods(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DeletePreflightInspectionPod(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DeleteSecret(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DeleteVM(vm *plan.VMStatus) (err error)
- func (r *KubeVirt) DiskRefsFromPodVolumeMounts(vmVolumes []cnv.Volume, pvcs []*core.PersistentVolumeClaim, vm *plan.VMStatus, ...) (refs []api.DiskRef, err error)
- func (r *KubeVirt) EnsureConversion(vm *plan.VMStatus, conversionType api.ConversionType, ...) (ready bool, err error)
- func (r *KubeVirt) EnsureDataVolumes(vm *plan.VMStatus, dataVolumes []cdi.DataVolume) (err error)
- func (r *KubeVirt) EnsureExtraV2vConfConfigMap() error
- func (r *KubeVirt) EnsureGuestConversionPod(vm *plan.VMStatus, step *plan.Step) (ready bool, err error)
- func (r *KubeVirt) EnsureGuestInspectionPod(vm *plan.VMStatus, step *plan.Step) (ready bool, err error)
- func (r *KubeVirt) EnsureNamespace() error
- func (r *KubeVirt) EnsurePVCForNFS(pvc *core.PersistentVolumeClaim) (out *core.PersistentVolumeClaim, err error)
- func (r *KubeVirt) EnsurePVForNFS(pv *core.PersistentVolume) (out *core.PersistentVolume, err error)
- func (r *KubeVirt) EnsurePVForSMB(pv *core.PersistentVolume) (out *core.PersistentVolume, err error)
- func (r *KubeVirt) EnsurePersistentVolume(vmRef ref.Ref, persistentVolumes []core.PersistentVolume) (err error)
- func (r *KubeVirt) EnsurePersistentVolumeClaim(vmRef ref.Ref, persistentVolumeClaims []core.PersistentVolumeClaim) (err error)
- func (r *KubeVirt) EnsurePopulatorVolumes(vm *plan.VMStatus, pvcs []*core.PersistentVolumeClaim) (err error)
- func (r *KubeVirt) EnsureProviderStoragePVC(pvc *core.PersistentVolumeClaim, providerType api.ProviderType) (out *core.PersistentVolumeClaim, err error)
- func (r *KubeVirt) EnsureProviderVirtV2VPVCStatus(vmID string) (ready bool, err error)
- func (r *KubeVirt) EnsureVM(vm *plan.VMStatus) error
- func (r *KubeVirt) GetConversionPod(vmRef ref.Ref, podType convctx.V2vPodType) (*core.Pod, error)
- func (r *KubeVirt) GetDeepInspectionConversion(vm *plan.VMStatus) (*api.Conversion, error)
- func (r *KubeVirt) GetGuestConversionPod(vm *plan.VMStatus) (pod *core.Pod, err error)
- func (r *KubeVirt) GetImporterPod(pvc core.PersistentVolumeClaim) (pod *core.Pod, found bool, err error)
- func (r *KubeVirt) GetPods(vm *plan.VMStatus) (pods *core.PodList, err error)
- func (r *KubeVirt) GetPodsWithLabels(podLabels map[string]string) (pods *core.PodList, err error)
- func (r *KubeVirt) IsCopyOffload(pvcs []*core.PersistentVolumeClaim) bool
- func (r *KubeVirt) ListVMs() ([]VirtualMachine, error)
- func (r *KubeVirt) NetAppShiftPVCs(vm *plan.VMStatus) ([]core.PersistentVolumeClaim, error)
- func (r *KubeVirt) PopulatorVolumes(vmRef ref.Ref) (pvcs []*core.PersistentVolumeClaim, err error)
- func (r *KubeVirt) ResolveConversionType(vm *plan.VMStatus) (api.ConversionType, error)
- func (r *KubeVirt) UpdateVmByConvertedConfig(vm *plan.VMStatus, pod *core.Pod, step *plan.Step) error
- func (r *KubeVirt) VirtualMachineMap() (mp VirtualMachineMap, err error)
- type Migration
- type MigrationPredicate
- func (r MigrationPredicate) Create(e event.TypedCreateEvent[*api.Migration]) bool
- func (r MigrationPredicate) Delete(e event.TypedDeleteEvent[*api.Migration]) bool
- func (r MigrationPredicate) Generic(e event.TypedGenericEvent[*api.Migration]) bool
- func (r MigrationPredicate) Update(e event.TypedUpdateEvent[*api.Migration]) bool
- type NetMapPredicate
- func (r NetMapPredicate) Create(e event.TypedCreateEvent[*api.NetworkMap]) bool
- func (r NetMapPredicate) Delete(e event.TypedDeleteEvent[*api.NetworkMap]) bool
- func (r NetMapPredicate) Generic(e event.TypedGenericEvent[*api.NetworkMap]) bool
- func (r NetMapPredicate) Update(e event.TypedUpdateEvent[*api.NetworkMap]) bool
- type OpenPort
- type PlanPredicate
- type ProviderPredicate
- func (r *ProviderPredicate) Create(e event.TypedCreateEvent[*api.Provider]) bool
- func (r *ProviderPredicate) Delete(e event.TypedDeleteEvent[*api.Provider]) bool
- func (r *ProviderPredicate) Generic(e event.TypedGenericEvent[*api.Provider]) bool
- func (r *ProviderPredicate) Update(e event.TypedUpdateEvent[*api.Provider]) bool
- type Reconciler
- func (r *Reconciler) IsValidNetworkNameTemplate(networkNameTemplate string) error
- func (r *Reconciler) IsValidTargetName(targetName string) error
- func (r *Reconciler) IsValidTemplate(templateStr string, testData interface{}) (string, error)
- func (r *Reconciler) IsValidVolumeNameTemplate(volumeNameTemplate string) error
- func (r Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (result reconcile.Result, err error)
- type VirtualMachine
- type VirtualMachineMap
Constants ¶
const ( // Name. Name = "plan" // Annotation for populator Labels set AnnPopulatorLabels = "populatorLabels" )
const ( // Legacy transfer network annotation (value=network-attachment-definition name) // FIXME: this should be phased out and replaced with the // k8s.v1.cni.cncf.io/networks annotation. AnnLegacyTransferNetwork = "v1.multus-cni.io/default-network" // Transfer network annotation (value=network-attachment-definition name) AnnTransferNetwork = "k8s.v1.cni.cncf.io/networks" // Annotation to specify the default route for the transfer network. // To be set on the transfer network NAD by the end user. AnnForkliftNetworkRoute = "forklift.konveyor.io/route" // Special value for AnnForkliftNetworkRoute to explicitly request no gateway. // Use this to enable modern k8s.v1.cni.cncf.io/networks annotation without default-route. AnnForkliftRouteValueNone = "none" // Contains validations for a Kubevirt VM. Needs to be removed when // creating a VM from a template. AnnKubevirtValidations = "vm.kubevirt.io/validations" // PVC annotation containing the name of the importer pod. AnnImporterPodName = "cdi.kubevirt.io/storage.import.importPodName" // Openshift display name annotation (value=vmName) AnnDisplayName = "openshift.io/display-name" // Original VM name on source (value=vmOriginalID) AnnOriginalID = "original-ID" // DV deletion on completion AnnDeleteAfterCompletion = "cdi.kubevirt.io/storage.deleteAfterCompletion" // VddkVolumeName is the volume name used for the VDDK library scratch space. VddkVolumeName = "vddk-vol-mount" // DynamicScriptsVolumeName is the volume name used to mount first-boot scripts. DynamicScriptsVolumeName = "scripts-volume-mount" // DynamicScriptsMountPath is the mount path for first-boot scripts. DynamicScriptsMountPath = "/mnt/dynamic_scripts" // Annotation to specify current number of retries for getting parent backing ParentBackingRetriesAnnotation = "parentBackingRetries" // AnnPopulatorServiceAccount is set on populator PVCs to propagate the // migration ServiceAccount to the populator pod. AnnPopulatorServiceAccount = "forklift.konveyor.io/serviceAccount" // AnnCDIPodServiceAccount is set on DataVolume annotations so CDI uses // the specified ServiceAccount for its data transfer pods. AnnCDIPodServiceAccount = "cdi.kubevirt.io/storage.pod.serviceAccountName" )
Annotations
const ( ResourceVMConfig = "vm-config" ResourceVDDKConfig = "vddk-config" )
Resource labels
const ( OvaPVCLabel = "nfs-pvc" OvaPVLabel = "nfs-pv" HyperVPVCLabel = "smb-pvc" HyperVPVLabel = "smb-pv" )
Labels
const ( ExtraV2vConf = "extra-v2v-conf" VddkConf = "vddk-conf" VddkAioBufSizeDefault = "16" VddkAioBufCountDefault = "4" )
Vddk v2v conf
const ( VirtV2vConversionPod = convctx.VirtV2vConversionPod VirtV2vInspectionPod = convctx.VirtV2vInspectionPod )
VirtV2V pod types (aliases for the canonical constants in the conversion/context package).
const ( NoReQ = time.Duration(0) PollReQ = time.Second * 3 )
Requeue
const ( TransferCompleted = "Transfer completed." PopulatorPodPrefix = "populate-" // TODO: ImageConversion and DiskTransferV2v step names remain here // until remaining cold/warm migration flow details can be // moved into base migrators. ImageConversion = "ImageConversion" DiskTransferV2v = "DiskTransferV2v" )
const ( SSHReady = "SSHReady" SSHNotReady = "SSHNotReady" )
Types
const ( WarmMigrationNotReady = "WarmMigrationNotReady" MigrationTypeNotValid = "MigrationTypeNotValid" NamespaceNotValid = "NamespaceNotValid" TransferNetNotValid = "TransferNetworkNotValid" TransferNetMissingDefaultRoute = "TransferNetworkMissingDefaultRoute" NetRefNotValid = "NetworkMapRefNotValid" NetMapNotReady = "NetworkMapNotReady" NetMapPreservingIPsOnPodNetwork = "NetMapPreservingIPsOnPodNetwork" DsMapNotReady = "StorageMapNotReady" DsRefNotValid = "StorageRefNotValid" VMRefNotValid = "VMRefNotValid" VMNotFound = "VMNotFound" VMAlreadyExists = "VMAlreadyExists" VMNetworksNotMapped = "VMNetworksNotMapped" VMStorageNotMapped = "VMStorageNotMapped" VMStorageNotSupported = "VMStorageNotSupported" VMMultiplePodNetworkMappings = "VMMultiplePodNetworkMappings" VMDuplicateNADMappings = "VMDuplicateNADMappings" VMMissingGuestIPs = "VMMissingGuestIPs" VMIpNotMatchingUdnSubnet = "VMIpNotMatchingUdnSubnet" VMMissingChangedBlockTracking = "VMMissingChangedBlockTracking" VMHasSnapshots = "VMHasSnapshots" HostNotReady = "HostNotReady" DuplicateVM = "DuplicateVM" NameNotValid = "TargetNameNotValid" HookNotValid = "HookNotValid" HookNotReady = "HookNotReady" HookStepNotValid = "HookStepNotValid" Executing = "Executing" Succeeded = "Succeeded" Failed = "Failed" Canceled = "Canceled" ConversionHasWarnings = "ConversionHasWarnings" InspectionHasConcerns = "InspectionHasConcerns" Deleted = "Deleted" Paused = "Paused" Archived = "Archived" InvalidDiskSizes = "InvalidDiskSizes" MacConflicts = "MacConflicts" MissingPvcForOnlyConversion = "MissingPvcForOnlyConversion" LuksAndClevisIncompatibility = "LuksAndClevisIncompatibility" UnsupportedUdn = "UnsupportedUserDefinedNetwork" VirtV2vImageNotValid = "VirtV2vImageNotValid" VDDKInvalid = "VDDKInvalid" ValidatingVDDK = "ValidatingVDDK" VDDKInitImageNotReady = "VDDKInitImageNotReady" UnsupportedOVFExportSource = "UnsupportedOVFExportSource" VMPowerStateUnsupported = "VMPowerStateUnsupported" VMMigrationTypeUnsupported = "VMMigrationTypeUnsupported" GuestToolsIssue = "GuestToolsIssue" VDDKAndOffloadMixedUsage = "VDDKAndOffloadMixedUsage" ServiceAccountNotValid = "ServiceAccountNotValid" HookServiceAccountNotValid = "HookServiceAccountNotValid" RestrictedPodSecurity = "RestrictedPodSecurity" NetMapDestinationNADNotValid = "NetMapDestinationNADNotValid" VMCriticalConcerns = "VMCriticalConcerns" // NetAppShift (Advisory) reports whether the plan's storage map uses a NetApp Shift/Trident class. NetAppShift = "NetAppShift" // NetAppShiftWarmNotSupported (Critical) blocks warm migration when the storage map uses NetApp Shift. NetAppShiftWarmNotSupported = "NetAppShiftWarmNotSupported" // NetAppShiftDatastoreNASMissing (Critical) blocks when a disk maps to NetApp Shift but the source // datastore lacks NAS export details in inventory (required for MTV annotations). NetAppShiftDatastoreNASMissing = "NetAppShiftDatastoreNASMissing" )
Types
const ( Required = libcnd.Required Advisory = libcnd.Advisory Critical = libcnd.Critical Error = libcnd.Error Warn = libcnd.Warn )
Categories
const ( Pod = "pod" Multus = "multus" Ignored = "ignored" )
Network types
const ( Started = "Started" NotSet = "NotSet" NotFound = "NotFound" NotUnique = "NotUnique" NotSupported = "NotSupported" Ambiguous = "Ambiguous" NotValid = "NotValid" Modified = "Modified" UserRequested = "UserRequested" InMaintenanceMode = "InMaintenanceMode" MissingGuestInfo = "MissingGuestInformation" MissingChangedBlockTracking = "MissingChangedBlockTracking" )
Reasons
const ( True = libcnd.True False = libcnd.False )
Statuses
const (
PVSize = "1Gi"
)
PV size
const (
ResourceHookConfig = "hook-config"
)
Resource label
const (
// SMBCSIDriver is the CSI driver name for SMB shares (used by HyperV provider)
SMBCSIDriver = "smb.csi.k8s.io"
)
CSI Drivers
const (
)
Variables ¶
var Settings = &settings.Settings
Application settings.
Functions ¶
func GetHyperVPvListSmb ¶
func GetHyperVPvListSmb(dClient client.Client, planID string) (pvs *core.PersistentVolumeList, found bool, err error)
GetHyperVPvListSmb returns HyperV SMB PVs for a plan.
func GetHyperVPvcListSmb ¶
func GetHyperVPvcListSmb(dClient client.Client, planID string, planNamespace string) (pvcs *core.PersistentVolumeClaimList, found bool, err error)
GetHyperVPvcListSmb returns HyperV SMB PVCs for a plan.
func GetOvaPvListNfs ¶
func GetOvaPvcListNfs ¶
Types ¶
type CNIIPAMConfig ¶
type CNIIPAMConfig struct {
Routes []CNIRoute `json:"routes"`
}
CNIIPAMConfig represents the IPAM section of a CNI network configuration.
type CNINetworkConfig ¶
type CNINetworkConfig struct {
IPAM CNIIPAMConfig `json:"ipam"`
}
CNINetworkConfig represents a CNI network configuration parsed from a NetworkAttachmentDefinition. This includes the IPAM configuration with routes for determining default gateway.
type CNIRoute ¶
type CNIRoute struct {
Dst string `json:"dst"` // Destination network in CIDR notation (e.g., "0.0.0.0/0" for default route)
GW string `json:"gw"` // Gateway IP address
}
CNIRoute represents a single route entry in the CNI IPAM configuration.
type DsMapPredicate ¶
type DsMapPredicate struct {
predicate.TypedFuncs[*api.StorageMap]
}
func (DsMapPredicate) Create ¶
func (r DsMapPredicate) Create(e event.TypedCreateEvent[*api.StorageMap]) bool
func (DsMapPredicate) Delete ¶
func (r DsMapPredicate) Delete(e event.TypedDeleteEvent[*api.StorageMap]) bool
func (DsMapPredicate) Generic ¶
func (r DsMapPredicate) Generic(e event.TypedGenericEvent[*api.StorageMap]) bool
func (DsMapPredicate) Update ¶
func (r DsMapPredicate) Update(e event.TypedUpdateEvent[*api.StorageMap]) bool
type ExtendedDataVolume ¶
type ExtendedDataVolume struct {
*cdi.DataVolume
PVC *core.PersistentVolumeClaim
}
Represents a CDI DataVolume, its associated PVC, and added behavior.
func (*ExtendedDataVolume) Conditions ¶
func (r *ExtendedDataVolume) Conditions() (cnd *libcnd.Conditions)
Get conditions.
func (*ExtendedDataVolume) PercentComplete ¶
func (r *ExtendedDataVolume) PercentComplete() (pct float64)
Convert the Status.Progress into a percentage (float).
type HookPredicate ¶
type HookPredicate struct {
predicate.TypedFuncs[*api.Hook]
}
func (HookPredicate) Create ¶
func (r HookPredicate) Create(e event.TypedCreateEvent[*api.Hook]) bool
func (HookPredicate) Delete ¶
func (r HookPredicate) Delete(e event.TypedDeleteEvent[*api.Hook]) bool
func (HookPredicate) Generic ¶
func (r HookPredicate) Generic(e event.TypedGenericEvent[*api.Hook]) bool
func (HookPredicate) Update ¶
func (r HookPredicate) Update(e event.TypedUpdateEvent[*api.Hook]) bool
type HookRunner ¶
type HookRunner struct {
*plancontext.Context
// contains filtered or unexported fields
}
Hook runner.
type KubeVirt ¶
type KubeVirt struct {
*plancontext.Context
// Builder
Builder adapter.Builder
// Ensurer
Ensurer adapter.Ensurer
}
Represents kubevirt.
func (*KubeVirt) BuildPVCForNFS ¶
func (r *KubeVirt) BuildPVCForNFS(pv *core.PersistentVolume, vm *plan.VMStatus) (pvc *core.PersistentVolumeClaim)
func (*KubeVirt) BuildPVCForSMB ¶
func (r *KubeVirt) BuildPVCForSMB(pv *core.PersistentVolume, vm *plan.VMStatus) (pvc *core.PersistentVolumeClaim)
BuildPVCForSMB creates a PVC bound to a static SMB PV for HyperV.
func (*KubeVirt) BuildPVForNFS ¶
func (r *KubeVirt) BuildPVForNFS(vm *plan.VMStatus) (pv *core.PersistentVolume)
func (*KubeVirt) BuildPVForSMB ¶
func (r *KubeVirt) BuildPVForSMB(vm *plan.VMStatus) (pv *core.PersistentVolume)
BuildPVForSMB creates a static PV for HyperV using SMB CSI driver.
func (*KubeVirt) CancelConversion ¶
CancelConversion finds the Conversion CR for the given VM and marks it as Canceled.
func (*KubeVirt) CreateDeepInspectionConversion ¶
func (r *KubeVirt) CreateDeepInspectionConversion( vm *plan.VMStatus, snapshotMoref, planName, planID string, retryAllowed bool, ) (*api.Conversion, error)
CreateDeepInspectionConversion creates a new DeepInspection Conversion CR and returns it. retryAllowed controls the value of the LabelRetryAllowed label stamped on the new CR: "true" permits one future retry on failure; "false" makes the next failure permanent.
func (*KubeVirt) DataVolumes ¶
func (*KubeVirt) DeleteAllConversions ¶
DeleteAllConversions deletes every Conversion CR that was created for the given VM on this plan, together with their pods and secrets.
func (*KubeVirt) DeleteConfigMap ¶
Delete the ConfigMap that was created for this VM.
func (*KubeVirt) DeleteConversion ¶
func (r *KubeVirt) DeleteConversion(cr *api.Conversion) error
DeleteConversion tears down a Conversion CR: pod → snapshot → secrets → CR.
func (*KubeVirt) DeleteDataVolumes ¶
Delete the DataVolumes associated with the VM.
func (*KubeVirt) DeleteGuestConversionPod ¶
Delete the guest conversion pod on the destination cluster.
func (*KubeVirt) DeleteHookJobs ¶
Delete any hook jobs that belong to a VM migration.
func (*KubeVirt) DeleteImporterPods ¶
func (r *KubeVirt) DeleteImporterPods(pvc *core.PersistentVolumeClaim) (err error)
Delete the importer pods for a PersistentVolumeClaim.
func (*KubeVirt) DeleteObject ¶
func (r *KubeVirt) DeleteObject(object client.Object, vm *plan.VMStatus, message, objType string, options ...client.DeleteOption) (err error)
Deletes an object from destination cluster associated with the VM.
func (*KubeVirt) DeletePVCConsumerPod ¶
Delete the PVC consumer pod on the destination cluster.
func (*KubeVirt) DeletePopulatedPVCs ¶
Deletes PVCs that were populated using a volume populator, including prime PVCs
func (*KubeVirt) DeletePopulatorPods ¶
Delete any populator pods that belong to a VM's migration.
func (*KubeVirt) DeletePreflightInspectionPod ¶
Delete the inspection pod.
func (*KubeVirt) DeleteSecret ¶
Delete the Secret that was created for this VM.
func (*KubeVirt) DiskRefsFromPodVolumeMounts ¶
func (r *KubeVirt) DiskRefsFromPodVolumeMounts(vmVolumes []cnv.Volume, pvcs []*core.PersistentVolumeClaim, vm *plan.VMStatus, podType int) (refs []api.DiskRef, err error)
DiskRefsFromPodVolumeMounts calls podVolumeMounts and converts the PVC-backed volumes into DiskRef entries for a Conversion CR.
func (*KubeVirt) EnsureConversion ¶
func (r *KubeVirt) EnsureConversion(vm *plan.VMStatus, conversionType api.ConversionType, planName, planNamespace, planID string, migration *api.Migration, step *plan.Step) (ready bool, err error)
EnsureConversion resolves all plan data, checks whether a matching Conversion CR already exists and creates one if needed.
func (*KubeVirt) EnsureDataVolumes ¶
Ensure the DataVolumes exist on the destination.
func (*KubeVirt) EnsureExtraV2vConfConfigMap ¶
Ensure the config map that contains extra configuration for virt-v2v exists on the destination.
func (*KubeVirt) EnsureGuestConversionPod ¶
func (r *KubeVirt) EnsureGuestConversionPod(vm *plan.VMStatus, step *plan.Step) (ready bool, err error)
EnsureGuestConversionPod resolves all data and creates the conversion pod via conversion.EnsureVirtV2vPod.
func (*KubeVirt) EnsureGuestInspectionPod ¶
func (r *KubeVirt) EnsureGuestInspectionPod(vm *plan.VMStatus, step *plan.Step) (ready bool, err error)
EnsureGuestInspectionPod resolves all data and creates the inspection pod via conversion.EnsureVirtV2vPod.
func (*KubeVirt) EnsureNamespace ¶
Ensure the namespace exists on the destination.
func (*KubeVirt) EnsurePVCForNFS ¶
func (r *KubeVirt) EnsurePVCForNFS(pvc *core.PersistentVolumeClaim) (out *core.PersistentVolumeClaim, err error)
EnsurePVCForNFS is deprecated, use EnsureProviderStoragePVC instead. Kept for backwards compatibility with existing code paths.
func (*KubeVirt) EnsurePVForNFS ¶
func (r *KubeVirt) EnsurePVForNFS(pv *core.PersistentVolume) (out *core.PersistentVolume, err error)
func (*KubeVirt) EnsurePVForSMB ¶
func (r *KubeVirt) EnsurePVForSMB(pv *core.PersistentVolume) (out *core.PersistentVolume, err error)
EnsurePVForSMB ensures the static PV exists for HyperV SMB.
func (*KubeVirt) EnsurePersistentVolume ¶
func (r *KubeVirt) EnsurePersistentVolume(vmRef ref.Ref, persistentVolumes []core.PersistentVolume) (err error)
Ensure the PV exist on the destination.
func (*KubeVirt) EnsurePersistentVolumeClaim ¶
func (r *KubeVirt) EnsurePersistentVolumeClaim(vmRef ref.Ref, persistentVolumeClaims []core.PersistentVolumeClaim) (err error)
Ensure the PV exist on the destination.
func (*KubeVirt) EnsurePopulatorVolumes ¶
func (*KubeVirt) EnsureProviderStoragePVC ¶
func (r *KubeVirt) EnsureProviderStoragePVC(pvc *core.PersistentVolumeClaim, providerType api.ProviderType) (out *core.PersistentVolumeClaim, err error)
EnsureProviderStoragePVC returns existing PVC if found by labels, creates if not found (OVA NFS or HyperV SMB).
func (*KubeVirt) EnsureProviderVirtV2VPVCStatus ¶
EnsureProviderVirtV2VPVCStatus checks if the provider storage PVC is ready. Works for both OVA (NFS) and HyperV (SMB) PVCs.
func (*KubeVirt) GetConversionPod ¶
GetConversionPod returns the managed pod for the given VM ref and pod type.
func (*KubeVirt) GetDeepInspectionConversion ¶
GetDeepInspectionConversion returns the DeepInspection Conversion CR for the given VM, or nil when none exists.
func (*KubeVirt) GetGuestConversionPod ¶
Get the guest conversion pod for the VM.
func (*KubeVirt) GetImporterPod ¶
func (r *KubeVirt) GetImporterPod(pvc core.PersistentVolumeClaim) (pod *core.Pod, found bool, err error)
Get the importer pod for a PersistentVolumeClaim.
func (*KubeVirt) GetPodsWithLabels ¶
Gets pods associated with the VM.
func (*KubeVirt) IsCopyOffload ¶
func (r *KubeVirt) IsCopyOffload(pvcs []*core.PersistentVolumeClaim) bool
IsCopyOffload is determined by PVC having the copy-offload label, which is set by the builder earlier in #PopulatorVolumes TODO rgolan - for now the check will be done if any PVC match in the migration - this is obviously coarse and should be per a disk's storage class, for example a disk from NFS or local doesn't support that (specifically referring to vmkfstools xcopy for RDM)
func (*KubeVirt) ListVMs ¶
func (r *KubeVirt) ListVMs() ([]VirtualMachine, error)
List VirtualMachine CRs. Each VirtualMachine represents an imported kubevirt VM with associated DataVolumes.
func (*KubeVirt) NetAppShiftPVCs ¶
NetAppShiftPVCs builds PVCs for disks mapped to NetApp Shift StorageClasses.
func (*KubeVirt) PopulatorVolumes ¶
func (*KubeVirt) ResolveConversionType ¶
ResolveConversionType determines whether the migration for the given VM should use InPlace or Remote conversion based on the plan transfer mode and PVC copy-offload annotations.
func (*KubeVirt) UpdateVmByConvertedConfig ¶
func (*KubeVirt) VirtualMachineMap ¶
func (r *KubeVirt) VirtualMachineMap() (mp VirtualMachineMap, err error)
Build a VirtualMachineMap.
type Migration ¶
type Migration struct {
*plancontext.Context
// contains filtered or unexported fields
}
Migration.
func (*Migration) Archive ¶
func (r *Migration) Archive()
Archive the plan. Best effort to remove any retained migration resources.
func (*Migration) Cancel ¶
Cancel the migration. Delete resources associated with VMs that have been marked canceled.
func (*Migration) NextPhase ¶
NextPhase transitions the VM to the next migration phase. If this was the last phase in the current pipeline step, the pipeline step is marked complete.
func (*Migration) SetPopulatorDataSourceLabels ¶
func (r *Migration) SetPopulatorDataSourceLabels()
type MigrationPredicate ¶
type MigrationPredicate struct {
predicate.TypedFuncs[*api.Migration]
}
func (MigrationPredicate) Create ¶
func (r MigrationPredicate) Create(e event.TypedCreateEvent[*api.Migration]) bool
func (MigrationPredicate) Delete ¶
func (r MigrationPredicate) Delete(e event.TypedDeleteEvent[*api.Migration]) bool
func (MigrationPredicate) Generic ¶
func (r MigrationPredicate) Generic(e event.TypedGenericEvent[*api.Migration]) bool
func (MigrationPredicate) Update ¶
func (r MigrationPredicate) Update(e event.TypedUpdateEvent[*api.Migration]) bool
type NetMapPredicate ¶
type NetMapPredicate struct {
predicate.TypedFuncs[*api.NetworkMap]
}
func (NetMapPredicate) Create ¶
func (r NetMapPredicate) Create(e event.TypedCreateEvent[*api.NetworkMap]) bool
func (NetMapPredicate) Delete ¶
func (r NetMapPredicate) Delete(e event.TypedDeleteEvent[*api.NetworkMap]) bool
func (NetMapPredicate) Generic ¶
func (r NetMapPredicate) Generic(e event.TypedGenericEvent[*api.NetworkMap]) bool
func (NetMapPredicate) Update ¶
func (r NetMapPredicate) Update(e event.TypedUpdateEvent[*api.NetworkMap]) bool
type OpenPort ¶
type OpenPort struct {
// valid values are tcp, udp, sctp, icmp
Protocol string `yaml:"protocol"`
Port int `yaml:"port,omitempty"`
}
For the User Defined Networks we need to open some port so we can communicate with our metrics server inside the User Defined Network Namespace. Docs: https://docs.redhat.com/en/documentation/openshift_container_platform/4.19/html/multiple_networks/primary-networks#opening-default-network-ports-udn_about-user-defined-networks
type PlanPredicate ¶
type PlanPredicate struct {
predicate.TypedFuncs[*api.Plan]
}
func (PlanPredicate) Create ¶
func (r PlanPredicate) Create(e event.TypedCreateEvent[*api.Plan]) bool
func (PlanPredicate) Delete ¶
func (r PlanPredicate) Delete(e event.TypedDeleteEvent[*api.Plan]) bool
func (PlanPredicate) Update ¶
func (r PlanPredicate) Update(e event.TypedUpdateEvent[*api.Plan]) bool
type ProviderPredicate ¶
type ProviderPredicate struct {
handler.WatchManager
predicate.TypedFuncs[*api.Provider]
// contains filtered or unexported fields
}
Provider watch predicate. Also ensures an inventory watch is created and associated with the channel source.
func (*ProviderPredicate) Create ¶
func (r *ProviderPredicate) Create(e event.TypedCreateEvent[*api.Provider]) bool
Provider created event.
func (*ProviderPredicate) Delete ¶
func (r *ProviderPredicate) Delete(e event.TypedDeleteEvent[*api.Provider]) bool
Provider deleted event.
func (*ProviderPredicate) Generic ¶
func (r *ProviderPredicate) Generic(e event.TypedGenericEvent[*api.Provider]) bool
Generic provider watch event.
func (*ProviderPredicate) Update ¶
func (r *ProviderPredicate) Update(e event.TypedUpdateEvent[*api.Provider]) bool
Provider updated event.
type Reconciler ¶
type Reconciler struct {
base.Reconciler
APIReader client.Reader
}
Reconciles a Plan object.
func (*Reconciler) IsValidNetworkNameTemplate ¶
func (r *Reconciler) IsValidNetworkNameTemplate(networkNameTemplate string) error
func (*Reconciler) IsValidTargetName ¶
func (r *Reconciler) IsValidTargetName(targetName string) error
func (*Reconciler) IsValidTemplate ¶
func (r *Reconciler) IsValidTemplate(templateStr string, testData interface{}) (string, error)
func (*Reconciler) IsValidVolumeNameTemplate ¶
func (r *Reconciler) IsValidVolumeNameTemplate(volumeNameTemplate string) error
type VirtualMachine ¶
type VirtualMachine struct {
*cnv.VirtualMachine
DataVolumes []ExtendedDataVolume
}
Represents Kubevirt VirtualMachine with associated DataVolumes.
func (*VirtualMachine) Conditions ¶
func (r *VirtualMachine) Conditions() (cnd *libcnd.Conditions)
Get conditions.
func (*VirtualMachine) Owner ¶
func (r *VirtualMachine) Owner(dv *cdi.DataVolume) bool
Determine if `this` VirtualMachine is the owner of the CDI DataVolume.
type VirtualMachineMap ¶
type VirtualMachineMap map[string]VirtualMachine
Map of VirtualMachines keyed by vmID.