Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arm64 preferences and test coverage #170

Merged
merged 7 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,19 @@ centos.stream9 | CentOS Stream 9
centos.stream9.desktop | CentOS Stream 9
centos.stream9.dpdk | CentOS Stream 9
cirros | Cirros
fedora | Fedora
fedora | Fedora (amd64)
fedora.arm64 | Fedora (arm64)
opensuse.leap | OpenSUSE Leap
opensuse.tumbleweed | OpenSUSE Tumbleweed
rhel.7 | Red Hat Enterprise Linux 7
rhel.7.desktop | Red Hat Enterprise Linux 7
rhel.8 | Red Hat Enterprise Linux 8
rhel.8.desktop | Red Hat Enterprise Linux 8
rhel.8.dpdk | Red Hat Enterprise Linux 8
rhel.9 | Red Hat Enterprise Linux 9
rhel.9.desktop | Red Hat Enterprise Linux 9
rhel.9.dpdk | Red Hat Enterprise Linux 9
rhel.9 | Red Hat Enterprise Linux 9 (amd64)
rhel.9.arm64 | Red Hat Enterprise Linux 9 (arm64)
rhel.9.desktop | Red Hat Enterprise Linux 9 Desktop (amd64)
rhel.9.dpdk | Red Hat Enterprise Linux 9 DPDK (amd64)
sles | SUSE Linux Enterprise Server
ubuntu | Ubuntu
windows.10 | Microsoft Windows 10
Expand Down
29 changes: 29 additions & 0 deletions preferences/fedora/amd64/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base

components:
- ./metadata
- ../requirements
- ../../components/diskbus-virtio-blk
- ../../components/interfacemodel-virtio-net
- ../../components/rng
- ../../components/secureboot
- ../../components/interface-multiqueue

patches:
- target:
kind: VirtualMachinePreference
patch: |-
- op: replace
path: /metadata/name
value: fedora
- target:
kind: VirtualMachineClusterPreference
patch: |-
- op: replace
path: /metadata/name
value: fedora
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ metadata:
annotations:
tags: "hidden,kubevirt,fedora"
iconClass: "icon-fedora"
openshift.io/display-name: "Fedora"
openshift.io/display-name: "Fedora (amd64)"
labels:
instancetype.kubevirt.io/arch: "amd64"
28 changes: 28 additions & 0 deletions preferences/fedora/arm64/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base

components:
- ./metadata
- ../requirements
- ../../components/diskbus-virtio-blk
- ../../components/interfacemodel-virtio-net
- ../../components/rng
- ../../components/interface-multiqueue

patches:
- target:
kind: VirtualMachinePreference
patch: |-
- op: replace
path: /metadata/name
value: fedora.arm64
- target:
kind: VirtualMachineClusterPreference
patch: |-
- op: replace
path: /metadata/name
value: fedora.arm64
11 changes: 11 additions & 0 deletions preferences/fedora/arm64/metadata/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: instancetype.kubevirt.io/v1beta1
kind: VirtualMachinePreference
metadata:
name: metadata
annotations:
tags: "hidden,kubevirt,fedora"
iconClass: "icon-fedora"
openshift.io/display-name: "Fedora (arm64)"
labels:
instancetype.kubevirt.io/arch: "arm64"
25 changes: 2 additions & 23 deletions preferences/fedora/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../base

components:
- ./metadata
- ./requirements
- ../components/diskbus-virtio-blk
- ../components/interfacemodel-virtio-net
- ../components/rng
- ../components/secureboot

patches:
- target:
kind: VirtualMachinePreference
patch: |-
- op: replace
path: /metadata/name
value: fedora
- target:
kind: VirtualMachineClusterPreference
patch: |-
- op: replace
path: /metadata/name
value: fedora
- ./arm64
lyarwood marked this conversation as resolved.
Show resolved Hide resolved
- ./amd64
15 changes: 15 additions & 0 deletions preferences/rhel/9/amd64/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base

components:
- ./metadata
- ./requirements
- ../../../components/disk-dedicatediothread
- ../../../components/rng
- ../../../components/secureboot

nameSuffix: ".9"
11 changes: 11 additions & 0 deletions preferences/rhel/9/amd64/metadata/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- path: ./metadata.yaml
target:
kind: VirtualMachinePreference
- path: ./metadata.yaml
target:
kind: VirtualMachineClusterPreference
9 changes: 9 additions & 0 deletions preferences/rhel/9/amd64/metadata/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: instancetype.kubevirt.io/v1beta1
kind: VirtualMachinePreference
metadata:
name: metadata
annotations:
openshift.io/display-name: "Red Hat Enterprise Linux 9 (amd64)"
labels:
instancetype.kubevirt.io/arch: "amd64"
14 changes: 14 additions & 0 deletions preferences/rhel/9/arm64/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base

components:
- ./metadata
- ./requirements
- ../../../components/disk-dedicatediothread
- ../../../components/rng

nameSuffix: ".9.arm64"
11 changes: 11 additions & 0 deletions preferences/rhel/9/arm64/metadata/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- path: ./metadata.yaml
target:
kind: VirtualMachinePreference
- path: ./metadata.yaml
target:
kind: VirtualMachineClusterPreference
9 changes: 9 additions & 0 deletions preferences/rhel/9/arm64/metadata/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: instancetype.kubevirt.io/v1beta1
kind: VirtualMachinePreference
metadata:
name: metadata
annotations:
openshift.io/display-name: "Red Hat Enterprise Linux 9 (arm64)"
labels:
instancetype.kubevirt.io/arch: "arm64"
11 changes: 11 additions & 0 deletions preferences/rhel/9/arm64/requirements/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- path: ./requirements.yaml
target:
kind: VirtualMachinePreference
- path: ./requirements.yaml
target:
kind: VirtualMachineClusterPreference
12 changes: 12 additions & 0 deletions preferences/rhel/9/arm64/requirements/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: instancetype.kubevirt.io/v1beta1
kind: VirtualMachinePreference
metadata:
name: requirements
spec:
# https://access.redhat.com/articles/rhel-limits#minimum-required-memory-3
requirements:
cpu:
guest: 1
memory:
guest: 1.5Gi
12 changes: 2 additions & 10 deletions preferences/rhel/9/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../base

components:
- ./metadata
- ./requirements
- ../../components/disk-dedicatediothread
- ../../components/rng
- ../../components/secureboot

nameSuffix: ".9"
- ./arm64
- ./amd64
3 changes: 2 additions & 1 deletion preferences/rhel/9_desktop/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../9
- ../9/amd64

components:
- ./metadata
- ../../components/tablet-virtio

nameSuffix: ".desktop"
11 changes: 11 additions & 0 deletions preferences/rhel/9_desktop/metadata/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- path: ./metadata.yaml
target:
kind: VirtualMachinePreference
- path: ./metadata.yaml
target:
kind: VirtualMachineClusterPreference
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ kind: VirtualMachinePreference
metadata:
name: metadata
annotations:
openshift.io/display-name: "Red Hat Enterprise Linux 9"
openshift.io/display-name: "Red Hat Enterprise Linux 9 Desktop (amd64)"
2 changes: 1 addition & 1 deletion preferences/rhel/9_dpdk/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../9
- ../9/amd64

components:
- ./metadata
Expand Down
1 change: 1 addition & 0 deletions preferences/rhel/9_dpdk/metadata/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ metadata:
name: metadata
annotations:
tags: "hidden,kubevirt,linux,rhel,dpdk"
openshift.io/display-name: "Red Hat Enterprise Linux 9 DPDK (amd64)"
52 changes: 40 additions & 12 deletions tests/functests/instancetype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"crypto/ed25519"
"fmt"
rt "runtime"
"time"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -34,6 +35,9 @@ var _ = Describe("Common instance types func tests", func() {
)

AfterEach(func() {
if vm == nil {
return
}
err = virtClient.VirtualMachine(testNamespace).Delete(context.Background(), vm.Name,
&metav1.DeleteOptions{GracePeriodSeconds: ptr.To[int64](0)})
if err != nil && !errors.IsNotFound(err) {
Expand Down Expand Up @@ -95,7 +99,11 @@ var _ = Describe("Common instance types func tests", func() {
Expect(err).ToNot(HaveOccurred())
})

DescribeTable("a Linux guest with", func(containerDisk, preference string, testFns []testFn) {
DescribeTable("a Linux guest with", func(containerDisk string, preferences map[string]string, testFns []testFn) {
preference, hasArch := preferences[rt.GOARCH]
if !hasArch {
Skip(fmt.Sprintf("skipping as no preference provided for arch %s", rt.GOARCH))
}
vm = randomVM(&v1.InstancetypeMatcher{Name: "u1.small"}, &v1.PreferenceMatcher{Name: preference}, true)
addContainerDisk(vm, containerDisk)
addCloudInitWithAuthorizedKey(vm, privKey)
Expand All @@ -106,27 +114,31 @@ var _ = Describe("Common instance types func tests", func() {
testFn(virtClient, vm.Name)
}
},
Entry("[test_id:10738] Fedora", fedoraContainerDisk, "fedora",
Entry("[test_id:10738] Fedora", fedoraContainerDisk, map[string]string{"amd64": "fedora", "arm64": "fedora.arm64"},
[]testFn{expectGuestAgentToBeConnected, expectSSHToRunCommandOnLinux("fedora")}),
Entry("[test_id:10740] CentOS 7", centos7ContainerDisk, "centos.7",
Entry("[test_id:10740] CentOS 7", centos7ContainerDisk, map[string]string{"amd64": "centos.7"},
[]testFn{expectGuestAgentToBeConnected, expectSSHToRunCommandOnLinux("centos")}),
Entry("[test_id:10744] CentOS Stream 8", centosStream8ContainerDisk, "centos.stream8",
Entry("[test_id:10744] CentOS Stream 8", centosStream8ContainerDisk, map[string]string{"amd64": "centos.stream8"},
[]testFn{expectGuestAgentToBeConnected, expectSSHToRunCommandOnLinux("centos")}),
Entry("[test_id:10745] CentOS Stream 9", centosStream9ContainerDisk, "centos.stream9",
Entry("[test_id:10745] CentOS Stream 9", centosStream9ContainerDisk,
map[string]string{"amd64": "centos.stream9", "arm64": "centos.stream9"},
[]testFn{expectGuestAgentToBeConnected, expectSSHToRunCommandOnLinux("cloud-user")}),
Entry("[test_id:TODO] RHEL 9", rhel9ContainerDisk, map[string]string{"amd64": "rhel.9", "arm64": "rhel.9.arm64"},
[]testFn{expectGuestAgentToBeConnected, expectSSHToRunCommandOnLinux("cloud-user")}),
Entry("[test_id:10741] Ubuntu 18.04", ubuntu1804ContainerDisk, "ubuntu",
Entry("[test_id:10741] Ubuntu 18.04", ubuntu1804ContainerDisk, map[string]string{"amd64": "ubuntu"},
[]testFn{expectSSHToRunCommandOnLinux("ubuntu")}),
Entry("[test_id:10742] Ubuntu 20.04", ubuntu2004ContainerDisk, "ubuntu",
Entry("[test_id:10742] Ubuntu 20.04", ubuntu2004ContainerDisk, map[string]string{"amd64": "ubuntu", "arm64": "ubuntu"},
[]testFn{expectSSHToRunCommandOnLinux("ubuntu")}),
Entry("[test_id:10743] Ubuntu 22.04", ubuntu2204ContainerDisk, "ubuntu",
Entry("[test_id:10743] Ubuntu 22.04", ubuntu2204ContainerDisk, map[string]string{"amd64": "ubuntu", "arm64": "ubuntu"},
[]testFn{expectSSHToRunCommandOnLinux("ubuntu")}),
Entry("[test_id:TODO] Ubuntu 24.04", ubuntu2404ContainerDisk, "ubuntu",
Entry("[test_id:TODO] Ubuntu 24.04", ubuntu2404ContainerDisk, map[string]string{"amd64": "ubuntu", "arm64": "ubuntu"},
[]testFn{expectSSHToRunCommandOnLinux("ubuntu")}),
Entry("[test_id:TODO] OpenSUSE Tumbleweed", openSUSETumbleweedContainerDisk, "opensuse.tumbleweed",
Entry("[test_id:TODO] OpenSUSE Tumbleweed", openSUSETumbleweedContainerDisk, map[string]string{"amd64": "opensuse.tumbleweed"},
[]testFn{expectGuestAgentToBeConnected, expectSSHToRunCommandOnLinux("opensuse")}),
Entry("[test_id:TODO] OpenSUSE Leap 15", openSUSELeap15ContainerDisk, "opensuse.leap",
Entry("[test_id:TODO] OpenSUSE Leap 15", openSUSELeap15ContainerDisk,
map[string]string{"amd64": "opensuse.leap", "arm64": "opensuse.leap"},
[]testFn{expectGuestAgentToBeConnected, expectSSHToRunCommandOnLinux("opensuse")}),
Entry("[test_id:TODO] SLES 15", sles15ContainerDisk, "sles",
Entry("[test_id:TODO] SLES 15", sles15ContainerDisk, map[string]string{"amd64": "sles"},
[]testFn{expectGuestAgentToBeConnected, expectSSHToRunCommandOnLinux("sles")}),
)

Expand Down Expand Up @@ -205,6 +217,22 @@ func randomVM(instancetype *v1.InstancetypeMatcher, preference *v1.PreferenceMat
},
Spec: v1.VirtualMachineInstanceSpec{
TerminationGracePeriodSeconds: ptr.To[int64](0),
Domain: v1.DomainSpec{
Devices: v1.Devices{
Interfaces: []v1.Interface{{
Name: "default",
InterfaceBindingMethod: v1.InterfaceBindingMethod{
Masquerade: &v1.InterfaceMasquerade{},
},
}},
},
},
Networks: []v1.Network{{
Name: "default",
NetworkSource: v1.NetworkSource{
Pod: &v1.PodNetwork{},
},
}},
},
},
},
Expand Down
Loading