diff --git a/test/e2e/blockdevice/data_exports.go b/test/e2e/blockdevice/data_exports.go index bc3223d755..2d1a43051a 100644 --- a/test/e2e/blockdevice/data_exports.go +++ b/test/e2e/blockdevice/data_exports.go @@ -80,13 +80,7 @@ var _ = Describe("DataExports", label.Slow(), func() { ) By("Creating root and data disks", func() { - vdRoot = vdbuilder.New( - vdbuilder.WithName("vd-root"), - vdbuilder.WithNamespace(f.Namespace().Name), - vdbuilder.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLUbuntu, - }), - ) + vdRoot = object.NewVDFromCVI("vd-root", f.Namespace().Name, object.PrecreatedCVIUbuntu) vdData = vdbuilder.New( vdbuilder.WithName("vd-data"), @@ -111,7 +105,7 @@ var _ = Describe("DataExports", label.Slow(), func() { v1alpha2.BlockDeviceSpecRef{Kind: v1alpha2.DiskDevice, Name: vdData.Name}, ), vmbuilder.WithRunPolicy(v1alpha2.AlwaysOnUnlessStoppedManually), - vmbuilder.WithProvisioningUserData(object.DefaultCloudInit), + vmbuilder.WithProvisioningUserData(object.UbuntuCloudInit), ) err := f.CreateWithDeferredDeletion(context.Background(), vm) diff --git a/test/e2e/blockdevice/virtual_disk_provisioning.go b/test/e2e/blockdevice/virtual_disk_provisioning.go index 0e717f88f7..73a67babbf 100644 --- a/test/e2e/blockdevice/virtual_disk_provisioning.go +++ b/test/e2e/blockdevice/virtual_disk_provisioning.go @@ -25,7 +25,6 @@ import ( "k8s.io/utils/ptr" vdbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vd" - vibuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vi" vmbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vm" "github.com/deckhouse/virtualization/api/core/v1alpha2" "github.com/deckhouse/virtualization/test/e2e/internal/framework" @@ -55,13 +54,8 @@ var _ = Describe("VirtualDiskProvisioning", func() { vm *v1alpha2.VirtualMachine ) - By("Creating VirtualImage", func() { - vi = vibuilder.New( - vibuilder.WithName("vi"), - vibuilder.WithNamespace(f.Namespace().Name), - vibuilder.WithDataSourceHTTP(object.ImageURLAlpineUEFI, nil, nil), - vibuilder.WithStorage(v1alpha2.StoragePersistentVolumeClaim), - ) + By("Creating VirtualImage from precreated CVI", func() { + vi = object.NewGeneratedVIFromCVI("vi-", f.Namespace().Name, object.PrecreatedCVIAlpineUEFI) err := f.CreateWithDeferredDeletion(context.Background(), vi) Expect(err).NotTo(HaveOccurred()) @@ -72,12 +66,7 @@ var _ = Describe("VirtualDiskProvisioning", func() { }) By("Creating VirtualDisk", func() { - vd = vdbuilder.New( - vdbuilder.WithName("vd"), - vdbuilder.WithNamespace(f.Namespace().Name), - vdbuilder.WithSize(ptr.To(resource.MustParse("350Mi"))), - vdbuilder.WithDataSourceObjectRefFromVI(vi), - ) + vd = object.NewVDFromVI("vd", f.Namespace().Name, vi, vdbuilder.WithSize(ptr.To(resource.MustParse("350Mi")))) err := f.CreateWithDeferredDeletion(context.Background(), vd) Expect(err).NotTo(HaveOccurred()) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index cd692a315e..cee161cb4f 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -41,9 +41,12 @@ func TestE2E(t *testing.T) { var _ = SynchronizedBeforeSuite(func() { controller.NewBeforeProcess1Body() legacy.NewBeforeProcess1Body() + bootstrapPrecreatedCVIs() }, func() {}) -var _ = SynchronizedAfterSuite(func() {}, func() { - DeferCleanup(legacy.NewAfterAllProcessBody) +var _ = SynchronizedAfterSuite(func() { + cleanupPrecreatedCVIs() +}, func() { + legacy.NewAfterAllProcessBody() controller.NewAfterAllProcessBody() }) diff --git a/test/e2e/go.mod b/test/e2e/go.mod index 0ad4e8cf42..e635c446ef 100644 --- a/test/e2e/go.mod +++ b/test/e2e/go.mod @@ -9,6 +9,7 @@ require ( github.com/deckhouse/virtualization/api v0.0.0-20240923080356-bb5809dba578 github.com/onsi/ginkgo/v2 v2.23.3 github.com/onsi/gomega v1.37.0 + github.com/stretchr/testify v1.11.1 gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.34.2 k8s.io/apimachinery v0.34.2 @@ -57,6 +58,7 @@ require ( github.com/openshift/custom-resource-status v1.1.2 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/spf13/cobra v1.9.1 // indirect github.com/spf13/pflag v1.0.7 // indirect github.com/x448/float16 v0.8.4 // indirect diff --git a/test/e2e/internal/config/cleanup.go b/test/e2e/internal/config/cleanup.go index b393c46608..17d0cc835e 100644 --- a/test/e2e/internal/config/cleanup.go +++ b/test/e2e/internal/config/cleanup.go @@ -25,6 +25,28 @@ import ( // PostCleanUpEnv defines an environment variable used to explicitly request the deletion of created/used resources. const PostCleanUpEnv = "POST_CLEANUP" +// PrecreatedCVICleanupEnv defines an environment variable to explicitly enable deletion of precreated CVIs after the suite. +// +// By default, precreated CVIs are not deleted: they are shared across runs and may be reused. +// Set PRECREATED_CVI_CLEANUP=yes to delete them after the suite; unset, empty, or "no" means no deletion. +const PrecreatedCVICleanupEnv = "PRECREATED_CVI_CLEANUP" + +func CheckPrecreatedCVICleanupOption() error { + env := os.Getenv(PrecreatedCVICleanupEnv) + switch env { + case "yes", "no", "": + return nil + default: + return fmt.Errorf("invalid value for %s env: %q (allowed: \"\", \"yes\", \"no\")", PrecreatedCVICleanupEnv, env) + } +} + +// IsPrecreatedCVICleanupNeeded returns true only when PRECREATED_CVI_CLEANUP is explicitly set to "yes". +// Default (unset, empty, or "no"): precreated CVIs are not deleted after the suite. +func IsPrecreatedCVICleanupNeeded() bool { + return os.Getenv(PrecreatedCVICleanupEnv) == "yes" +} + func CheckWithPostCleanUpOption() error { env := os.Getenv(PostCleanUpEnv) switch env { diff --git a/test/e2e/internal/label/label.go b/test/e2e/internal/label/label.go index bcf5a51abf..fab1a9bdb9 100644 --- a/test/e2e/internal/label/label.go +++ b/test/e2e/internal/label/label.go @@ -27,3 +27,7 @@ func Slow() Labels { func TPM() Labels { return Label("TPM") } + +func Legacy() Labels { + return Label("Legacy") +} diff --git a/test/e2e/internal/object/cloud_config.go b/test/e2e/internal/object/cloud_config.go new file mode 100644 index 0000000000..480ad8ba0a --- /dev/null +++ b/test/e2e/internal/object/cloud_config.go @@ -0,0 +1,80 @@ +/* +Copyright 2025 Flant JSC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package object + +import ( + "fmt" + + "k8s.io/utils/ptr" + "sigs.k8s.io/yaml" +) + +// CloudConfig mirrors the cloud-init cloud-config YAML schema. +// Only the keys used by e2e tests are included. +// See https://cloudinit.readthedocs.io/en/latest/reference/modules.html +type CloudConfig struct { + PackageUpdate bool `json:"package_update,omitempty"` + Packages []string `json:"packages,omitempty"` + WriteFiles []WriteFile `json:"write_files,omitempty"` + Users []CloudConfigUser `json:"users,omitempty"` + Runcmd []string `json:"runcmd,omitempty"` + SSHPwauth *bool `json:"ssh_pwauth,omitempty"` +} + +type CloudConfigUser struct { + Name string `json:"name"` + Passwd string `json:"passwd,omitempty"` + Shell string `json:"shell,omitempty"` + Sudo string `json:"sudo,omitempty"` + LockPasswd *bool `json:"lock_passwd,omitempty"` + SSHAuthorizedKeys []string `json:"ssh_authorized_keys,omitempty"` +} + +type WriteFile struct { + Path string `json:"path"` + Permissions string `json:"permissions,omitempty"` + Content string `json:"content,omitempty"` + Append bool `json:"append,omitempty"` +} + +const defaultSSHPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFxcXHmwaGnJ8scJaEN5RzklBPZpVSic4GdaAsKjQoeA your_email@example.com" + +// DefaultCloudUser returns the standard e2e test user (cloud/cloud) with SSH key. +func DefaultCloudUser() CloudConfigUser { + return CloudConfigUser{ + Name: DefaultUser, + Passwd: "$6$rounds=4096$vln/.aPHBOI7BMYR$bBMkqQvuGs5Gyd/1H5DP4m9HjQSy.kgrxpaGEHwkX7KEFV8BS.HZWPitAtZ2Vd8ZqIZRqmlykRCagTgPejt1i.", + Shell: "/bin/bash", + Sudo: "ALL=(ALL) NOPASSWD:ALL", + LockPasswd: ptr.To(false), + SSHAuthorizedKeys: []string{defaultSSHPublicKey}, + } +} + +var basePackages = []string{ + "qemu-guest-agent", "curl", "bash", "sudo", "util-linux", "iperf3", "jq", +} + +// Render serializes the CloudConfig to a valid cloud-init user-data string +// with the required #cloud-config header. +func (c CloudConfig) Render() string { + data, err := yaml.Marshal(c) + if err != nil { + panic(fmt.Sprintf("cloud-config marshal: %v", err)) + } + return "#cloud-config\n" + string(data) +} diff --git a/test/e2e/internal/object/cloud_config_test.go b/test/e2e/internal/object/cloud_config_test.go new file mode 100644 index 0000000000..259173a4b5 --- /dev/null +++ b/test/e2e/internal/object/cloud_config_test.go @@ -0,0 +1,149 @@ +/* +Copyright 2025 Flant JSC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package object + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "sigs.k8s.io/yaml" +) + +func TestCloudConfigRender(t *testing.T) { + tests := []struct { + name string + rendered string + }{ + {"AlpineCloudInit", AlpineCloudInit}, + {"UbuntuCloudInit", UbuntuCloudInit}, + {"PerfCloudInit", PerfCloudInit}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + require.True(t, strings.HasPrefix(tt.rendered, "#cloud-config\n"), + "cloud-init must start with #cloud-config header") + + var parsed map[string]interface{} + err := yaml.Unmarshal([]byte(tt.rendered), &parsed) + require.NoError(t, err, "cloud-init must be valid YAML") + + assert.Equal(t, true, parsed["package_update"]) + + users, ok := parsed["users"].([]interface{}) + require.True(t, ok, "users must be a list") + require.Len(t, users, 1) + + user := users[0].(map[string]interface{}) + assert.Equal(t, DefaultUser, user["name"]) + assert.Equal(t, false, user["lock_passwd"]) + + keys, ok := user["ssh_authorized_keys"].([]interface{}) + require.True(t, ok) + require.Len(t, keys, 1) + + runcmd, ok := parsed["runcmd"].([]interface{}) + require.True(t, ok, "runcmd must be a list") + assert.NotEmpty(t, runcmd) + }) + } +} + +func TestPerfCloudInitHasWriteFiles(t *testing.T) { + var parsed map[string]interface{} + err := yaml.Unmarshal([]byte(PerfCloudInit), &parsed) + require.NoError(t, err) + + writeFiles, ok := parsed["write_files"].([]interface{}) + require.True(t, ok, "PerfCloudInit must have write_files") + require.Len(t, writeFiles, 1) + + wf := writeFiles[0].(map[string]interface{}) + assert.Equal(t, "/usr/scripts/iperf3.sh", wf["path"]) + assert.Equal(t, "0755", wf["permissions"]) + + content, ok := wf["content"].(string) + require.True(t, ok) + assert.Contains(t, content, "#!/bin/bash") + assert.Contains(t, content, "iperf3") +} + +func TestPerfCloudInitGolden(t *testing.T) { + expected := `#cloud-config +package_update: true +packages: +- qemu-guest-agent +- curl +- bash +- sudo +- util-linux +- iperf3 +- jq +- iputils +runcmd: +- /usr/scripts/iperf3.sh +- rc-update add qemu-guest-agent && rc-service qemu-guest-agent start +- rc-update add iperf3 && rc-service iperf3 start +- rc-update add sshd && rc-service sshd start +users: +- lock_passwd: false + name: cloud + passwd: $6$rounds=4096$vln/.aPHBOI7BMYR$bBMkqQvuGs5Gyd/1H5DP4m9HjQSy.kgrxpaGEHwkX7KEFV8BS.HZWPitAtZ2Vd8ZqIZRqmlykRCagTgPejt1i. + shell: /bin/bash + ssh_authorized_keys: + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFxcXHmwaGnJ8scJaEN5RzklBPZpVSic4GdaAsKjQoeA + your_email@example.com + sudo: ALL=(ALL) NOPASSWD:ALL +write_files: +- content: | + #!/bin/bash + cat > /etc/init.d/iperf3 <<-"EOF" + #!/sbin/openrc-run + + name="iperf3" + description="iperf3 server" + command="/usr/bin/iperf3" + command_args="-s" + pidfile="/run/${name}.pid" + supervisor="supervise-daemon" + supervise_daemon_args="--respawn-delay 2 --stdout /var/log/iperf3.log --stderr /var/log/iperf3.log" + + depend() { + need net + } + + start_pre() { + checkpath --directory --owner root:root --mode 0755 /run + touch /var/log/iperf3.log + chmod 644 /var/log/iperf3.log + } + + stop_post() { + logger -t iperf3 "Stopped by $(whoami) at $(date)" + rm -f "$pidfile" + } + EOF + chmod +x /etc/init.d/iperf3 + rc-update add iperf3 default + path: /usr/scripts/iperf3.sh + permissions: "0755" +` + + assert.Equal(t, expected, PerfCloudInit) +} diff --git a/test/e2e/internal/object/const.go b/test/e2e/internal/object/const.go index 1214aab7cd..f8253a6320 100644 --- a/test/e2e/internal/object/const.go +++ b/test/e2e/internal/object/const.go @@ -16,94 +16,59 @@ limitations under the License. package object +const imageBaseURL = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru" + const ( - ImageURLAlpineUEFI = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2" - ImageURLAlpineBIOS = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-bios-base.qcow2" - ImagesURLAlpineUEFIPerf = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-21-uefi-perf.qcow2" - ImagesURLAlpineBIOSPerf = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-21-bios-perf.qcow2" - ImageURLUbuntu = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/ubuntu/ubuntu-24.04-minimal-cloudimg-amd64.qcow2" - ImageURLContainerImage = "cr.yandex/crpvs5j3nh1mi2tpithr/e2e/alpine/alpine-image:latest" - // No bootable - ImageTestDataQCOW = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/test/test.qcow2" - ImageTestDataISO = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/test/test.iso" - Mi256 = 256 * 1024 * 1024 - DefaultVMClass = "generic" - - cloudInitBase = `#cloud-config -package_update: true -packages: - - qemu-guest-agent - - curl - - bash - - sudo - - iputils - - util-linux - - iperf3 - - jq -` - cloudInitUsers = ` -users: - - name: cloud - # passwd: cloud - passwd: $6$rounds=4096$vln/.aPHBOI7BMYR$bBMkqQvuGs5Gyd/1H5DP4m9HjQSy.kgrxpaGEHwkX7KEFV8BS.HZWPitAtZ2Vd8ZqIZRqmlykRCagTgPejt1i. - shell: /bin/bash - sudo: ALL=(ALL) NOPASSWD:ALL - lock_passwd: false - ssh_authorized_keys: - # testcases - - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFxcXHmwaGnJ8scJaEN5RzklBPZpVSic4GdaAsKjQoeA your_email@example.com -` - cloudInitDefaultRuncmd = ` -runcmd: -- "rc-update add qemu-guest-agent && rc-service qemu-guest-agent start" -` + ImageURLAlpineUEFI = imageBaseURL + "/alpine/alpine-3-23-3-uefi-base.qcow2" + ImageURLAlpineBIOS = imageBaseURL + "/alpine/alpine-3-23-3-bios-base.qcow2" + ImageURLAlpineUEFIPerf = imageBaseURL + "/alpine/alpine-3-21-uefi-perf.qcow2" + ImageURLAlpineBIOSPerf = imageBaseURL + "/alpine/alpine-3-21-bios-perf.qcow2" + ImageURLUbuntu = imageBaseURL + "/ubuntu/ubuntu-24.04-minimal-cloudimg-amd64.qcow2" + ImageURLUbuntuISO = imageBaseURL + "/ubuntu/ubuntu-24.04.2-live-server-amd64.iso" + ImageURLCirros = imageBaseURL + "/cirros/cirros-0.5.1.qcow2" + ImageURLDebian = imageBaseURL + "/debian/debian-12-with-tpm2-tools-amd64-20250814-2204.qcow2" - DefaultCloudInit = cloudInitBase + cloudInitUsers + cloudInitDefaultRuncmd - - cloudInitPerfWriteFiles = ` -write_files: -- path: /usr/scripts/iperf3.sh - permissions: '0755' - content: | - #!/bin/bash - cat > /etc/init.d/iperf3 <<-"EOF" - #!/sbin/openrc-run - - name="iperf3" - description="iperf3 server" - command="/usr/bin/iperf3" - command_args="-s" - pidfile="/run/${name}.pid" - supervisor="supervise-daemon" - supervise_daemon_args="--respawn-delay 2 --stdout /var/log/iperf3.log --stderr /var/log/iperf3.log" - - depend() { - need net - } - - start_pre() { - checkpath --directory --owner root:root --mode 0755 /run - touch /var/log/iperf3.log - chmod 644 /var/log/iperf3.log - } - - stop_post() { - logger -t iperf3 "Stopped by $(whoami) at $(date)" - rm -f "$pidfile" - } - EOF - chmod +x /etc/init.d/iperf3 - rc-update add iperf3 default -` - cloudInitPerfRuncmd = ` -runcmd: -- "/usr/scripts/iperf3.sh" -- "rc-update add qemu-guest-agent && rc-service qemu-guest-agent start" -- "rc-update add iperf3 && rc-service iperf3 start" -- "rc-update add sshd && rc-service sshd start" + ImageURLContainerImage = "cr.yandex/crpvs5j3nh1mi2tpithr/e2e/alpine/alpine-image:latest" + ImageURLLegacyContainerImage = "cr.yandex/crpvs5j3nh1mi2tpithr/e2e/alpine/alpine-3-20:latest" + + // Not bootable + ImageTestDataQCOW = imageBaseURL + "/test/test.qcow2" + ImageTestDataISO = imageBaseURL + "/test/test.iso" + + Mi256 = 256 * 1024 * 1024 + DefaultVMClass = "generic" + + iperf3Script = `#!/bin/bash +cat > /etc/init.d/iperf3 <<-"EOF" +#!/sbin/openrc-run + +name="iperf3" +description="iperf3 server" +command="/usr/bin/iperf3" +command_args="-s" +pidfile="/run/${name}.pid" +supervisor="supervise-daemon" +supervise_daemon_args="--respawn-delay 2 --stdout /var/log/iperf3.log --stderr /var/log/iperf3.log" + +depend() { + need net +} + +start_pre() { + checkpath --directory --owner root:root --mode 0755 /run + touch /var/log/iperf3.log + chmod 644 /var/log/iperf3.log +} + +stop_post() { + logger -t iperf3 "Stopped by $(whoami) at $(date)" + rm -f "$pidfile" +} +EOF +chmod +x /etc/init.d/iperf3 +rc-update add iperf3 default ` - PerfCloudInit = cloudInitBase + cloudInitPerfWriteFiles + cloudInitUsers + cloudInitPerfRuncmd DefaultSSHPrivateKey = `-----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW QyNTUxOQAAACBcXFx5sGhpyfLHCWhDeUc5JQT2aVUonOBnWgLCo0KHgAAAAKDCANDUwgDQ @@ -113,7 +78,37 @@ BPZpVSic4GdaAsKjQoeAAAAAFnlvdXJfZW1haWxAZXhhbXBsZS5jb20BAgMEBQYH -----END OPENSSH PRIVATE KEY----- ` - DefaultSSHPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFxcXHmwaGnJ8scJaEN5RzklBPZpVSic4GdaAsKjQoeA your_email@example.com" - DefaultUser = "cloud" - DefaultPassword = "cloud" + DefaultUser = "cloud" + DefaultPassword = "cloud" ) + +var AlpineCloudInit = CloudConfig{ + PackageUpdate: true, + Packages: append(basePackages, "iputils"), + Users: []CloudConfigUser{DefaultCloudUser()}, + Runcmd: []string{"rc-update add qemu-guest-agent && rc-service qemu-guest-agent start"}, +}.Render() + +var UbuntuCloudInit = CloudConfig{ + PackageUpdate: true, + Packages: append(basePackages, "iputils-ping"), + Users: []CloudConfigUser{DefaultCloudUser()}, + Runcmd: []string{"systemctl enable --now qemu-guest-agent"}, +}.Render() + +var PerfCloudInit = CloudConfig{ + PackageUpdate: true, + Packages: append(basePackages, "iputils"), + WriteFiles: []WriteFile{{ + Path: "/usr/scripts/iperf3.sh", + Permissions: "0755", + Content: iperf3Script, + }}, + Users: []CloudConfigUser{DefaultCloudUser()}, + Runcmd: []string{ + "/usr/scripts/iperf3.sh", + "rc-update add qemu-guest-agent && rc-service qemu-guest-agent start", + "rc-update add iperf3 && rc-service iperf3 start", + "rc-update add sshd && rc-service sshd start", + }, +}.Render() diff --git a/test/e2e/internal/object/precreated_cvi.go b/test/e2e/internal/object/precreated_cvi.go new file mode 100644 index 0000000000..3707807798 --- /dev/null +++ b/test/e2e/internal/object/precreated_cvi.go @@ -0,0 +1,69 @@ +/* +Copyright 2026 Flant JSC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package object + +import ( + "github.com/deckhouse/virtualization-controller/pkg/builder/cvi" + "github.com/deckhouse/virtualization/api/core/v1alpha2" +) + +const ( + PrecreatedCVIAlpineUEFI = "v12n-e2e-alpine-uefi" + PrecreatedCVIAlpineBIOS = "v12n-e2e-alpine-bios" + PrecreatedCVIAlpineUEFIPerf = "v12n-e2e-alpine-uefi-perf" + PrecreatedCVIAlpineBIOSPerf = "v12n-e2e-alpine-bios-perf" + PrecreatedCVIUbuntu = "v12n-e2e-ubuntu" + PrecreatedCVIUbuntuISO = "v12n-e2e-ubuntu-iso" + PrecreatedCVIContainerImage = "v12n-e2e-container-image" + PrecreatedCVILegacyRegistry = "v12n-e2e-legacy-registry" + PrecreatedCVICirros = "v12n-e2e-cirros" + PrecreatedCVIDebian = "v12n-e2e-debian" + PrecreatedCVITestDataQCOW = "v12n-e2e-testdata-qcow" + PrecreatedCVITestDataISO = "v12n-e2e-testdata-iso" +) + +// PrecreatedClusterVirtualImages returns the suite-wide CVIs shared by e2e tests. +func PrecreatedClusterVirtualImages() []*v1alpha2.ClusterVirtualImage { + return []*v1alpha2.ClusterVirtualImage{ + newPrecreatedHTTPCVI(PrecreatedCVIAlpineUEFI, ImageURLAlpineUEFI), + newPrecreatedHTTPCVI(PrecreatedCVIAlpineBIOS, ImageURLAlpineBIOS), + newPrecreatedHTTPCVI(PrecreatedCVIAlpineUEFIPerf, ImageURLAlpineUEFIPerf), + newPrecreatedHTTPCVI(PrecreatedCVIAlpineBIOSPerf, ImageURLAlpineBIOSPerf), + newPrecreatedHTTPCVI(PrecreatedCVIUbuntu, ImageURLUbuntu), + newPrecreatedHTTPCVI(PrecreatedCVIUbuntuISO, ImageURLUbuntuISO), + newPrecreatedContainerImageCVI(PrecreatedCVIContainerImage, ImageURLContainerImage), + newPrecreatedContainerImageCVI(PrecreatedCVILegacyRegistry, ImageURLLegacyContainerImage), + newPrecreatedHTTPCVI(PrecreatedCVICirros, ImageURLCirros), + newPrecreatedHTTPCVI(PrecreatedCVIDebian, ImageURLDebian), + newPrecreatedHTTPCVI(PrecreatedCVITestDataQCOW, ImageTestDataQCOW), + newPrecreatedHTTPCVI(PrecreatedCVITestDataISO, ImageTestDataISO), + } +} + +func newPrecreatedHTTPCVI(name, imageURL string) *v1alpha2.ClusterVirtualImage { + return cvi.New( + cvi.WithName(name), + cvi.WithDataSourceHTTP(imageURL, nil, nil), + ) +} + +func newPrecreatedContainerImageCVI(name, imageURL string) *v1alpha2.ClusterVirtualImage { + return cvi.New( + cvi.WithName(name), + cvi.WithDataSourceContainerImage(imageURL, v1alpha2.ImagePullSecret{}, nil), + ) +} diff --git a/test/e2e/internal/object/vd.go b/test/e2e/internal/object/vd.go index e37beb9298..22606643b8 100644 --- a/test/e2e/internal/object/vd.go +++ b/test/e2e/internal/object/vd.go @@ -55,13 +55,11 @@ func NewHTTPVDAlpineBIOS(name, namespace string, opts ...vd.Option) *v1alpha2.Vi return vd.New(baseOpts...) } -func NewHTTPVDAlpineUEFIPerf(name, namespace string, opts ...vd.Option) *v1alpha2.VirtualDisk { +func NewVDFromCVI(name, namespace, cviName string, opts ...vd.Option) *v1alpha2.VirtualDisk { baseOpts := []vd.Option{ vd.WithName(name), vd.WithNamespace(namespace), - vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: ImagesURLAlpineUEFIPerf, - }), + vd.WithDataSourceObjectRef(v1alpha2.VirtualDiskObjectRefKindClusterVirtualImage, cviName), } baseOpts = append(baseOpts, opts...) return vd.New(baseOpts...) diff --git a/test/e2e/internal/object/vi.go b/test/e2e/internal/object/vi.go index 288b94bf18..08ef4ead45 100644 --- a/test/e2e/internal/object/vi.go +++ b/test/e2e/internal/object/vi.go @@ -39,7 +39,7 @@ func NewGeneratedHTTPVIAlpineBIOSPerf(prefix, namespace string, opts ...vi.Optio vi.WithGenerateName(prefix), vi.WithNamespace(namespace), vi.WithDataSourceHTTP( - ImagesURLAlpineBIOSPerf, nil, nil, + ImageURLAlpineBIOSPerf, nil, nil, ), vi.WithStorage(v1alpha2.StorageContainerRegistry), } @@ -57,3 +57,14 @@ func NewGeneratedContainerImageVI(prefix, namespace string, opts ...vi.Option) * baseOpts = append(baseOpts, opts...) return vi.New(baseOpts...) } + +func NewGeneratedVIFromCVI(prefix, namespace, cviName string, opts ...vi.Option) *v1alpha2.VirtualImage { + baseOpts := []vi.Option{ + vi.WithGenerateName(prefix), + vi.WithNamespace(namespace), + vi.WithStorage(v1alpha2.StorageContainerRegistry), + vi.WithDataSourceObjectRef(v1alpha2.VirtualImageObjectRefKindClusterVirtualImage, cviName), + } + baseOpts = append(baseOpts, opts...) + return vi.New(baseOpts...) +} diff --git a/test/e2e/internal/object/vm.go b/test/e2e/internal/object/vm.go index 386c7b543f..12abd5232d 100644 --- a/test/e2e/internal/object/vm.go +++ b/test/e2e/internal/object/vm.go @@ -31,7 +31,7 @@ func NewMinimalVM(prefix, namespace string, opts ...vm.Option) *v1alpha2.Virtual vm.WithCPU(1, ptr.To("20%")), vm.WithMemory(*resource.NewQuantity(Mi256, resource.BinarySI)), vm.WithLiveMigrationPolicy(v1alpha2.AlwaysSafeMigrationPolicy), - vm.WithProvisioningUserData(DefaultCloudInit), + vm.WithProvisioningUserData(AlpineCloudInit), } baseOpts = append(baseOpts, opts...) return vm.New(baseOpts...) diff --git a/test/e2e/internal/precreatedcvi/manager.go b/test/e2e/internal/precreatedcvi/manager.go new file mode 100644 index 0000000000..a4880711f8 --- /dev/null +++ b/test/e2e/internal/precreatedcvi/manager.go @@ -0,0 +1,133 @@ +/* +Copyright 2026 Flant JSC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package precreatedcvi provides suite-level lifecycle (bootstrap and cleanup) for +// precreated ClusterVirtualImages used by e2e tests. +package precreatedcvi + +import ( + "context" + "fmt" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + k8serrors "k8s.io/apimachinery/pkg/api/errors" + crclient "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/deckhouse/virtualization/api/core/v1alpha2" + "github.com/deckhouse/virtualization/test/e2e/internal/config" + "github.com/deckhouse/virtualization/test/e2e/internal/framework" + "github.com/deckhouse/virtualization/test/e2e/internal/object" + "github.com/deckhouse/virtualization/test/e2e/internal/util" +) + +const labelKey = "v12n-e2e-precreated" + +// PrecreatedCVIManager runs bootstrap and cleanup of precreated CVIs for the e2e suite. +// The list of CVIs is loaded once during Bootstrap and reused in Cleanup. +type PrecreatedCVIManager struct { + cvis []*v1alpha2.ClusterVirtualImage +} + +// NewPrecreatedCVIManager returns a new precreated CVI manager. +func NewPrecreatedCVIManager() *PrecreatedCVIManager { + return &PrecreatedCVIManager{} +} + +// Bootstrap creates or reuses precreated CVIs in the cluster, then waits until all are ready. +// Call once from SynchronizedBeforeSuite (process 1). +func (m *PrecreatedCVIManager) Bootstrap(ctx context.Context) { + GinkgoHelper() + + m.cvis = object.PrecreatedClusterVirtualImages() + + var created, reused []string + for _, cvi := range m.cvis { + wasCreated, err := m.createOrReuse(ctx, cvi) + Expect(err).NotTo(HaveOccurred()) + if wasCreated { + created = append(created, cvi.Name) + } else { + reused = append(reused, cvi.Name) + } + } + + if len(created) > 0 { + for _, name := range created { + By(fmt.Sprintf("Precreated CVI %q has been created", name)) + } + } + if len(reused) > 0 { + By(fmt.Sprintf("Reusing %d precreated CVIs that already exist in the cluster", len(reused))) + } + + By(fmt.Sprintf("Wait until all %d precreated CVIs are ready", len(m.cvis))) + //nolint:contextcheck // UntilObjectPhase uses Eventually.WithTimeout for cancellation, not context cancel. + util.UntilObjectPhase(string(v1alpha2.ImageReady), framework.LongTimeout, m.cvisAsObjects()...) + By(fmt.Sprintf("All %d precreated CVIs are ready", len(m.cvis))) +} + +// Cleanup deletes precreated CVIs when both POST_CLEANUP and PRECREATED_CVI_CLEANUP allow it. +// Call from SynchronizedAfterSuite (process 1). Uses the same CVI list as Bootstrap; if Bootstrap +// was not run, the list is loaded from object so that cleanup can still run. +func (m *PrecreatedCVIManager) Cleanup(ctx context.Context) { + GinkgoHelper() + + if !config.IsCleanUpNeeded() { + return + } + if !config.IsPrecreatedCVICleanupNeeded() { + return + } + + if len(m.cvis) == 0 { + m.cvis = object.PrecreatedClusterVirtualImages() + } + + f := framework.NewFramework("") + err := f.Delete(ctx, m.cvisAsObjects()...) + Expect(err).NotTo(HaveOccurred(), "Failed to delete precreated CVIs") +} + +func (m *PrecreatedCVIManager) createOrReuse(ctx context.Context, cvi *v1alpha2.ClusterVirtualImage) (bool, error) { + applyLabel(cvi) + + err := framework.GetClients().GenericClient().Create(ctx, cvi) + if err == nil { + return true, nil + } + if !k8serrors.IsAlreadyExists(err) { + return false, err + } + return false, framework.GetClients().GenericClient().Get(ctx, crclient.ObjectKeyFromObject(cvi), cvi) +} + +func (m *PrecreatedCVIManager) cvisAsObjects() []crclient.Object { + objs := make([]crclient.Object, 0, len(m.cvis)) + for _, cvi := range m.cvis { + objs = append(objs, cvi) + } + return objs +} + +func applyLabel(cvi *v1alpha2.ClusterVirtualImage) { + labels := cvi.GetLabels() + if labels == nil { + labels = make(map[string]string) + } + labels[labelKey] = "true" + cvi.SetLabels(labels) +} diff --git a/test/e2e/legacy/affinity_toleration.go b/test/e2e/legacy/affinity_toleration.go index 3ac178784d..c83900e74b 100644 --- a/test/e2e/legacy/affinity_toleration.go +++ b/test/e2e/legacy/affinity_toleration.go @@ -31,9 +31,10 @@ import ( "github.com/deckhouse/virtualization/api/core/v1alpha2" "github.com/deckhouse/virtualization/api/core/v1alpha2/vmcondition" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" ) -var _ = Describe("VirtualMachineAffinityAndToleration", Ordered, func() { +var _ = Describe("VirtualMachineAffinityAndToleration", Ordered, label.Legacy(), func() { const ( nodeLabelKey = "kubernetes.io/hostname" masterLabelKey = "node.deckhouse.io/group" @@ -79,13 +80,6 @@ var _ = Describe("VirtualMachineAffinityAndToleration", Ordered, func() { }) It("checks the resources phase", func() { - By(fmt.Sprintf("`VirtualImages` should be in the %q phase", v1alpha2.ImageReady), func() { - WaitPhaseByLabel(kc.ResourceVI, PhaseReady, kc.WaitOptions{ - Labels: testCaseLabel, - Namespace: ns, - Timeout: MaxWaitTimeout, - }) - }) By(fmt.Sprintf("`VirtualMachineClasses` should be in %s phases", v1alpha2.ClassPhaseReady), func() { WaitPhaseByLabel(kc.ResourceVMClass, PhaseReady, kc.WaitOptions{ Labels: testCaseLabel, diff --git a/test/e2e/legacy/complex.go b/test/e2e/legacy/complex.go index f453d5bf44..d661ad0b94 100644 --- a/test/e2e/legacy/complex.go +++ b/test/e2e/legacy/complex.go @@ -28,6 +28,7 @@ import ( "github.com/deckhouse/virtualization/test/e2e/internal/config" "github.com/deckhouse/virtualization/test/e2e/internal/framework" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" "github.com/deckhouse/virtualization/test/e2e/internal/util" ) @@ -36,7 +37,7 @@ const ( antiAffinityLabel = "anti-affinity" ) -var _ = Describe("ComplexTest", Ordered, func() { +var _ = Describe("ComplexTest", Ordered, label.Legacy(), func() { var ( testCaseLabel = map[string]string{"testcase": "complex-test"} hasNoConsumerLabel = map[string]string{"hasNoConsumer": "complex-test"} @@ -95,17 +96,6 @@ var _ = Describe("ComplexTest", Ordered, func() { }) }) - Context("When cluster virtual images are applied", func() { - It("checks CVIs phases", func() { - By(fmt.Sprintf("CVIs should be in %s phases", PhaseReady)) - WaitPhaseByLabel(kc.ResourceCVI, PhaseReady, kc.WaitOptions{ - Labels: testCaseLabel, - Namespace: ns, - Timeout: MaxWaitTimeout, - }) - }) - }) - Context("When virtual machine classes are applied", func() { It("checks VMClasses phases", func() { By(fmt.Sprintf("VMClasses should be in %s phases", PhaseReady)) diff --git a/test/e2e/legacy/image_hotplug.go b/test/e2e/legacy/image_hotplug.go index fff208775b..364e5f93a6 100644 --- a/test/e2e/legacy/image_hotplug.go +++ b/test/e2e/legacy/image_hotplug.go @@ -31,9 +31,11 @@ import ( "github.com/deckhouse/virtualization/test/e2e/internal/d8" "github.com/deckhouse/virtualization/test/e2e/internal/framework" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" + "github.com/deckhouse/virtualization/test/e2e/internal/object" ) -var _ = Describe("ImageHotplug", Ordered, func() { +var _ = Describe("ImageHotplug", Ordered, label.Legacy(), func() { const ( viCount = 2 cviCount = 2 @@ -59,13 +61,6 @@ var _ = Describe("ImageHotplug", Ordered, func() { ns, err = kustomize.GetNamespace(kustomization) Expect(err).NotTo(HaveOccurred(), "%w", err) - res := kubectl.Delete(kc.DeleteOptions{ - IgnoreNotFound: true, - Labels: testCaseLabel, - Resource: kc.ResourceCVI, - }) - Expect(res.Error()).NotTo(HaveOccurred()) - CreateNamespace(ns) }) @@ -92,13 +87,6 @@ var _ = Describe("ImageHotplug", Ordered, func() { Timeout: MaxWaitTimeout, }) }) - By(fmt.Sprintf("`ClusterVirtualImages` should be in the %q phase", v1alpha2.ImageReady), func() { - WaitPhaseByLabel(kc.ResourceCVI, PhaseReady, kc.WaitOptions{ - Labels: testCaseLabel, - Namespace: ns, - Timeout: MaxWaitTimeout, - }) - }) By(fmt.Sprintf("`VirtualDisk` should be in the %q phase", v1alpha2.DiskReady), func() { WaitPhaseByLabel(kc.ResourceVD, PhaseReady, kc.WaitOptions{ Labels: testCaseLabel, @@ -146,14 +134,13 @@ var _ = Describe("ImageHotplug", Ordered, func() { } }) By("`ClusterVirtualImages`", func() { - cviObjs := &v1alpha2.ClusterVirtualImageList{} - err := GetObjects(v1alpha2.ClusterVirtualImageResource, cviObjs, kc.GetOptions{ - Labels: testCaseLabel, - Namespace: ns, - }) - Expect(err).NotTo(HaveOccurred(), "failed to get `ClusterVirtualImages`: %s", err) + // Get precreated CVIs by name (they are created in bootstrap) + cviNames := []string{object.PrecreatedCVIAlpineBIOSPerf, object.PrecreatedCVIUbuntuISO} + for _, cviName := range cviNames { + cviObj := &v1alpha2.ClusterVirtualImage{} + err := GetObject(kc.ResourceCVI, cviName, cviObj, kc.GetOptions{}) + Expect(err).NotTo(HaveOccurred(), "failed to get CVI %q: %s", cviName, err) - for _, cviObj := range cviObjs.Items { imageBlockDevices = append(imageBlockDevices, Image{ Kind: cviObj.Kind, Name: cviObj.Name, diff --git a/test/e2e/legacy/legacy.go b/test/e2e/legacy/legacy.go index 119e535c0a..a9b264846f 100644 --- a/test/e2e/legacy/legacy.go +++ b/test/e2e/legacy/legacy.go @@ -72,6 +72,9 @@ func configure() (err error) { if err = config.CheckWithPostCleanUpOption(); err != nil { return err } + if err = config.CheckPrecreatedCVICleanupOption(); err != nil { + return err + } conf = framework.GetConfig() defer framework.SetConfig(conf) diff --git a/test/e2e/legacy/testdata/affinity-toleration/kustomization.yaml b/test/e2e/legacy/testdata/affinity-toleration/kustomization.yaml index b926264feb..29eb528cd6 100644 --- a/test/e2e/legacy/testdata/affinity-toleration/kustomization.yaml +++ b/test/e2e/legacy/testdata/affinity-toleration/kustomization.yaml @@ -5,7 +5,6 @@ namePrefix: pr-number-or-commit-hash- resources: - ns.yaml - vmc.yaml - - vi - vm configurations: - transformer.yaml diff --git a/test/e2e/legacy/testdata/affinity-toleration/vi/kustomization.yaml b/test/e2e/legacy/testdata/affinity-toleration/vi/kustomization.yaml deleted file mode 100644 index b807d8e2d2..0000000000 --- a/test/e2e/legacy/testdata/affinity-toleration/vi/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - vi-alpine-http.yaml diff --git a/test/e2e/legacy/testdata/affinity-toleration/vi/vi-alpine-http.yaml b/test/e2e/legacy/testdata/affinity-toleration/vi/vi-alpine-http.yaml deleted file mode 100644 index 43bc57dd27..0000000000 --- a/test/e2e/legacy/testdata/affinity-toleration/vi/vi-alpine-http.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: VirtualImage -metadata: - name: vi-alpine-http -spec: - storage: ContainerRegistry - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2 diff --git a/test/e2e/legacy/testdata/affinity-toleration/vm/base/vd-root.yaml b/test/e2e/legacy/testdata/affinity-toleration/vm/base/vd-root.yaml index c2bf54f1ff..7442dd263a 100644 --- a/test/e2e/legacy/testdata/affinity-toleration/vm/base/vd-root.yaml +++ b/test/e2e/legacy/testdata/affinity-toleration/vm/base/vd-root.yaml @@ -9,5 +9,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http + kind: ClusterVirtualImage + name: v12n-e2e-alpine-uefi diff --git a/test/e2e/legacy/testdata/complex-test/cvi/cvi-alpine-http.yaml b/test/e2e/legacy/testdata/complex-test/cvi/cvi-alpine-http.yaml deleted file mode 100644 index 3826b75660..0000000000 --- a/test/e2e/legacy/testdata/complex-test/cvi/cvi-alpine-http.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: ClusterVirtualImage -metadata: - name: cvi-alpine-http -spec: - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-bios-base.qcow2 diff --git a/test/e2e/legacy/testdata/complex-test/cvi/cvi-alpine-registry.yaml b/test/e2e/legacy/testdata/complex-test/cvi/cvi-alpine-registry.yaml deleted file mode 100644 index 1ed794c4a7..0000000000 --- a/test/e2e/legacy/testdata/complex-test/cvi/cvi-alpine-registry.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: ClusterVirtualImage -metadata: - name: cvi-alpine-registry -spec: - dataSource: - type: ContainerImage - containerImage: - image: cr.yandex/crpvs5j3nh1mi2tpithr/e2e/alpine/alpine-3-20:latest diff --git a/test/e2e/legacy/testdata/complex-test/cvi/cvi-from-cvi-alpine-http.yaml b/test/e2e/legacy/testdata/complex-test/cvi/cvi-from-cvi-alpine-http.yaml deleted file mode 100644 index ef2d273df0..0000000000 --- a/test/e2e/legacy/testdata/complex-test/cvi/cvi-from-cvi-alpine-http.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: ClusterVirtualImage -metadata: - name: cvi-from-cvi-alpine-http -spec: - dataSource: - type: ObjectRef - objectRef: - kind: ClusterVirtualImage - name: cvi-alpine-http diff --git a/test/e2e/legacy/testdata/complex-test/cvi/cvi-from-vi-alpine-http.yaml b/test/e2e/legacy/testdata/complex-test/cvi/cvi-from-vi-alpine-http.yaml deleted file mode 100644 index 82a6b78511..0000000000 --- a/test/e2e/legacy/testdata/complex-test/cvi/cvi-from-vi-alpine-http.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: ClusterVirtualImage -metadata: - name: cvi-from-vi-alpine-http -spec: - dataSource: - type: ObjectRef - objectRef: - kind: VirtualImage - name: vi-alpine-http - namespace: testcases diff --git a/test/e2e/legacy/testdata/complex-test/cvi/kustomization.yaml b/test/e2e/legacy/testdata/complex-test/cvi/kustomization.yaml deleted file mode 100644 index e29a962fb2..0000000000 --- a/test/e2e/legacy/testdata/complex-test/cvi/kustomization.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - cvi-alpine-http.yaml - - cvi-alpine-registry.yaml - - cvi-from-vi-alpine-http.yaml - - cvi-from-cvi-alpine-http.yaml diff --git a/test/e2e/legacy/testdata/complex-test/kustomization.yaml b/test/e2e/legacy/testdata/complex-test/kustomization.yaml index 513374bd51..117a17ee55 100644 --- a/test/e2e/legacy/testdata/complex-test/kustomization.yaml +++ b/test/e2e/legacy/testdata/complex-test/kustomization.yaml @@ -5,7 +5,6 @@ namePrefix: pr-number-or-commit-hash- resources: - ns.yaml - vmc.yaml - - cvi - vi - vd - vm diff --git a/test/e2e/legacy/testdata/complex-test/vd/vd-from-cvi-alpine-http.yaml b/test/e2e/legacy/testdata/complex-test/vd/vd-from-cvi-alpine-http.yaml index 932d037197..eb9c497f58 100644 --- a/test/e2e/legacy/testdata/complex-test/vd/vd-from-cvi-alpine-http.yaml +++ b/test/e2e/legacy/testdata/complex-test/vd/vd-from-cvi-alpine-http.yaml @@ -10,4 +10,4 @@ spec: type: ObjectRef objectRef: kind: ClusterVirtualImage - name: cvi-alpine-http + name: v12n-e2e-alpine-bios diff --git a/test/e2e/legacy/testdata/complex-test/vd/vd-from-cvi-alpine-registry.yaml b/test/e2e/legacy/testdata/complex-test/vd/vd-from-cvi-alpine-registry.yaml index c6546b51a1..37ff0e357d 100644 --- a/test/e2e/legacy/testdata/complex-test/vd/vd-from-cvi-alpine-registry.yaml +++ b/test/e2e/legacy/testdata/complex-test/vd/vd-from-cvi-alpine-registry.yaml @@ -10,4 +10,4 @@ spec: type: ObjectRef objectRef: kind: ClusterVirtualImage - name: cvi-alpine-registry + name: v12n-e2e-legacy-registry diff --git a/test/e2e/legacy/testdata/complex-test/vi/vi-from-cvi-alpine-http.yaml b/test/e2e/legacy/testdata/complex-test/vi/vi-from-cvi-alpine-http.yaml index 8de3cac5fe..58f2bb09e6 100644 --- a/test/e2e/legacy/testdata/complex-test/vi/vi-from-cvi-alpine-http.yaml +++ b/test/e2e/legacy/testdata/complex-test/vi/vi-from-cvi-alpine-http.yaml @@ -9,4 +9,4 @@ spec: type: ObjectRef objectRef: kind: ClusterVirtualImage - name: cvi-alpine-http + name: v12n-e2e-alpine-bios diff --git a/test/e2e/legacy/testdata/complex-test/vm/overlays/with-mounted-cvi/kustomization.yaml b/test/e2e/legacy/testdata/complex-test/vm/overlays/with-mounted-cvi/kustomization.yaml index 4486400e07..b72053755c 100644 --- a/test/e2e/legacy/testdata/complex-test/vm/overlays/with-mounted-cvi/kustomization.yaml +++ b/test/e2e/legacy/testdata/complex-test/vm/overlays/with-mounted-cvi/kustomization.yaml @@ -9,7 +9,7 @@ patches: path: /spec/blockDeviceRefs/- value: { "kind": "ClusterVirtualImage", - "name": "cvi-alpine-registry" + "name": "v12n-e2e-legacy-registry" } target: kind: VirtualMachine diff --git a/test/e2e/legacy/testdata/disk-resizing/base/vd-root.yaml b/test/e2e/legacy/testdata/disk-resizing/base/vd-root.yaml index 0f98ff3633..b4f9cd0c2c 100644 --- a/test/e2e/legacy/testdata/disk-resizing/base/vd-root.yaml +++ b/test/e2e/legacy/testdata/disk-resizing/base/vd-root.yaml @@ -9,5 +9,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http + kind: ClusterVirtualImage + name: v12n-e2e-alpine-uefi-perf diff --git a/test/e2e/legacy/testdata/disk-resizing/kustomization.yaml b/test/e2e/legacy/testdata/disk-resizing/kustomization.yaml index 404986a0f4..a30957df4a 100644 --- a/test/e2e/legacy/testdata/disk-resizing/kustomization.yaml +++ b/test/e2e/legacy/testdata/disk-resizing/kustomization.yaml @@ -5,7 +5,6 @@ namePrefix: pr-number-or-commit-hash- resources: - ns.yaml - overlays/automatic-with-hotplug - - vi configurations: - transformer.yaml labels: diff --git a/test/e2e/legacy/testdata/disk-resizing/vi/kustomization.yaml b/test/e2e/legacy/testdata/disk-resizing/vi/kustomization.yaml deleted file mode 100644 index b807d8e2d2..0000000000 --- a/test/e2e/legacy/testdata/disk-resizing/vi/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - vi-alpine-http.yaml diff --git a/test/e2e/legacy/testdata/disk-resizing/vi/vi-alpine-http.yaml b/test/e2e/legacy/testdata/disk-resizing/vi/vi-alpine-http.yaml deleted file mode 100644 index abac06b48c..0000000000 --- a/test/e2e/legacy/testdata/disk-resizing/vi/vi-alpine-http.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: VirtualImage -metadata: - name: vi-alpine-http -spec: - storage: ContainerRegistry - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-21-uefi-perf.qcow2 diff --git a/test/e2e/legacy/testdata/image-hotplug/cvi/cvi-alpine-http.yaml b/test/e2e/legacy/testdata/image-hotplug/cvi/cvi-alpine-http.yaml deleted file mode 100644 index 3642c4ded9..0000000000 --- a/test/e2e/legacy/testdata/image-hotplug/cvi/cvi-alpine-http.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: ClusterVirtualImage -metadata: - name: cvi-alpine-http -spec: - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-21-bios-perf.qcow2 diff --git a/test/e2e/legacy/testdata/image-hotplug/cvi/cvi-ubuntu-2404-iso.yaml b/test/e2e/legacy/testdata/image-hotplug/cvi/cvi-ubuntu-2404-iso.yaml deleted file mode 100644 index 43dfa50383..0000000000 --- a/test/e2e/legacy/testdata/image-hotplug/cvi/cvi-ubuntu-2404-iso.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: ClusterVirtualImage -metadata: - name: cvi-ubuntu-2404-iso -spec: - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/ubuntu/ubuntu-24.04.2-live-server-amd64.iso diff --git a/test/e2e/legacy/testdata/image-hotplug/cvi/kustomization.yaml b/test/e2e/legacy/testdata/image-hotplug/cvi/kustomization.yaml deleted file mode 100644 index 0806b261ea..0000000000 --- a/test/e2e/legacy/testdata/image-hotplug/cvi/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - cvi-alpine-http.yaml - - cvi-ubuntu-2404-iso.yaml diff --git a/test/e2e/legacy/testdata/image-hotplug/kustomization.yaml b/test/e2e/legacy/testdata/image-hotplug/kustomization.yaml index de34bd39a7..a642cb0684 100644 --- a/test/e2e/legacy/testdata/image-hotplug/kustomization.yaml +++ b/test/e2e/legacy/testdata/image-hotplug/kustomization.yaml @@ -5,7 +5,6 @@ namePrefix: pr-number-or-commit-hash- resources: - ns.yaml - vi - - cvi - overlays/image-hotplug configurations: - transformer.yaml diff --git a/test/e2e/legacy/testdata/vd-snapshots/kustomization.yaml b/test/e2e/legacy/testdata/vd-snapshots/kustomization.yaml index 692b0657fb..724e6e1681 100644 --- a/test/e2e/legacy/testdata/vd-snapshots/kustomization.yaml +++ b/test/e2e/legacy/testdata/vd-snapshots/kustomization.yaml @@ -5,7 +5,6 @@ namePrefix: commit- resources: - ns.yaml - vd - - vi - vm configurations: - transformer.yaml diff --git a/test/e2e/legacy/testdata/vd-snapshots/vd/vd-alpine-http.yaml b/test/e2e/legacy/testdata/vd-snapshots/vd/vd-alpine-http.yaml index 164c5ae812..1e06d9d929 100644 --- a/test/e2e/legacy/testdata/vd-snapshots/vd/vd-alpine-http.yaml +++ b/test/e2e/legacy/testdata/vd-snapshots/vd/vd-alpine-http.yaml @@ -5,9 +5,10 @@ metadata: name: vd-alpine-http spec: dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-bios-base.qcow2 + type: ObjectRef + objectRef: + kind: ClusterVirtualImage + name: v12n-e2e-alpine-bios persistentVolumeClaim: storageClassName: "{{ .STORAGE_CLASS_NAME }}" size: 350Mi diff --git a/test/e2e/legacy/testdata/vd-snapshots/vi/kustomization.yaml b/test/e2e/legacy/testdata/vd-snapshots/vi/kustomization.yaml deleted file mode 100644 index b807d8e2d2..0000000000 --- a/test/e2e/legacy/testdata/vd-snapshots/vi/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - vi-alpine-http.yaml diff --git a/test/e2e/legacy/testdata/vd-snapshots/vi/vi-alpine-http.yaml b/test/e2e/legacy/testdata/vd-snapshots/vi/vi-alpine-http.yaml deleted file mode 100644 index 43bc57dd27..0000000000 --- a/test/e2e/legacy/testdata/vd-snapshots/vi/vi-alpine-http.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: VirtualImage -metadata: - name: vi-alpine-http -spec: - storage: ContainerRegistry - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2 diff --git a/test/e2e/legacy/testdata/vd-snapshots/vm/base/vd-root.yaml b/test/e2e/legacy/testdata/vd-snapshots/vm/base/vd-root.yaml index c2bf54f1ff..7442dd263a 100644 --- a/test/e2e/legacy/testdata/vd-snapshots/vm/base/vd-root.yaml +++ b/test/e2e/legacy/testdata/vd-snapshots/vm/base/vd-root.yaml @@ -9,5 +9,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http + kind: ClusterVirtualImage + name: v12n-e2e-alpine-uefi diff --git a/test/e2e/legacy/testdata/vm-disk-attachment/base/vd-root.yaml b/test/e2e/legacy/testdata/vm-disk-attachment/base/vd-root.yaml index 0f98ff3633..5623d567ed 100644 --- a/test/e2e/legacy/testdata/vm-disk-attachment/base/vd-root.yaml +++ b/test/e2e/legacy/testdata/vm-disk-attachment/base/vd-root.yaml @@ -9,5 +9,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http + kind: ClusterVirtualImage + name: v12n-e2e-alpine-uefi diff --git a/test/e2e/legacy/testdata/vm-disk-attachment/kustomization.yaml b/test/e2e/legacy/testdata/vm-disk-attachment/kustomization.yaml index 168c3f3d3e..d8a3bc44a9 100644 --- a/test/e2e/legacy/testdata/vm-disk-attachment/kustomization.yaml +++ b/test/e2e/legacy/testdata/vm-disk-attachment/kustomization.yaml @@ -5,7 +5,6 @@ namePrefix: pr-number-or-commit-hash- resources: - ns.yaml - overlays/vm - - vi configurations: - transformer.yaml labels: diff --git a/test/e2e/legacy/testdata/vm-disk-attachment/vi/kustomization.yaml b/test/e2e/legacy/testdata/vm-disk-attachment/vi/kustomization.yaml deleted file mode 100644 index b807d8e2d2..0000000000 --- a/test/e2e/legacy/testdata/vm-disk-attachment/vi/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - vi-alpine-http.yaml diff --git a/test/e2e/legacy/testdata/vm-disk-attachment/vi/vi-alpine-http.yaml b/test/e2e/legacy/testdata/vm-disk-attachment/vi/vi-alpine-http.yaml deleted file mode 100644 index 43bc57dd27..0000000000 --- a/test/e2e/legacy/testdata/vm-disk-attachment/vi/vi-alpine-http.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: VirtualImage -metadata: - name: vi-alpine-http -spec: - storage: ContainerRegistry - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2 diff --git a/test/e2e/legacy/testdata/vm-evacuation/kustomization.yaml b/test/e2e/legacy/testdata/vm-evacuation/kustomization.yaml index eeefcc8725..2930a85896 100644 --- a/test/e2e/legacy/testdata/vm-evacuation/kustomization.yaml +++ b/test/e2e/legacy/testdata/vm-evacuation/kustomization.yaml @@ -3,7 +3,6 @@ kind: Kustomization namespace: testcases namePrefix: pr-number-or-commit-hash- resources: - - vi - vm - ns.yaml configurations: diff --git a/test/e2e/legacy/testdata/vm-evacuation/vi/kustomization.yaml b/test/e2e/legacy/testdata/vm-evacuation/vi/kustomization.yaml deleted file mode 100644 index f9c61289fc..0000000000 --- a/test/e2e/legacy/testdata/vm-evacuation/vi/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - vi-alpine-http-bios.yaml - - vi-alpine-http-uefi.yaml diff --git a/test/e2e/legacy/testdata/vm-evacuation/vi/vi-alpine-http-bios.yaml b/test/e2e/legacy/testdata/vm-evacuation/vi/vi-alpine-http-bios.yaml deleted file mode 100644 index 681822ea6c..0000000000 --- a/test/e2e/legacy/testdata/vm-evacuation/vi/vi-alpine-http-bios.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: VirtualImage -metadata: - name: vi-alpine-http-bios -spec: - storage: ContainerRegistry - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-bios-base.qcow2 diff --git a/test/e2e/legacy/testdata/vm-evacuation/vi/vi-alpine-http-uefi.yaml b/test/e2e/legacy/testdata/vm-evacuation/vi/vi-alpine-http-uefi.yaml deleted file mode 100644 index c210fb37a5..0000000000 --- a/test/e2e/legacy/testdata/vm-evacuation/vi/vi-alpine-http-uefi.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: VirtualImage -metadata: - name: vi-alpine-http-uefi -spec: - storage: ContainerRegistry - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2 diff --git a/test/e2e/legacy/testdata/vm-evacuation/vm/base/vd-root.yaml b/test/e2e/legacy/testdata/vm-evacuation/vm/base/vd-root.yaml index c2bf54f1ff..3c66723071 100644 --- a/test/e2e/legacy/testdata/vm-evacuation/vm/base/vd-root.yaml +++ b/test/e2e/legacy/testdata/vm-evacuation/vm/base/vd-root.yaml @@ -9,5 +9,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http + kind: ClusterVirtualImage + name: v12n-e2e-alpine-bios diff --git a/test/e2e/legacy/testdata/vm-evacuation/vm/overlays/migration-bios/vd.image.patch.yaml b/test/e2e/legacy/testdata/vm-evacuation/vm/overlays/migration-bios/vd.image.patch.yaml index 0805403f38..6d7b3e4063 100644 --- a/test/e2e/legacy/testdata/vm-evacuation/vm/overlays/migration-bios/vd.image.patch.yaml +++ b/test/e2e/legacy/testdata/vm-evacuation/vm/overlays/migration-bios/vd.image.patch.yaml @@ -6,5 +6,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http-bios + kind: ClusterVirtualImage + name: v12n-e2e-alpine-bios diff --git a/test/e2e/legacy/testdata/vm-evacuation/vm/overlays/migration-uefi/vd.image.patch.yaml b/test/e2e/legacy/testdata/vm-evacuation/vm/overlays/migration-uefi/vd.image.patch.yaml index fb750b7a46..6c1a1ad8c9 100644 --- a/test/e2e/legacy/testdata/vm-evacuation/vm/overlays/migration-uefi/vd.image.patch.yaml +++ b/test/e2e/legacy/testdata/vm-evacuation/vm/overlays/migration-uefi/vd.image.patch.yaml @@ -6,5 +6,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http-uefi + kind: ClusterVirtualImage + name: v12n-e2e-alpine-uefi diff --git a/test/e2e/legacy/testdata/vm-label-annotation/base/vd-root.yaml b/test/e2e/legacy/testdata/vm-label-annotation/base/vd-root.yaml index 0f98ff3633..5623d567ed 100644 --- a/test/e2e/legacy/testdata/vm-label-annotation/base/vd-root.yaml +++ b/test/e2e/legacy/testdata/vm-label-annotation/base/vd-root.yaml @@ -9,5 +9,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http + kind: ClusterVirtualImage + name: v12n-e2e-alpine-uefi diff --git a/test/e2e/legacy/testdata/vm-label-annotation/kustomization.yaml b/test/e2e/legacy/testdata/vm-label-annotation/kustomization.yaml index 28ddbfe9e9..c29f74e133 100644 --- a/test/e2e/legacy/testdata/vm-label-annotation/kustomization.yaml +++ b/test/e2e/legacy/testdata/vm-label-annotation/kustomization.yaml @@ -4,7 +4,6 @@ namespace: testcases namePrefix: pr-number-or-commit-hash- resources: - ns.yaml - - vi - overlays/vm-label-annotation configurations: - transformer.yaml diff --git a/test/e2e/legacy/testdata/vm-label-annotation/vi/kustomization.yaml b/test/e2e/legacy/testdata/vm-label-annotation/vi/kustomization.yaml deleted file mode 100644 index b807d8e2d2..0000000000 --- a/test/e2e/legacy/testdata/vm-label-annotation/vi/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - vi-alpine-http.yaml diff --git a/test/e2e/legacy/testdata/vm-label-annotation/vi/vi-alpine-http.yaml b/test/e2e/legacy/testdata/vm-label-annotation/vi/vi-alpine-http.yaml deleted file mode 100644 index 43bc57dd27..0000000000 --- a/test/e2e/legacy/testdata/vm-label-annotation/vi/vi-alpine-http.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: VirtualImage -metadata: - name: vi-alpine-http -spec: - storage: ContainerRegistry - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2 diff --git a/test/e2e/legacy/testdata/vm-migration-cancel/kustomization.yaml b/test/e2e/legacy/testdata/vm-migration-cancel/kustomization.yaml index 3f8073239d..6064a3a5cc 100644 --- a/test/e2e/legacy/testdata/vm-migration-cancel/kustomization.yaml +++ b/test/e2e/legacy/testdata/vm-migration-cancel/kustomization.yaml @@ -3,7 +3,6 @@ kind: Kustomization namespace: testcases namePrefix: pr-number-or-commit-hash- resources: - - vi - vm - ns.yaml configurations: diff --git a/test/e2e/legacy/testdata/vm-migration-cancel/vi/kustomization.yaml b/test/e2e/legacy/testdata/vm-migration-cancel/vi/kustomization.yaml deleted file mode 100644 index f9c61289fc..0000000000 --- a/test/e2e/legacy/testdata/vm-migration-cancel/vi/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - vi-alpine-http-bios.yaml - - vi-alpine-http-uefi.yaml diff --git a/test/e2e/legacy/testdata/vm-migration-cancel/vi/vi-alpine-http-bios.yaml b/test/e2e/legacy/testdata/vm-migration-cancel/vi/vi-alpine-http-bios.yaml deleted file mode 100644 index 681822ea6c..0000000000 --- a/test/e2e/legacy/testdata/vm-migration-cancel/vi/vi-alpine-http-bios.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: VirtualImage -metadata: - name: vi-alpine-http-bios -spec: - storage: ContainerRegistry - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-bios-base.qcow2 diff --git a/test/e2e/legacy/testdata/vm-migration-cancel/vi/vi-alpine-http-uefi.yaml b/test/e2e/legacy/testdata/vm-migration-cancel/vi/vi-alpine-http-uefi.yaml deleted file mode 100644 index c210fb37a5..0000000000 --- a/test/e2e/legacy/testdata/vm-migration-cancel/vi/vi-alpine-http-uefi.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: VirtualImage -metadata: - name: vi-alpine-http-uefi -spec: - storage: ContainerRegistry - dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2 diff --git a/test/e2e/legacy/testdata/vm-migration-cancel/vm/base/vd-root.yaml b/test/e2e/legacy/testdata/vm-migration-cancel/vm/base/vd-root.yaml index c2bf54f1ff..3c66723071 100644 --- a/test/e2e/legacy/testdata/vm-migration-cancel/vm/base/vd-root.yaml +++ b/test/e2e/legacy/testdata/vm-migration-cancel/vm/base/vd-root.yaml @@ -9,5 +9,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http + kind: ClusterVirtualImage + name: v12n-e2e-alpine-bios diff --git a/test/e2e/legacy/testdata/vm-migration-cancel/vm/overlays/migration-bios/vd.image.patch.yaml b/test/e2e/legacy/testdata/vm-migration-cancel/vm/overlays/migration-bios/vd.image.patch.yaml index 0805403f38..6d7b3e4063 100644 --- a/test/e2e/legacy/testdata/vm-migration-cancel/vm/overlays/migration-bios/vd.image.patch.yaml +++ b/test/e2e/legacy/testdata/vm-migration-cancel/vm/overlays/migration-bios/vd.image.patch.yaml @@ -6,5 +6,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http-bios + kind: ClusterVirtualImage + name: v12n-e2e-alpine-bios diff --git a/test/e2e/legacy/testdata/vm-migration-cancel/vm/overlays/migration-uefi/vd.image.patch.yaml b/test/e2e/legacy/testdata/vm-migration-cancel/vm/overlays/migration-uefi/vd.image.patch.yaml index fb750b7a46..6c1a1ad8c9 100644 --- a/test/e2e/legacy/testdata/vm-migration-cancel/vm/overlays/migration-uefi/vd.image.patch.yaml +++ b/test/e2e/legacy/testdata/vm-migration-cancel/vm/overlays/migration-uefi/vd.image.patch.yaml @@ -6,5 +6,5 @@ spec: dataSource: type: ObjectRef objectRef: - kind: VirtualImage - name: vi-alpine-http-uefi + kind: ClusterVirtualImage + name: v12n-e2e-alpine-uefi diff --git a/test/e2e/legacy/testdata/vm-migration/cvi/cvi-cirros.yaml b/test/e2e/legacy/testdata/vm-migration/cvi/cvi-cirros.yaml deleted file mode 100644 index b672ece2cf..0000000000 --- a/test/e2e/legacy/testdata/vm-migration/cvi/cvi-cirros.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: virtualization.deckhouse.io/v1alpha2 -kind: ClusterVirtualImage -metadata: - name: cvi-cirros -spec: - dataSource: - type: "HTTP" - http: - url: "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/cirros/cirros-0.5.1.qcow2" diff --git a/test/e2e/legacy/testdata/vm-migration/cvi/kustomization.yaml b/test/e2e/legacy/testdata/vm-migration/cvi/kustomization.yaml deleted file mode 100644 index bda7b362a8..0000000000 --- a/test/e2e/legacy/testdata/vm-migration/cvi/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - cvi-cirros.yaml diff --git a/test/e2e/legacy/testdata/vm-migration/kustomization.yaml b/test/e2e/legacy/testdata/vm-migration/kustomization.yaml index a05cabd5db..0ef3f36322 100644 --- a/test/e2e/legacy/testdata/vm-migration/kustomization.yaml +++ b/test/e2e/legacy/testdata/vm-migration/kustomization.yaml @@ -4,7 +4,6 @@ namespace: testcases namePrefix: pr-number-or-commit-hash- resources: - vi - - cvi - vm - ns.yaml configurations: diff --git a/test/e2e/legacy/testdata/vm-migration/vm/overlays/with-cvi/kustomization.yaml b/test/e2e/legacy/testdata/vm-migration/vm/overlays/with-cvi/kustomization.yaml index 6bb34356af..3b3d2fee7e 100644 --- a/test/e2e/legacy/testdata/vm-migration/vm/overlays/with-cvi/kustomization.yaml +++ b/test/e2e/legacy/testdata/vm-migration/vm/overlays/with-cvi/kustomization.yaml @@ -11,7 +11,7 @@ patches: path: /spec/blockDeviceRefs/- value: { "kind": "ClusterVirtualImage", - "name": "cvi-cirros" + "name": "v12n-e2e-cirros" } target: kind: VirtualMachine diff --git a/test/e2e/legacy/testdata/vm-versions/vd/vd-root.yaml b/test/e2e/legacy/testdata/vm-versions/vd/vd-root.yaml index 9d26f1e2a5..11db56f25c 100644 --- a/test/e2e/legacy/testdata/vm-versions/vd/vd-root.yaml +++ b/test/e2e/legacy/testdata/vm-versions/vd/vd-root.yaml @@ -7,6 +7,7 @@ spec: persistentVolumeClaim: size: 512Mi dataSource: - type: HTTP - http: - url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2 + type: ObjectRef + objectRef: + kind: ClusterVirtualImage + name: v12n-e2e-alpine-uefi diff --git a/test/e2e/legacy/vd_snapshots.go b/test/e2e/legacy/vd_snapshots.go index 97f40fe34f..a7a0c9897f 100644 --- a/test/e2e/legacy/vd_snapshots.go +++ b/test/e2e/legacy/vd_snapshots.go @@ -33,6 +33,7 @@ import ( "github.com/deckhouse/virtualization/api/core/v1alpha2/vmcondition" "github.com/deckhouse/virtualization/test/e2e/internal/config" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" "github.com/deckhouse/virtualization/test/e2e/internal/util" ) @@ -42,7 +43,7 @@ const ( frozenReasonPollingInterval = 1 * time.Second ) -var _ = Describe("VirtualDiskSnapshots", Ordered, func() { +var _ = Describe("VirtualDiskSnapshots", Ordered, label.Legacy(), func() { var ( testCaseLabel = map[string]string{"testcase": "vd-snapshots", "id": namePrefix} attachedVirtualDiskLabel = map[string]string{"attachedVirtualDisk": ""} @@ -86,17 +87,6 @@ var _ = Describe("VirtualDiskSnapshots", Ordered, func() { }) }) - Context("When virtual images are applied:", func() { - It("checks VIs phases", func() { - By(fmt.Sprintf("VIs should be in %s phases", PhaseReady)) - WaitPhaseByLabel(kc.ResourceVI, PhaseReady, kc.WaitOptions{ - Labels: testCaseLabel, - Namespace: ns, - Timeout: MaxWaitTimeout, - }) - }) - }) - Context("When virtual disks are applied:", func() { It("checks VDs phases", func() { By(fmt.Sprintf("VDs should be in %s phases", PhaseReady)) diff --git a/test/e2e/legacy/vm_disk_attachment.go b/test/e2e/legacy/vm_disk_attachment.go index e91890ec01..ae56403c9c 100644 --- a/test/e2e/legacy/vm_disk_attachment.go +++ b/test/e2e/legacy/vm_disk_attachment.go @@ -29,6 +29,7 @@ import ( "github.com/deckhouse/virtualization/test/e2e/internal/d8" "github.com/deckhouse/virtualization/test/e2e/internal/framework" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" "github.com/deckhouse/virtualization/test/e2e/internal/util" ) @@ -36,7 +37,7 @@ const unacceptableCount = -1000 var APIVersion = v1alpha2.SchemeGroupVersion.String() -var _ = Describe("VirtualDiskAttachment", Ordered, func() { +var _ = Describe("VirtualDiskAttachment", Ordered, label.Legacy(), func() { var ( testCaseLabel = map[string]string{"testcase": "vm-disk-attachment"} hasNoConsumerLabel = map[string]string{"hasNoConsumer": "vm-disk-attachment"} @@ -76,17 +77,6 @@ var _ = Describe("VirtualDiskAttachment", Ordered, func() { }) }) - Context("When virtual images are applied", func() { - It("checks VIs phases", func() { - By(fmt.Sprintf("VIs should be in %s phases", PhaseReady)) - WaitPhaseByLabel(kc.ResourceVI, PhaseReady, kc.WaitOptions{ - Labels: testCaseLabel, - Namespace: ns, - Timeout: MaxWaitTimeout, - }) - }) - }) - Context("When virtual disks are applied", func() { It("checks VDs phases", func() { By(fmt.Sprintf("VDs with consumers should be in %s phases", PhaseReady)) diff --git a/test/e2e/legacy/vm_disk_resizing.go b/test/e2e/legacy/vm_disk_resizing.go index 8acf5d2adf..0615c3e8d1 100644 --- a/test/e2e/legacy/vm_disk_resizing.go +++ b/test/e2e/legacy/vm_disk_resizing.go @@ -33,9 +33,10 @@ import ( "github.com/deckhouse/virtualization/test/e2e/internal/d8" "github.com/deckhouse/virtualization/test/e2e/internal/framework" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" ) -var _ = Describe("VirtualDiskResizing", Ordered, func() { +var _ = Describe("VirtualDiskResizing", Ordered, label.Legacy(), func() { const ( vmCount = 1 diskCount = 3 @@ -69,18 +70,6 @@ var _ = Describe("VirtualDiskResizing", Ordered, func() { }) }) - Context("When the virtual images are applied", func() { - It("checks `VirtualImages` phase", func() { - By(fmt.Sprintf("`VirtualImages` should be in the %q phases", v1alpha2.ImageReady), func() { - WaitPhaseByLabel(kc.ResourceVI, string(v1alpha2.ImageReady), kc.WaitOptions{ - Labels: testCaseLabel, - Namespace: ns, - Timeout: MaxWaitTimeout, - }) - }) - }) - }) - Context("When the virtual disks are applied", func() { It("checks `VirtualDisks` phase", func() { By(fmt.Sprintf("`VirtualDisks` should be in the %q phases", v1alpha2.DiskReady), func() { diff --git a/test/e2e/legacy/vm_evacuation.go b/test/e2e/legacy/vm_evacuation.go index 55e2e717fb..2ee9bb0369 100644 --- a/test/e2e/legacy/vm_evacuation.go +++ b/test/e2e/legacy/vm_evacuation.go @@ -32,9 +32,10 @@ import ( "github.com/deckhouse/virtualization/test/e2e/internal/config" "github.com/deckhouse/virtualization/test/e2e/internal/framework" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" ) -var _ = Describe("VirtualMachineEvacuation", Ordered, func() { +var _ = Describe("VirtualMachineEvacuation", Ordered, label.Legacy(), func() { testCaseLabel := map[string]string{"testcase": "vm-evacuation"} kubeClient := framework.GetClients().KubeClient() var ns string diff --git a/test/e2e/legacy/vm_label_annotation.go b/test/e2e/legacy/vm_label_annotation.go index 456030d112..da3eaaa936 100644 --- a/test/e2e/legacy/vm_label_annotation.go +++ b/test/e2e/legacy/vm_label_annotation.go @@ -26,12 +26,13 @@ import ( "github.com/deckhouse/virtualization/api/core/v1alpha2" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" ) // TODO: When this test case is refactored with the new end-to-end test framework, // it should check labels and annotations on all resources: KVVM, KVVMI, and Pod. // KVVM must contain propagated metadata in the spec.template.metadata field. -var _ = Describe("VirtualMachineLabelAndAnnotation", Ordered, func() { +var _ = Describe("VirtualMachineLabelAndAnnotation", Ordered, label.Legacy(), func() { const ( specialKey = "specialKey" specialValue = "specialValue" @@ -65,17 +66,6 @@ var _ = Describe("VirtualMachineLabelAndAnnotation", Ordered, func() { }) }) - Context("When virtual images are applied", func() { - It("checks VIs phases", func() { - By(fmt.Sprintf("VIs should be in %s phases", PhaseReady)) - WaitPhaseByLabel(kc.ResourceVI, PhaseReady, kc.WaitOptions{ - Labels: testCaseLabel, - Namespace: ns, - Timeout: MaxWaitTimeout, - }) - }) - }) - Context("When virtual disks are applied", func() { It("checks VDs phases", func() { By(fmt.Sprintf("VDs should be in %s phases", PhaseReady)) diff --git a/test/e2e/legacy/vm_migration_cancel.go b/test/e2e/legacy/vm_migration_cancel.go index e202288baa..e0be0f185a 100644 --- a/test/e2e/legacy/vm_migration_cancel.go +++ b/test/e2e/legacy/vm_migration_cancel.go @@ -30,9 +30,10 @@ import ( "github.com/deckhouse/virtualization/test/e2e/internal/d8" "github.com/deckhouse/virtualization/test/e2e/internal/framework" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" ) -var _ = Describe("VirtualMachineCancelMigration", Ordered, func() { +var _ = Describe("VirtualMachineCancelMigration", Ordered, label.Legacy(), func() { testCaseLabel := map[string]string{"testcase": "vm-migration-cancel"} var ns string diff --git a/test/e2e/legacy/vm_version.go b/test/e2e/legacy/vm_version.go index 3ec93361a1..f67f3a24e9 100644 --- a/test/e2e/legacy/vm_version.go +++ b/test/e2e/legacy/vm_version.go @@ -24,9 +24,10 @@ import ( "github.com/deckhouse/virtualization/api/core/v1alpha2" kc "github.com/deckhouse/virtualization/test/e2e/internal/kubectl" + "github.com/deckhouse/virtualization/test/e2e/internal/label" ) -var _ = Describe("VirtualMachineVersions", Ordered, func() { +var _ = Describe("VirtualMachineVersions", Ordered, label.Legacy(), func() { testCaseLabel := map[string]string{"testcase": "vm-versions"} var ns string diff --git a/test/e2e/snapshot/vmsop.go b/test/e2e/snapshot/vmsop.go index b1541aa5bb..07462079f2 100644 --- a/test/e2e/snapshot/vmsop.go +++ b/test/e2e/snapshot/vmsop.go @@ -67,13 +67,8 @@ var _ = Describe("VMSOPCreateVirtualMachine", Ordered, func() { It("should prepare environment", func() { By("create vm", func() { - vd = vdbuilder.New( - vdbuilder.WithName("vd-root"), - vdbuilder.WithNamespace(f.Namespace().Name), + vd = object.NewVDFromCVI("vd-root", f.Namespace().Name, object.PrecreatedCVIAlpineBIOS, vdbuilder.WithSize(ptr.To(resource.MustParse("10Gi"))), - vdbuilder.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineBIOS, - }), ) vm = object.NewMinimalVM("vmsop-origin-", f.Namespace().Name, diff --git a/test/e2e/suite_cvi.go b/test/e2e/suite_cvi.go new file mode 100644 index 0000000000..18a5b8f0c7 --- /dev/null +++ b/test/e2e/suite_cvi.go @@ -0,0 +1,33 @@ +/* +Copyright 2026 Flant JSC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package e2e + +import ( + "context" + + "github.com/deckhouse/virtualization/test/e2e/internal/precreatedcvi" +) + +var precreatedCVIManager = precreatedcvi.NewPrecreatedCVIManager() + +func bootstrapPrecreatedCVIs() { + precreatedCVIManager.Bootstrap(context.Background()) +} + +func cleanupPrecreatedCVIs() { + precreatedCVIManager.Cleanup(context.Background()) +} diff --git a/test/e2e/vm/additional_network_interfaces.go b/test/e2e/vm/additional_network_interfaces.go index 4dea980d5e..3c5b529e7f 100644 --- a/test/e2e/vm/additional_network_interfaces.go +++ b/test/e2e/vm/additional_network_interfaces.go @@ -84,10 +84,10 @@ var _ = Describe("VirtualMachineAdditionalNetworkInterfaces", func() { By("Environment preparation", func() { ns := f.Namespace().Name - vdFooRoot = object.NewHTTPVDAlpineUEFIPerf("vd-foo-root", ns, + vdFooRoot = object.NewVDFromCVI("vd-foo-root", ns, object.PrecreatedCVIAlpineUEFIPerf, vd.WithSize(ptr.To(resource.MustParse("512Mi"))), ) - vdBarRoot = object.NewHTTPVDAlpineUEFIPerf("vd-bar-root", ns, + vdBarRoot = object.NewVDFromCVI("vd-bar-root", ns, object.PrecreatedCVIAlpineUEFIPerf, vd.WithSize(ptr.To(resource.MustParse("512Mi"))), ) @@ -159,6 +159,8 @@ var _ = Describe("VirtualMachineAdditionalNetworkInterfaces", func() { ) Describe("verifies interface name persistence after removing middle ClusterNetwork", func() { + cloudInitOpt := vm.WithProvisioningUserData(object.UbuntuCloudInit) + var ( vdRoot *v1alpha2.VirtualDisk vm *v1alpha2.VirtualMachine @@ -174,15 +176,9 @@ var _ = Describe("VirtualMachineAdditionalNetworkInterfaces", func() { By("Create VM with Main network and two additional ClusterNetworks", func() { ns := f.Namespace().Name - vdRoot = vd.New( - vd.WithName("vd-root"), - vd.WithNamespace(ns), - vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLUbuntu, - }), - ) + vdRoot = object.NewVDFromCVI("vd-root", ns, object.PrecreatedCVIUbuntu) - vm = buildVMWithNetworks("vm", ns, vdRoot.Name, "192.168.1.20", true) + vm = buildVMWithNetworks("vm", ns, vdRoot.Name, "192.168.1.20", true, cloudInitOpt) vm.Spec.Networks = append(vm.Spec.Networks, v1alpha2.NetworksSpec{ Type: v1alpha2.NetworksTypeClusterNetwork, Name: util.ClusterNetworkName(secondAdditionalInterfaceVLANID), @@ -244,7 +240,7 @@ var _ = Describe("VirtualMachineAdditionalNetworkInterfaces", func() { // buildVMWithNetworks creates a VM with optional Main + ClusterNetwork. // If hasMain is false, only ClusterNetwork is added (VM without Main network). // The additional network interface is eth1 when hasMain is true, eth0 otherwise. -func buildVMWithNetworks(name, ns, vdRootName, additionalIP string, hasMain bool) *v1alpha2.VirtualMachine { +func buildVMWithNetworks(name, ns, vdRootName, additionalIP string, hasMain bool, extraOpts ...vm.Option) *v1alpha2.VirtualMachine { opts := []vm.Option{ vm.WithName(name), vm.WithNamespace(ns), @@ -271,6 +267,7 @@ func buildVMWithNetworks(name, ns, vdRootName, additionalIP string, hasMain bool Name: util.ClusterNetworkName(additionalInterfaceVLANID), }), ) + opts = append(opts, extraOpts...) return vm.New(opts...) } diff --git a/test/e2e/vm/configuration.go b/test/e2e/vm/configuration.go index a255c6e76f..46e3e9ef97 100644 --- a/test/e2e/vm/configuration.go +++ b/test/e2e/vm/configuration.go @@ -123,13 +123,8 @@ func NewConfigurationTest(f *framework.Framework) *configurationTest { } func (t *configurationTest) GenerateResources(restartApprovalMode v1alpha2.RestartApprovalMode) { - t.VDRoot = vdbuilder.New( - vdbuilder.WithName("vd-root"), - vdbuilder.WithNamespace(t.Framework.Namespace().Name), + t.VDRoot = object.NewVDFromCVI("vd-root", t.Framework.Namespace().Name, object.PrecreatedCVIAlpineBIOS, vdbuilder.WithSize(ptr.To(resource.MustParse("350Mi"))), - vdbuilder.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineBIOS, - }), ) t.VDBlank = vdbuilder.New( @@ -145,7 +140,7 @@ func (t *configurationTest) GenerateResources(restartApprovalMode v1alpha2.Resta vmbuilder.WithMemory(resource.MustParse(initialMemorySize)), vmbuilder.WithLiveMigrationPolicy(v1alpha2.AlwaysSafeMigrationPolicy), vmbuilder.WithVirtualMachineClass(object.DefaultVMClass), - vmbuilder.WithProvisioningUserData(object.DefaultCloudInit), + vmbuilder.WithProvisioningUserData(object.AlpineCloudInit), vmbuilder.WithBlockDeviceRefs( v1alpha2.BlockDeviceSpecRef{ Kind: v1alpha2.DiskDevice, diff --git a/test/e2e/vm/connectivity.go b/test/e2e/vm/connectivity.go index a7612f448e..65c2454b6f 100644 --- a/test/e2e/vm/connectivity.go +++ b/test/e2e/vm/connectivity.go @@ -31,7 +31,6 @@ import ( "k8s.io/utils/ptr" crclient "sigs.k8s.io/controller-runtime/pkg/client" - vdbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vd" vmbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vm" "github.com/deckhouse/virtualization/api/core/v1alpha2" "github.com/deckhouse/virtualization/test/e2e/internal/executor" @@ -156,21 +155,8 @@ func NewVMConnectivityTest(f *framework.Framework) *VMConnectivityTest { } func (t *VMConnectivityTest) GenerateEnvironmentResources() { - t.VDa = vdbuilder.New( - vdbuilder.WithName("vd-a"), - vdbuilder.WithNamespace(t.Framework.Namespace().Name), - vdbuilder.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineBIOS, - }), - ) - - t.VDb = vdbuilder.New( - vdbuilder.WithName("vd-b"), - vdbuilder.WithNamespace(t.Framework.Namespace().Name), - vdbuilder.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineBIOS, - }), - ) + t.VDa = object.NewVDFromCVI("vd-a", t.Framework.Namespace().Name, object.PrecreatedCVIAlpineBIOS) + t.VDb = object.NewVDFromCVI("vd-b", t.Framework.Namespace().Name, object.PrecreatedCVIAlpineBIOS) t.VMa = vmbuilder.New( vmbuilder.WithName("vm-a"), @@ -258,6 +244,17 @@ func (t *VMConnectivityTest) GenerateEnvironmentResources() { Image: framework.GetConfig().HelperImages.CurlImage, Command: []string{"sleep"}, Args: []string{"10000"}, + SecurityContext: &corev1.SecurityContext{ + AllowPrivilegeEscalation: ptr.To(false), + RunAsNonRoot: ptr.To(true), + RunAsUser: ptr.To(int64(1000)), + Capabilities: &corev1.Capabilities{ + Drop: []corev1.Capability{"ALL"}, + }, + SeccompProfile: &corev1.SeccompProfile{ + Type: corev1.SeccompProfileTypeRuntimeDefault, + }, + }, }, }, }, diff --git a/test/e2e/vm/live_migration_tcp_session.go b/test/e2e/vm/live_migration_tcp_session.go index 92ad45e721..d350d5f31d 100644 --- a/test/e2e/vm/live_migration_tcp_session.go +++ b/test/e2e/vm/live_migration_tcp_session.go @@ -70,28 +70,18 @@ var _ = Describe("VirtualMachineLiveMigrationTCPSession", func() { It("checks the TCP session when the virtual machine is migrated", func() { By("Environment preparation", func() { - iperfServerDisk := vd.New( - vd.WithName(iperfServerName), - vd.WithNamespace(f.Namespace().Name), + iperfServerDisk := object.NewVDFromCVI(iperfServerName, f.Namespace().Name, object.PrecreatedCVIAlpineUEFI, vd.WithSize(ptr.To(resource.MustParse("400Mi"))), vd.WithStorageClass(&storageClass.Name), - vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineUEFI, - }), ) - iperfClientDisk := vd.New( - vd.WithName(iperfClientName), - vd.WithNamespace(f.Namespace().Name), + iperfClientDisk := object.NewVDFromCVI(iperfClientName, f.Namespace().Name, object.PrecreatedCVIAlpineUEFI, vd.WithSize(ptr.To(resource.MustParse("500Mi"))), vd.WithStorageClass(&storageClass.Name), - vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineUEFI, - }), ) iperfServer = newVirtualMachine(iperfServerName, f.Namespace().Name, iperfServerDisk, object.PerfCloudInit) - iperfClient = newVirtualMachine(iperfClientName, f.Namespace().Name, iperfClientDisk, object.DefaultCloudInit) + iperfClient = newVirtualMachine(iperfClientName, f.Namespace().Name, iperfClientDisk, object.AlpineCloudInit) err := f.CreateWithDeferredDeletion(context.Background(), iperfServerDisk, iperfClientDisk, iperfServer, iperfClient) Expect(err).NotTo(HaveOccurred()) diff --git a/test/e2e/vm/migration.go b/test/e2e/vm/migration.go index ace366f2bb..f5d59fabf9 100644 --- a/test/e2e/vm/migration.go +++ b/test/e2e/vm/migration.go @@ -28,7 +28,6 @@ import ( "k8s.io/utils/ptr" crclient "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/deckhouse/virtualization-controller/pkg/builder/cvi" "github.com/deckhouse/virtualization-controller/pkg/builder/vd" "github.com/deckhouse/virtualization-controller/pkg/builder/vi" "github.com/deckhouse/virtualization-controller/pkg/builder/vm" @@ -54,15 +53,12 @@ var _ = Describe("VirtualMachineMigration", func() { vmUEFI *v1alpha2.VirtualMachine // Hotplug: disks and images attached via VMBDAs - vdHotplugBIOS *v1alpha2.VirtualDisk - vdHotplugUEFI *v1alpha2.VirtualDisk - viHotplugBIOS *v1alpha2.VirtualImage - viHotplugUEFI *v1alpha2.VirtualImage - cviHotplugBIOS *v1alpha2.ClusterVirtualImage - cviHotplugUEFI *v1alpha2.ClusterVirtualImage - - vmbdas []*v1alpha2.VirtualMachineBlockDeviceAttachment - allObjects []crclient.Object + vdHotplugBIOS *v1alpha2.VirtualDisk + vdHotplugUEFI *v1alpha2.VirtualDisk + viHotplugBIOS *v1alpha2.VirtualImage + viHotplugUEFI *v1alpha2.VirtualImage + vmbdas []*v1alpha2.VirtualMachineBlockDeviceAttachment + allObjects []crclient.Object vmopMigrateBIOS *v1alpha2.VirtualMachineOperation vmopMigrateUEFI *v1alpha2.VirtualMachineOperation @@ -80,13 +76,8 @@ var _ = Describe("VirtualMachineMigration", func() { It("verifies that migrations are successful", func() { By("Environment preparation", func() { - vdRootBIOS = vd.New( - vd.WithName("vd-root-bios"), - vd.WithNamespace(f.Namespace().Name), + vdRootBIOS = object.NewVDFromCVI("vd-root-bios", f.Namespace().Name, object.PrecreatedCVIUbuntu, vd.WithSize(ptr.To(resource.MustParse("10Gi"))), - vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLUbuntu, - }), ) vdBlankBIOS = vd.New( vd.WithName("vd-blank-bios"), @@ -94,13 +85,8 @@ var _ = Describe("VirtualMachineMigration", func() { vd.WithSize(ptr.To(resource.MustParse("100Mi"))), ) - vdRootUEFI = vd.New( - vd.WithName("vd-root-uefi"), - vd.WithNamespace(f.Namespace().Name), + vdRootUEFI = object.NewVDFromCVI("vd-root-uefi", f.Namespace().Name, object.PrecreatedCVIAlpineUEFI, vd.WithSize(ptr.To(resource.MustParse("10Gi"))), - vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineUEFI, - }), ) vdBlankUEFI = vd.New( vd.WithName("vd-blank-uefi"), @@ -119,7 +105,7 @@ var _ = Describe("VirtualMachineMigration", func() { }, ), vm.WithBootloader(v1alpha2.BIOS), - vm.WithProvisioningUserData(object.DefaultCloudInit), + vm.WithProvisioningUserData(object.UbuntuCloudInit), vm.WithLiveMigrationPolicy(v1alpha2.PreferSafeMigrationPolicy), vm.WithName("vm-bios"), ) @@ -135,7 +121,7 @@ var _ = Describe("VirtualMachineMigration", func() { }, ), vm.WithBootloader(v1alpha2.EFI), - vm.WithProvisioningUserData(object.DefaultCloudInit), + vm.WithProvisioningUserData(object.AlpineCloudInit), vm.WithLiveMigrationPolicy(v1alpha2.PreferSafeMigrationPolicy), vm.WithName("vm-uefi"), ) @@ -155,25 +141,16 @@ var _ = Describe("VirtualMachineMigration", func() { viHotplugBIOS = vi.New( vi.WithName("vi-hotplug-bios"), vi.WithNamespace(f.Namespace().Name), - vi.WithDataSourceHTTP(object.ImageTestDataQCOW, nil, nil), + vi.WithDataSourceObjectRef(v1alpha2.VirtualImageObjectRefKindClusterVirtualImage, object.PrecreatedCVITestDataQCOW), vi.WithStorage(v1alpha2.StorageContainerRegistry), ) viHotplugUEFI = vi.New( vi.WithName("vi-hotplug-uefi"), vi.WithNamespace(f.Namespace().Name), - vi.WithDataSourceHTTP(object.ImageTestDataQCOW, nil, nil), + vi.WithDataSourceObjectRef(v1alpha2.VirtualImageObjectRefKindClusterVirtualImage, object.PrecreatedCVITestDataQCOW), vi.WithStorage(v1alpha2.StorageContainerRegistry), ) - cviHotplugBIOS = cvi.New( - cvi.WithName("cvi-hotplug-bios"), - cvi.WithDataSourceHTTP(object.ImageTestDataQCOW, nil, nil), - ) - cviHotplugUEFI = cvi.New( - cvi.WithName("cvi-hotplug-uefi"), - cvi.WithDataSourceHTTP(object.ImageTestDataQCOW, nil, nil), - ) - vmbdaVdBIOS := vmbda.New( vmbda.WithName("vmbda-vd-bios"), vmbda.WithNamespace(f.Namespace().Name), @@ -201,13 +178,13 @@ var _ = Describe("VirtualMachineMigration", func() { vmbdaCviBIOS := vmbda.New( vmbda.WithName("vmbda-cvi-bios"), vmbda.WithNamespace(f.Namespace().Name), - vmbda.WithBlockDeviceRef(v1alpha2.VMBDAObjectRefKindClusterVirtualImage, cviHotplugBIOS.Name), + vmbda.WithBlockDeviceRef(v1alpha2.VMBDAObjectRefKindClusterVirtualImage, object.PrecreatedCVITestDataQCOW), vmbda.WithVirtualMachineName(vmBIOS.Name), ) vmbdaCviUEFI := vmbda.New( vmbda.WithName("vmbda-cvi-uefi"), vmbda.WithNamespace(f.Namespace().Name), - vmbda.WithBlockDeviceRef(v1alpha2.VMBDAObjectRefKindClusterVirtualImage, cviHotplugUEFI.Name), + vmbda.WithBlockDeviceRef(v1alpha2.VMBDAObjectRefKindClusterVirtualImage, object.PrecreatedCVITestDataQCOW), vmbda.WithVirtualMachineName(vmUEFI.Name), ) vmbdas = []*v1alpha2.VirtualMachineBlockDeviceAttachment{ @@ -217,7 +194,6 @@ var _ = Describe("VirtualMachineMigration", func() { allObjects = append([]crclient.Object{ vdRootBIOS, vdBlankBIOS, vmBIOS, vdRootUEFI, vdBlankUEFI, vmUEFI, vdHotplugBIOS, vdHotplugUEFI, viHotplugBIOS, viHotplugUEFI, - cviHotplugBIOS, cviHotplugUEFI, }, toObjects(vmbdas)...) err := f.CreateWithDeferredDeletion(context.Background(), allObjects...) Expect(err).NotTo(HaveOccurred()) diff --git a/test/e2e/vm/power_state.go b/test/e2e/vm/power_state.go index 717972d4ca..d44abd75a1 100644 --- a/test/e2e/vm/power_state.go +++ b/test/e2e/vm/power_state.go @@ -26,7 +26,6 @@ import ( "k8s.io/utils/ptr" crclient "sigs.k8s.io/controller-runtime/pkg/client" - cvibuilder "github.com/deckhouse/virtualization-controller/pkg/builder/cvi" vdbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vd" vibuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vi" vmbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vm" @@ -61,7 +60,7 @@ var _ = Describe("PowerState", func() { By("Environment preparation", func() { t.GenerateResources(runPolicy) err := f.CreateWithDeferredDeletion( - context.Background(), t.CVI, t.VI, t.VDRoot, t.VDBlank, t.VM, t.VMBDA, + context.Background(), t.VI, t.VDRoot, t.VDBlank, t.VM, t.VMBDA, ) Expect(err).NotTo(HaveOccurred()) @@ -195,7 +194,6 @@ var _ = Describe("PowerState", func() { type powerStateTest struct { Framework *framework.Framework - CVI *v1alpha2.ClusterVirtualImage VI *v1alpha2.VirtualImage VM *v1alpha2.VirtualMachine VDRoot *v1alpha2.VirtualDisk @@ -210,25 +208,15 @@ func newPowerStateTest(f *framework.Framework) *powerStateTest { } func (t *powerStateTest) GenerateResources(runPolicy v1alpha2.RunPolicy) { - t.CVI = cvibuilder.New( - cvibuilder.WithName(fmt.Sprintf("%s-cvi", t.Framework.Namespace().Name)), - cvibuilder.WithDataSourceHTTP(object.ImageTestDataISO, nil, nil), - ) - t.VI = vibuilder.New( vibuilder.WithName("vi"), vibuilder.WithNamespace(t.Framework.Namespace().Name), - vibuilder.WithDataSourceHTTP(object.ImageTestDataQCOW, nil, nil), + vibuilder.WithDataSourceObjectRef(v1alpha2.VirtualImageObjectRefKindClusterVirtualImage, object.PrecreatedCVITestDataQCOW), vibuilder.WithStorage(v1alpha2.StorageContainerRegistry), ) - t.VDRoot = vdbuilder.New( - vdbuilder.WithName("vd-root"), - vdbuilder.WithNamespace(t.Framework.Namespace().Name), + t.VDRoot = object.NewVDFromCVI("vd-root", t.Framework.Namespace().Name, object.PrecreatedCVIAlpineBIOS, vdbuilder.WithSize(ptr.To(resource.MustParse("350Mi"))), - vdbuilder.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineBIOS, - }), ) t.VDBlank = vdbuilder.New( @@ -251,7 +239,7 @@ func (t *powerStateTest) GenerateResources(runPolicy v1alpha2.RunPolicy) { }, v1alpha2.BlockDeviceSpecRef{ Kind: v1alpha2.ClusterImageDevice, - Name: t.CVI.Name, + Name: object.PrecreatedCVITestDataISO, }, v1alpha2.BlockDeviceSpecRef{ Kind: v1alpha2.ImageDevice, @@ -260,7 +248,7 @@ func (t *powerStateTest) GenerateResources(runPolicy v1alpha2.RunPolicy) { ), vmbuilder.WithRestartApprovalMode(v1alpha2.Manual), vmbuilder.WithRunPolicy(runPolicy), - vmbuilder.WithProvisioningUserData(object.DefaultCloudInit), + vmbuilder.WithProvisioningUserData(object.AlpineCloudInit), ) t.VMBDA = vmbdabuilder.New( diff --git a/test/e2e/vm/sizing_policy.go b/test/e2e/vm/sizing_policy.go index b9684c8b7c..0cf1d4d20b 100644 --- a/test/e2e/vm/sizing_policy.go +++ b/test/e2e/vm/sizing_policy.go @@ -136,13 +136,8 @@ func newSizingPolicyTest(f *framework.Framework) *sizingPolicyTest { } func (t *sizingPolicyTest) GenerateSizingPolicyResources(vmClassName, vmClassNameInVM string) { - t.VD = vdbuilder.New( - vdbuilder.WithName("vd"), - vdbuilder.WithNamespace(t.Framework.Namespace().Name), + t.VD = object.NewVDFromCVI("vd", t.Framework.Namespace().Name, object.PrecreatedCVIAlpineBIOS, vdbuilder.WithSize(ptr.To(resource.MustParse("350Mi"))), - vdbuilder.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineBIOS, - }), ) t.VM = vmbuilder.New( @@ -156,7 +151,7 @@ func (t *sizingPolicyTest) GenerateSizingPolicyResources(vmClassName, vmClassNam vmbuilder.WithCPU(1, ptr.To("5%")), vmbuilder.WithMemory(resource.MustParse("1Gi")), vmbuilder.WithLiveMigrationPolicy(v1alpha2.AlwaysSafeMigrationPolicy), - vmbuilder.WithProvisioningUserData(object.DefaultCloudInit), + vmbuilder.WithProvisioningUserData(object.AlpineCloudInit), ) t.VMClass = &v1alpha3.VirtualMachineClass{ diff --git a/test/e2e/vm/target_migration.go b/test/e2e/vm/target_migration.go index d7c415473e..6c884ee9e6 100644 --- a/test/e2e/vm/target_migration.go +++ b/test/e2e/vm/target_migration.go @@ -59,9 +59,10 @@ var _ = Describe("TargetMigration", func() { It("checks if a VirtualMachine can be migrated to the target Node", func() { By("Environment preparation", func() { - virtualDisk := object.NewHTTPVDAlpineBIOS( + virtualDisk := object.NewVDFromCVI( "vd-root", f.Namespace().Name, + object.PrecreatedCVIAlpineBIOS, ) virtualMachine = object.NewMinimalVM( diff --git a/test/e2e/vm/tpm.go b/test/e2e/vm/tpm.go index 95c792c6e0..31fcface2f 100644 --- a/test/e2e/vm/tpm.go +++ b/test/e2e/vm/tpm.go @@ -30,6 +30,7 @@ import ( "github.com/deckhouse/virtualization/api/core/v1alpha2" "github.com/deckhouse/virtualization/test/e2e/internal/framework" "github.com/deckhouse/virtualization/test/e2e/internal/label" + "github.com/deckhouse/virtualization/test/e2e/internal/object" "github.com/deckhouse/virtualization/test/e2e/internal/util" ) @@ -46,7 +47,6 @@ var _ = Describe("VMCheckTPM", label.TPM(), func() { By("Create a VM with the TPM module.") const ( expectedTPMVersion = "2.0" - imageURLDebian12 = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/debian/debian-12-with-tpm2-tools-amd64-20250814-2204.qcow2" vdsize = "4.4Gi" bootLoader = "EFI" osType = "Windows" @@ -67,13 +67,8 @@ runcmd: ` ) - vdRoot := vd.New( - vd.WithName("vd-root"), + vdRoot := object.NewVDFromCVI("vd-root", f.Namespace().Name, object.PrecreatedCVIDebian, vd.WithSize(ptr.To(resource.MustParse(vdsize))), - vd.WithNamespace(f.Namespace().Name), - vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: imageURLDebian12, - }), ) vmTPM := vm.New( vm.WithName("vm-with-tpm"), diff --git a/test/e2e/vm/usb.go b/test/e2e/vm/usb.go index d5a0e08ad8..977abc50e5 100644 --- a/test/e2e/vm/usb.go +++ b/test/e2e/vm/usb.go @@ -28,7 +28,6 @@ import ( "k8s.io/utils/ptr" crclient "sigs.k8s.io/controller-runtime/pkg/client" - vdbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vd" vmbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vm" "github.com/deckhouse/virtualization/api/core/v1alpha2" "github.com/deckhouse/virtualization/test/e2e/internal/framework" @@ -197,13 +196,7 @@ func (t *VMUSBTest) GenerateEnvironmentResources() { usbNodeName := t.NodeUSBDevice.Status.NodeName Expect(usbNodeName).NotTo(BeEmpty(), "USB device must have a node assigned") - t.VD = vdbuilder.New( - vdbuilder.WithName("vd-usb-test"), - vdbuilder.WithNamespace(t.Framework.Namespace().Name), - vdbuilder.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLAlpineBIOS, - }), - ) + t.VD = object.NewVDFromCVI("vd-usb-test", t.Framework.Namespace().Name, object.PrecreatedCVIAlpineBIOS) t.VM = vmbuilder.New( vmbuilder.WithName("vm-usb-test"), @@ -211,7 +204,7 @@ func (t *VMUSBTest) GenerateEnvironmentResources() { vmbuilder.WithCPU(1, ptr.To("100%")), vmbuilder.WithMemory(resource.MustParse("512Mi")), vmbuilder.WithVirtualMachineClass(object.DefaultVMClass), - vmbuilder.WithProvisioningUserData(object.DefaultCloudInit), + vmbuilder.WithProvisioningUserData(object.AlpineCloudInit), vmbuilder.WithLiveMigrationPolicy(v1alpha2.AlwaysSafeMigrationPolicy), vmbuilder.WithBlockDeviceRefs(v1alpha2.BlockDeviceSpecRef{Kind: v1alpha2.DiskDevice, Name: t.VD.Name}), vmbuilder.WithUSBDevices([]v1alpha2.USBDeviceSpecRef{{Name: t.NodeUSBDevice.Name}}), diff --git a/test/e2e/vm/volume_migration_local_disks.go b/test/e2e/vm/volume_migration_local_disks.go index 84d2a8ce3a..779a0ca0fa 100644 --- a/test/e2e/vm/volume_migration_local_disks.go +++ b/test/e2e/vm/volume_migration_local_disks.go @@ -70,7 +70,7 @@ var _ = Describe("RWOVirtualDiskMigration", decoratorsForVolumeMigrations(), fun DeferCleanup(f.After) - newVI := object.NewGeneratedHTTPVIAlpineBIOSPerf("volume-migration-local-disks-", f.Namespace().Name) + newVI := object.NewGeneratedVIFromCVI("volume-migration-local-disks-", f.Namespace().Name, object.PrecreatedCVIAlpineBIOSPerf) newVI, err := f.VirtClient().VirtualImages(f.Namespace().Name).Create(context.Background(), newVI, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) f.DeferDelete(newVI) diff --git a/test/e2e/vm/volume_migration_storage_class_changed.go b/test/e2e/vm/volume_migration_storage_class_changed.go index 8c69f54cbe..fc8aab32e8 100644 --- a/test/e2e/vm/volume_migration_storage_class_changed.go +++ b/test/e2e/vm/volume_migration_storage_class_changed.go @@ -68,7 +68,7 @@ var _ = Describe("StorageClassMigration", decoratorsForVolumeMigrations(), func( DeferCleanup(f.After) - newVI := object.NewGeneratedHTTPVIAlpineBIOS("volume-migration-storage-class-changed-", f.Namespace().Name) + newVI := object.NewGeneratedVIFromCVI("volume-migration-storage-class-changed-", f.Namespace().Name, object.PrecreatedCVIAlpineBIOS) newVI, err = f.VirtClient().VirtualImages(f.Namespace().Name).Create(context.Background(), newVI, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) f.DeferDelete(newVI) diff --git a/test/e2e/vmop/restore.go b/test/e2e/vmop/restore.go index 1f9511869c..ed361e9a55 100644 --- a/test/e2e/vmop/restore.go +++ b/test/e2e/vmop/restore.go @@ -30,7 +30,6 @@ import ( "k8s.io/utils/ptr" crclient "sigs.k8s.io/controller-runtime/pkg/client" - cvibuilder "github.com/deckhouse/virtualization-controller/pkg/builder/cvi" vdbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vd" vibuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vi" vmbuilder "github.com/deckhouse/virtualization-controller/pkg/builder/vm" @@ -90,7 +89,7 @@ var _ = Describe("VirtualMachineOperationRestore", label.Slow(), func() { By("Environment preparation", func() { t.GenerateResources(restoreMode, restartApprovalMode, runPolicy) err := f.CreateWithDeferredDeletion( - context.Background(), t.CVI, t.VI, t.VDRoot, t.VDBlank, t.VM, t.VMBDA, t.VDBlankWithNoFstabEntry, t.VMBDAWithNoFstabEntry, + context.Background(), t.VI, t.VDRoot, t.VDBlank, t.VM, t.VMBDA, t.VDBlankWithNoFstabEntry, t.VMBDAWithNoFstabEntry, ) Expect(err).NotTo(HaveOccurred()) if t.VM.Spec.RunPolicy == v1alpha2.ManualPolicy { @@ -242,7 +241,6 @@ var _ = Describe("VirtualMachineOperationRestore", label.Slow(), func() { }) type restoreModeTest struct { - CVI *v1alpha2.ClusterVirtualImage VI *v1alpha2.VirtualImage VDRoot *v1alpha2.VirtualDisk VDBlank *v1alpha2.VirtualDisk @@ -265,24 +263,14 @@ func newRestoreTest(f *framework.Framework) *restoreModeTest { } func (t *restoreModeTest) GenerateResources(restoreMode v1alpha2.SnapshotOperationMode, restartApprovalMode v1alpha2.RestartApprovalMode, runPolicy v1alpha2.RunPolicy) { - t.CVI = cvibuilder.New( - cvibuilder.WithName(fmt.Sprintf("%s-cvi", t.Framework.Namespace().Name)), - cvibuilder.WithDataSourceHTTP(object.ImageTestDataISO, nil, nil), - ) - t.VI = vibuilder.New( vibuilder.WithName("vi"), vibuilder.WithNamespace(t.Framework.Namespace().Name), - vibuilder.WithDataSourceHTTP(object.ImageTestDataQCOW, nil, nil), + vibuilder.WithDataSourceObjectRef(v1alpha2.VirtualImageObjectRefKindClusterVirtualImage, object.PrecreatedCVITestDataQCOW), vibuilder.WithStorage(v1alpha2.StorageContainerRegistry), ) - t.VDRoot = vdbuilder.New( - vdbuilder.WithName("vd-root"), - vdbuilder.WithNamespace(t.Framework.Namespace().Name), - vdbuilder.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{ - URL: object.ImageURLUbuntu, - }), + t.VDRoot = object.NewVDFromCVI("vd-root", t.Framework.Namespace().Name, object.PrecreatedCVIUbuntu, vdbuilder.WithAnnotation(resourceAnnotationName, resourceAnnotationValue), vdbuilder.WithLabel(resourceLabelName, resourceLabelValue), ) @@ -343,7 +331,7 @@ runcmd: }, v1alpha2.BlockDeviceSpecRef{ Kind: v1alpha2.ClusterImageDevice, - Name: t.CVI.Name, + Name: object.PrecreatedCVITestDataISO, }, v1alpha2.BlockDeviceSpecRef{ Kind: v1alpha2.ImageDevice,