Skip to content

Commit

Permalink
feat: add suffix to the s390x templates
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nestoracunablanco committed Nov 28, 2024
1 parent 16d3b8d commit e03adcc
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 18 deletions.
3 changes: 2 additions & 1 deletion automation/test-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 7 additions & 5 deletions generate-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
5 changes: 3 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions templates/centos-stream9.tpl.yaml
Original file line number Diff line number Diff line change
@@ -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: >-
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions templates/fedora.tpl.yaml
Original file line number Diff line number Diff line change
@@ -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: >-
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions templates/rhel8.tpl.yaml
Original file line number Diff line number Diff line change
@@ -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: >-
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions templates/rhel9.tpl.yaml
Original file line number Diff line number Diff line change
@@ -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: >-
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions templates/ubuntu.tpl.yaml
Original file line number Diff line number Diff line change
@@ -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: >-
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit e03adcc

Please sign in to comment.