Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crds/virtualmachinerestores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ spec:
jsonPath: .metadata.creationTimestamp
name: Age
type: date
deprecated: true
deprecationWarning: The VirtualMachineRestore resource is deprecated, consider using VirtualMachineOperation with type Restore/Clone
name: v1alpha2
schema:
openAPIV3Schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,27 @@ func NewValidator() *Validator {
}

func (v *Validator) ValidateCreate(ctx context.Context, _ runtime.Object) (admission.Warnings, error) {
return admission.Warnings{"The VirtualMachineRestore resource is deprecated, consider using VirtualMachineOperation with type Restore"}, nil
return nil, nil
}

func (v *Validator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
warnings := admission.Warnings{"The VirtualMachineRestore resource is deprecated, consider using VirtualMachineOperation with type Restore"}

oldVMRestore, ok := oldObj.(*v1alpha2.VirtualMachineRestore)
if !ok {
return warnings, fmt.Errorf("expected an old VirtualMachineRestore but got a %T", newObj)
return nil, fmt.Errorf("expected an old VirtualMachineRestore but got a %T", newObj)
}

newVMRestore, ok := newObj.(*v1alpha2.VirtualMachineRestore)
if !ok {
return warnings, fmt.Errorf("expected a new VirtualMachineRestore but got a %T", newObj)
return nil, fmt.Errorf("expected a new VirtualMachineRestore but got a %T", newObj)
}

logger.FromContext(ctx).Info("Validating VirtualMachineRestore")

if oldVMRestore.Generation != newVMRestore.Generation {
return warnings, fmt.Errorf("VirtualMachineRestore is an idempotent resource: specification changes are not available")
return nil, fmt.Errorf("VirtualMachineRestore is an idempotent resource: specification changes are not available")
}

return warnings, nil
return nil, nil
}

func (v *Validator) ValidateDelete(ctx context.Context, _ runtime.Object) (admission.Warnings, error) {
Expand Down
4 changes: 0 additions & 4 deletions test/e2e/default_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ testData:
vmMigrationCancel: "/tmp/testdata/vm-migration-cancel"
vmEvacuation: "/tmp/testdata/vm-evacuation"
vmDiskAttachment: "/tmp/testdata/vm-disk-attachment"
vmRestoreForce: "/tmp/testdata/vm-restore-force"
vmRestoreSafe: "/tmp/testdata/vm-restore-safe"
vmVersions: "/tmp/testdata/vm-versions"
vdSnapshots: "/tmp/testdata/vd-snapshots"
sshKey: "/tmp/testdata/sshkeys/id_ed"
Expand All @@ -38,7 +36,6 @@ logFilter:
- "virtualmachineipaddressleases.virtualization.deckhouse.io "
- "Failed to watch" # error if virtualization-controller restarts during tests. "msg": "Failed to watch", "err": "Get \"http://127.0.0.1:23915/apis/virtualization.deckhouse.io/v1alpha2/virtualmachinerestores?allowWatchBookmarks=true\u0026resourceVersion=709816257\u0026timeoutSeconds=310\u0026watch=true\": context canceled"
- "leader election lost"
- "a virtual machine cannot be restored from the pending phase with `Forced` mode" # "err": "a virtual machine cannot be restored from the pending phase with `Forced` mode; you can delete the virtual machine and restore it with `Safe` mode"
- 'virtualMachineSnapshotSecret \"\" not found' # "msg": "virtualMachineSnapshotSecret \"\" not found"
- 'failed to sync migrating volumes: admission webhook \"virtualmachine-validator.kubevirt.io\" denied the request: spec.template.spec.domain.devices.disks'
- "in-flight migration detected" # "err": "admission webhook \"migration-create-validator.kubevirt.io\" denied the request: in-flight migration detected. Active migration job"
Expand All @@ -54,7 +51,6 @@ regexpLogFilter:
- "failed to sync virtual disk data source objectref: start immediate: internalvirtualizationdatavolumes.cdi.internal.virtualization.deckhouse.io .* is forbidden: unable to create new content in namespace .* because it is being terminated" # "err": "failed to sync virtual disk data source objectref: start immediate: internalvirtualizationdatavolumes.cdi.internal.virtualization.deckhouse.io \"vd-head-b3d8865-vd-root-migration-bios-d77ea313-f469-463d-a71b-00c89ca542ab\" is forbidden: unable to create new content in namespace head-b3d8865-end-to-end-vm-migration because it is being terminated"
- "Failed to update lock optimistically:.*leases.*leader-election-helper.*" # error during virtualization-controller lifecycle: attempt to reacquire leader election. "msg": "Failed to update lock optimistically: Put \"http://127.0.0.1:23915/apis/coordination.k8s.io/v1/namespaces/d8-virtualization/leases/d8-virt-operator-leader-election-helper?timeout=5s\": context deadline exceeded (Client.Timeout exceeded while awaiting headers), falling back to slow path"
- "Failed to update lock: .* leases.*leader-election-helper.*" # "msg": "ock: Operation cannot be fulfilled on leases.coordination.k8s.io \"d8-virt-operator-leader-election-helper\": the object has been modified; please apply your changes to the latest version and try again",
- "failed to create VirtualMachineIPAddress .* the specified IP address .* has already been allocated and has not been released" # "err": "failed to create VirtualMachineIPAddress \"head-5d2c558-vm-restore-safe-tfv4w\": admission webhook \"vmip.virtualization-controller.validate.d8-virtualization\" denied the request: the VirtualMachineIPAddress cannot be created: the specified IP address 10.66.10.4 has already been allocated and has not been released"
- "error retrieving resource lock .*leader-election-helper" # "msg": "error retrieving resource lock d8-virtualization/d8-virt-operator-leader-election-helper: context deadline exceeded",
- "persistentvolumeclaims .* is forbidden: unable to create new content in namespace .* because it is being terminated" # "err": "persistentvolumeclaims \"vd-f6fd1238-9cfe-4c22-bb48-cd64778740e3-\" is forbidden: unable to create new content in namespace virtualization-e2e-volume-migration-storage-class-changed-p8cxr because it is being terminated"
- "virtualmachineoperations.virtualization.deckhouse.io .* is forbidden: unable to create new content in namespace .* because it is being terminated" # "err": "virtualmachineoperations.virtualization.deckhouse.io \"volume-migration-\" is forbidden: unable to create new content in namespace virtualization-e2e-volume-migration-storage-class-changed-qsggq because it is being terminated"
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ type TestData struct {
VMMigrationCancel string `yaml:"vmMigrationCancel"`
VMEvacuation string `yaml:"vmEvacuation"`
VMDiskAttachment string `yaml:"vmDiskAttachment"`
VMRestoreForce string `yaml:"vmRestoreForce"`
VMRestoreSafe string `yaml:"vmRestoreSafe"`
VMVersions string `yaml:"vmVersions"`
VdSnapshots string `yaml:"vdSnapshots"`
Sshkey string `yaml:"sshKey"`
Expand Down
15 changes: 0 additions & 15 deletions test/e2e/legacy/testdata/vm-restore-force/kustomization.yaml

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions test/e2e/legacy/testdata/vm-restore-force/ns.yaml

This file was deleted.

52 changes: 0 additions & 52 deletions test/e2e/legacy/testdata/vm-restore-force/transformer.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions test/e2e/legacy/testdata/vm-restore-force/vm/base/vd-blank.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions test/e2e/legacy/testdata/vm-restore-force/vm/base/vd-root.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions test/e2e/legacy/testdata/vm-restore-force/vm/base/vm.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading