From 908c317f998fe9926eb64a6c30630955e9e2813b Mon Sep 17 00:00:00 2001 From: omeryahud Date: Tue, 26 May 2020 16:00:09 +0300 Subject: [PATCH] Template version is now defined in a variable in the template file in order to set the proper template name in proccessed VM labels. (#154) Signed-off-by: Omer Yahud --- templates/_linux.yaml | 2 +- templates/centos6.tpl.yaml | 3 ++- templates/centos7.tpl.yaml | 3 ++- templates/centos8.tpl.yaml | 3 ++- templates/fedora.tpl.yaml | 3 ++- templates/opensuse.tpl.yaml | 3 ++- templates/rhel6.tpl.yaml | 3 ++- templates/rhel7.tpl.yaml | 3 ++- templates/rhel8.tpl.yaml | 3 ++- templates/ubuntu.tpl.yaml | 3 ++- templates/win2k12r2-deprecated.tpl.yaml | 5 +++-- templates/windows.tpl.yaml | 5 +++-- templates/windows10.tpl.yaml | 5 +++-- 13 files changed, 28 insertions(+), 16 deletions(-) diff --git a/templates/_linux.yaml b/templates/_linux.yaml index 736ffba2..8adc2561 100644 --- a/templates/_linux.yaml +++ b/templates/_linux.yaml @@ -45,7 +45,7 @@ objects: metadata: name: ${NAME} labels: - vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} 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/centos6.tpl.yaml b/templates/centos6.tpl.yaml index 8216afad..8cad0f7d 100644 --- a/templates/centos6.tpl.yaml +++ b/templates/centos6.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.7.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v0.7.0 + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "CentOS 6.0+ VM" description: >- diff --git a/templates/centos7.tpl.yaml b/templates/centos7.tpl.yaml index 0a247d2a..1a6d3e99 100644 --- a/templates/centos7.tpl.yaml +++ b/templates/centos7.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.7.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v0.7.0 + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "CentOS 7.0+ VM" description: >- diff --git a/templates/centos8.tpl.yaml b/templates/centos8.tpl.yaml index db3adc16..003a21ef 100644 --- a/templates/centos8.tpl.yaml +++ b/templates/centos8.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.11.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v0.11.0 + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "CentOS 8.0+ VM" description: >- diff --git a/templates/fedora.tpl.yaml b/templates/fedora.tpl.yaml index 683a97a0..7397d6c5 100644 --- a/templates/fedora.tpl.yaml +++ b/templates/fedora.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.7.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v0.7.0 + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "Fedora 23+ VM" description: >- diff --git a/templates/opensuse.tpl.yaml b/templates/opensuse.tpl.yaml index 60eba8c6..ffbc8fc5 100644 --- a/templates/opensuse.tpl.yaml +++ b/templates/opensuse.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.7.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v0.7.0 + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "OpenSUSE Leap 15.0 VM" description: >- diff --git a/templates/rhel6.tpl.yaml b/templates/rhel6.tpl.yaml index 637f8626..3339d9a2 100644 --- a/templates/rhel6.tpl.yaml +++ b/templates/rhel6.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.7.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v0.7.0 + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "Red Hat Enterprise Linux 6.0+ VM" description: >- diff --git a/templates/rhel7.tpl.yaml b/templates/rhel7.tpl.yaml index 8d9c9e41..87290f88 100644 --- a/templates/rhel7.tpl.yaml +++ b/templates/rhel7.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.7.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v0.7.0 + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "Red Hat Enterprise Linux 7.0+ VM" description: >- diff --git a/templates/rhel8.tpl.yaml b/templates/rhel8.tpl.yaml index 91876a9c..dd024588 100644 --- a/templates/rhel8.tpl.yaml +++ b/templates/rhel8.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.10.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v0.10.0 + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "Red Hat Enterprise Linux 8.0+ VM" description: >- diff --git a/templates/ubuntu.tpl.yaml b/templates/ubuntu.tpl.yaml index 6890ac79..24bb39b8 100644 --- a/templates/ubuntu.tpl.yaml +++ b/templates/ubuntu.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.11.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v0.11.0 + name: {{ os }}-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "Ubuntu 18.04 (Xenial Xerus) VM" description: >- diff --git a/templates/win2k12r2-deprecated.tpl.yaml b/templates/win2k12r2-deprecated.tpl.yaml index 9f8599d5..204c4491 100644 --- a/templates/win2k12r2-deprecated.tpl.yaml +++ b/templates/win2k12r2-deprecated.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.7.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: win2k12r2-{{ item.workload }}-{{ item.flavor }}-v0.7.0 + name: win2k12r2-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "Microsoft Windows Server 2012 R2 VM" description: >- @@ -81,7 +82,7 @@ objects: metadata: name: ${NAME} labels: - vm.kubevirt.io/template: win2k12r2-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template: win2k12r2-{{ item.workload }}-{{ item.flavor }}-v{{ version }} 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/windows.tpl.yaml b/templates/windows.tpl.yaml index 182c5239..e9913647 100644 --- a/templates/windows.tpl.yaml +++ b/templates/windows.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.7.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: windows-{{ item.workload }}-{{ item.flavor }}-v0.7.0 + name: windows-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "Microsoft Windows Server 2012 R2+ VM" description: >- @@ -79,7 +80,7 @@ objects: metadata: name: ${NAME} labels: - vm.kubevirt.io/template: windows-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template: windows-{{ item.workload }}-{{ item.flavor }}-v{{ version }} 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/windows10.tpl.yaml b/templates/windows10.tpl.yaml index 309f41fb..3538c921 100644 --- a/templates/windows10.tpl.yaml +++ b/templates/windows10.tpl.yaml @@ -1,7 +1,8 @@ +{% set version = "0.7.0" %} apiVersion: template.openshift.io/v1 kind: Template metadata: - name: windows10-{{ item.workload }}-{{ item.flavor }}-v0.7.0 + name: windows10-{{ item.workload }}-{{ item.flavor }}-v{{ version }} annotations: openshift.io/display-name: "Microsoft Windows 10 VM" description: >- @@ -71,7 +72,7 @@ objects: metadata: name: ${NAME} labels: - vm.kubevirt.io/template: windows10-{{ item.workload }}-{{ item.flavor }} + vm.kubevirt.io/template: windows10-{{ item.workload }}-{{ item.flavor }}-v{{ version }} vm.kubevirt.io/template.version: "{{ lookup('env', 'VERSION') | default('devel', true) }}" vm.kubevirt.io/template.revision: "{{ lookup('env', 'REVISION') | default(1, true) }}" app: ${NAME}