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

Improve Ubuntu template #412

Merged
merged 1 commit into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion automation/test-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if [[ $TARGET =~ centos6.* ]]; then
fi

if [[ $TARGET =~ ubuntu.* ]]; then
workloads=("desktop")
workloads=("desktop" "server")
fi

if [[ $TARGET =~ opensuse.* ]]; then
Expand Down
14 changes: 9 additions & 5 deletions generate-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,22 +269,26 @@
osinfoname: "{{ oslabels[0] }}"
cloudusername: opensuse

- name: Load Ubuntu versions
set_fact:
ubuntu_labels: "{{ lookup('osinfo', 'distro=ubuntu') |select('osinfo_active') |map(attribute='short_id') |list |sort }}"

- name: Generate Ubuntu templates
template:
src: ubuntu.tpl.yaml
dest: "{{ playbook_dir }}/dist/templates/{{ os }}-{{ item.workload }}-{{ item.flavor }}.yaml"
with_items:
#minimal memory requirement for ubuntu is 2Gi, for now we don't have mechanism how to deprecate template
- {flavor: tiny, workload: desktop, memsize: "2Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: False}
- {flavor: small, workload: desktop, memsize: "2Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: True}
- {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: True, default: True}
- {flavor: medium, workload: desktop, memsize: "4Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: False}
- {flavor: medium, workload: server, memsize: "4Gi", cpus: 1, iothreads: False, emulatorthread: False, tablet: True, default: False}
- {flavor: large, workload: desktop, memsize: "8Gi", cpus: 2, iothreads: False, emulatorthread: False, tablet: True, default: False}
- {flavor: large, workload: server, memsize: "8Gi", cpus: 2, iothreads: False, emulatorthread: False, tablet: True, default: False}
vars:
os: ubuntu
icon: ubuntu
majorrelease: ubuntu
oslabels:
- ubuntu20.04
oslabels: "{{ ubuntu_labels }}"
osinfoname: "{{ oslabels[0] }}"
cloudusername: ubuntu

Expand Down
7 changes: 3 additions & 4 deletions templates/ubuntu.tpl.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{% set codename = lookup('osinfo', oslabels[0]).codename %}
{% set adjective, animal = (codename|lower).split(' ') %}
{% set displayname = lookup('osinfo', oslabels[0]).name %}
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: {{ os }}-{{ item.workload }}-{{ item.flavor }}
annotations:
openshift.io/display-name: {{ displayname }} ({{ codename }}) VM"
openshift.io/display-name: "Ubuntu {{ lookup('osinfo', oslabels[0]).version }}+ VM"
description: >-
Template for {{ displayname }} ({{ codename }}) VM.
Template for Ubuntu {{ lookup('osinfo', oslabels[0]).version }} VM or newer.
A PVC with the Ubuntu disk image must be available.
Recommended disk image:
http://cloud-images.ubuntu.com/{{ adjective }}/current/{{ adjective }}-server-cloudimg-amd64.img
Expand All @@ -29,7 +28,7 @@ metadata:
/objects[0].spec.template.spec.volumes
/objects[0].spec.template.spec.networks
{% for osl in oslabels %}
name.os.template.kubevirt.io/{{ osl }}: {{ displayname }} or higher
name.os.template.kubevirt.io/{{ osl }}: Ubuntu {{ lookup('osinfo', oslabels[0]).version }} or higher
{% endfor %}
labels:
{% for osl in oslabels %}
Expand Down