From e03adcc2fb34d5f9f8fb0b8d2f0979415faee398 Mon Sep 17 00:00:00 2001 From: Nestor Acuna Blanco Date: Wed, 27 Nov 2024 09:43:06 +0100 Subject: [PATCH] feat: add suffix to the s390x templates This change also involves renaming the templates themselves. The end-to-end (e2e) tests require minimal adjustments. The following templates will be generated for s390x: - CentOS Stream 9 - Fedora - RHEL 8 - RHEL 9 - Ubuntu Signed-off-by: Nestor Acuna Blanco --- automation/test-linux.sh | 3 ++- generate-templates.yaml | 12 +++++++----- makefile | 5 +++-- templates/centos-stream9.tpl.yaml | 4 ++-- templates/fedora.tpl.yaml | 4 ++-- templates/rhel8.tpl.yaml | 4 ++-- templates/rhel9.tpl.yaml | 4 ++-- templates/ubuntu.tpl.yaml | 4 ++-- 8 files changed, 22 insertions(+), 18 deletions(-) diff --git a/automation/test-linux.sh b/automation/test-linux.sh index ccf8d74e..ff4b7aeb 100755 --- a/automation/test-linux.sh +++ b/automation/test-linux.sh @@ -163,9 +163,10 @@ run_vm() { fi } +target_arch_suffix=$( [ "$TARGET_ARCH" = "x86_64" ] && echo "" || echo "-$TARGET_ARCH" ) for size in "${sizes[@]}"; do for workload in "${workloads[@]}"; do - vm_name=$template_name-$workload-$size + vm_name=$template_name-$workload-$size$target_arch_suffix run_vm "$vm_name" done done diff --git a/generate-templates.yaml b/generate-templates.yaml index 042443ea..40d2f8ea 100644 --- a/generate-templates.yaml +++ b/generate-templates.yaml @@ -2,6 +2,8 @@ - connection: local hosts: 127.0.0.1 gather_facts: yes + vars: + suffix: "{{ '' if target_arch == 'x86_64' else '-' + target_arch }}" tasks: - name: Ensure target_arch is defined assert: @@ -27,7 +29,7 @@ - name: Generate RHEL 9 templates template: src: rhel9.tpl.yaml - dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}.yaml" + dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }}.yaml" with_items: - {flavor: tiny, workload: server, memsize: "1.5Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: False, default: False} - {flavor: tiny, workload: desktop, memsize: "1.5Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: False} @@ -62,7 +64,7 @@ - name: Generate RHEL 8 templates template: src: rhel8.tpl.yaml - dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}.yaml" + dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }}.yaml" with_items: - {flavor: tiny, workload: server, memsize: "1.5Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: False, default: False} - {flavor: tiny, workload: desktop, memsize: "1.5Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: False} @@ -131,7 +133,7 @@ - name: Generate CentOS Stream 9 templates template: src: centos-stream9.tpl.yaml - dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}.yaml" + dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }}.yaml" with_items: - {flavor: tiny, workload: server, memsize: "1.5Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: False, default: False} - {flavor: tiny, workload: desktop, memsize: "1.5Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: False} @@ -188,7 +190,7 @@ - name: Generate Fedora templates template: src: fedora.tpl.yaml - dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}.yaml" + dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }}.yaml" with_items: - {flavor: small, workload: desktop, memsize: "2Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: False} - {flavor: small, workload: server, memsize: "2Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: False, default: True} @@ -252,7 +254,7 @@ - name: Generate Ubuntu templates template: src: ubuntu.tpl.yaml - dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}.yaml" + dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }}.yaml" with_items: - {flavor: small, workload: desktop, memsize: "3Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: False} - {flavor: small, workload: server, memsize: "3Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: True} diff --git a/makefile b/makefile index 01c41be6..f29183bc 100644 --- a/makefile +++ b/makefile @@ -30,7 +30,7 @@ release: dist/common-templates.yaml cp dist/common-templates.yaml dist/common-templates-$(VERSION).yaml e2e-tests: - ./automation/test.sh + TARGET_ARCH=$(TARGET_ARCH) ./automation/test.sh go-tests: go test -v ./tests/ @@ -44,7 +44,8 @@ validate-no-offensive-lang: generate: generate-templates.yaml $(METASOURCES) # Just build the XML files, no need to export to tarball make -C osinfo-db/ OSINFO_DB_EXPORT=echo - ansible-playbook generate-templates.yaml -e "target_arch=$(TARGET_ARCH)" + ansible-playbook generate-templates.yaml -e "target_arch=x86_64" + ansible-playbook generate-templates.yaml -e "target_arch=s390x" update-osinfo-db: git submodule init diff --git a/templates/centos-stream9.tpl.yaml b/templates/centos-stream9.tpl.yaml index f03674c0..5c6bb8a7 100644 --- a/templates/centos-stream9.tpl.yaml +++ b/templates/centos-stream9.tpl.yaml @@ -1,7 +1,7 @@ apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }} + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} annotations: openshift.io/display-name: "CentOS Stream 9 VM" description: >- @@ -55,7 +55,7 @@ objects: metadata: name: ${NAME} labels: - vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} vm.kubevirt.io/template.version: "{{ lookup('env', 'VERSION') | default('devel', true) }}" vm.kubevirt.io/template.revision: "{{ lookup('env', 'REVISION') | default(1, true) }}" app: ${NAME} diff --git a/templates/fedora.tpl.yaml b/templates/fedora.tpl.yaml index 06c469e4..a4049497 100644 --- a/templates/fedora.tpl.yaml +++ b/templates/fedora.tpl.yaml @@ -1,7 +1,7 @@ apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }} + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} annotations: openshift.io/display-name: "Fedora VM" description: >- @@ -54,7 +54,7 @@ objects: metadata: name: ${NAME} labels: - vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} vm.kubevirt.io/template.version: "{{ lookup('env', 'VERSION') | default('devel', true) }}" vm.kubevirt.io/template.revision: "{{ lookup('env', 'REVISION') | default(1, true) }}" app: ${NAME} diff --git a/templates/rhel8.tpl.yaml b/templates/rhel8.tpl.yaml index dc2ee5a8..2532acca 100644 --- a/templates/rhel8.tpl.yaml +++ b/templates/rhel8.tpl.yaml @@ -1,7 +1,7 @@ apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }} + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} annotations: openshift.io/display-name: "Red Hat Enterprise Linux 8 VM" description: >- @@ -51,7 +51,7 @@ objects: metadata: name: ${NAME} labels: - vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} vm.kubevirt.io/template.version: "{{ lookup('env', 'VERSION') | default('devel', true) }}" vm.kubevirt.io/template.revision: "{{ lookup('env', 'REVISION') | default(1, true) }}" app: ${NAME} diff --git a/templates/rhel9.tpl.yaml b/templates/rhel9.tpl.yaml index 1cf00a53..ac0ab20f 100644 --- a/templates/rhel9.tpl.yaml +++ b/templates/rhel9.tpl.yaml @@ -1,7 +1,7 @@ apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }} + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} annotations: openshift.io/display-name: "Red Hat Enterprise Linux 9 VM" description: >- @@ -51,7 +51,7 @@ objects: metadata: name: ${NAME} labels: - vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} vm.kubevirt.io/template.version: "{{ lookup('env', 'VERSION') | default('devel', true) }}" vm.kubevirt.io/template.revision: "{{ lookup('env', 'REVISION') | default(1, true) }}" app: ${NAME} diff --git a/templates/ubuntu.tpl.yaml b/templates/ubuntu.tpl.yaml index 60d238c4..820b21e1 100644 --- a/templates/ubuntu.tpl.yaml +++ b/templates/ubuntu.tpl.yaml @@ -1,7 +1,7 @@ apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }} + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} annotations: openshift.io/display-name: "Ubuntu {{ lookup('osinfo', oslabels[0]).version }}+ VM" description: >- @@ -55,7 +55,7 @@ objects: metadata: name: ${NAME} labels: - vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }}{{ suffix }} vm.kubevirt.io/template.version: "{{ lookup('env', 'VERSION') | default('devel', true) }}" vm.kubevirt.io/template.revision: "{{ lookup('env', 'REVISION') | default(1, true) }}" app: ${NAME}