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

Rename parameters to DATA_SOURCE_NAME and DATA_SOURCE_NAMESPACE #398

Merged
merged 1 commit into from
Jan 27, 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ $ oc process --local -f dist/templates/windows10-desktop-medium.yaml
$ oc process --local -f dist/templates/windows10-desktop-medium.yaml --parameters
NAME DESCRIPTION GENERATOR VALUE
NAME VM name expression windows-[a-z0-9]{6}
SRC_PVC_NAME Name of the DataSource to clone win10
SRC_PVC_NAMESPACE Namespace of the DataSource kubevirt-os-images
DATA_SOURCE_NAME Name of the DataSource to clone win10
DATA_SOURCE_NAMESPACE Namespace of the DataSource kubevirt-os-images

$ oc process --local -f dist/templates/windows10-desktop-medium.yaml | kubectl apply -f -
virtualmachine.kubevirt.io/windows10-rt1ap2 created
Expand Down
2 changes: 1 addition & 1 deletion automation/test-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ run_vm() {
#If first try fails, it tries 2 more time to run it, before it fails whole test
for i in $(seq 1 3); do
error=false
oc process ${template_option} -n $namespace -o json NAME=$vm_name SRC_PVC_NAME=${dv_name} SRC_PVC_NAMESPACE=${namespace} |
oc process ${template_option} -n $namespace -o json NAME=$vm_name DATA_SOURCE_NAME=${dv_name} DATA_SOURCE_NAMESPACE=${namespace} |
jq '.items[0].metadata.labels["vm.kubevirt.io/template.namespace"]="kubevirt"' |
oc apply -n $namespace -f -

Expand Down
2 changes: 1 addition & 1 deletion automation/test-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ run_vm(){
for i in `seq 1 3`; do
error=false

oc process -n $namespace -o json $template_name NAME=$vm_name SRC_PVC_NAME=${dv_name} SRC_PVC_NAMESPACE=${namespace} | \
oc process -n $namespace -o json $template_name NAME=$vm_name DATA_SOURCE_NAME=${dv_name} DATA_SOURCE_NAMESPACE=${namespace} | \
jq '.items[0].metadata.labels["vm.kubevirt.io/template.namespace"]="kubevirt"' | \
oc apply -n $namespace -f -

Expand Down
2 changes: 1 addition & 1 deletion automation/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ for template in $templates; do
if [[ $template =~ .*saphana.* ]]; then
oc process -f "$template" NAME=test WORKLOAD_NODE_LABEL_VALUE="somevalue" SRIOV_NETWORK_NAME1="default/sriov1" SRIOV_NETWORK_NAME2="default/sriov1" SRIOV_NETWORK_NAME3="default/sriov1"|| exit 1
else
oc process -f "$template" NAME=test SRC_PVC_NAME=test || exit 1
oc process -f "$template" NAME=test DATA_SOURCE_NAME=test || exit 1
fi
done

Expand Down
12 changes: 10 additions & 2 deletions automation/validate-pvc-name-stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,19 @@ def getParamFrom(template, paramName):


def getDataSourceOrPvcNameFrom(template):
return getParamFrom(template, "SRC_PVC_NAME")
ds_name = getParamFrom(template, "DATA_SOURCE_NAME")
if ds_name is None:
return getParamFrom(template, "SRC_PVC_NAME")

return ds_name


def getDataSourceOrPvcNamespaceFrom(template):
return getParamFrom(template, "SRC_PVC_NAMESPACE")
ds_namespace = getParamFrom(template, "DATA_SOURCE_NAMESPACE")
if ds_namespace is None:
return getParamFrom(template, "SRC_PVC_NAMESPACE")

return ds_namespace


def fetchLiveTemplates():
Expand Down
4 changes: 2 additions & 2 deletions templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ parameters:
description: VM name
generate: expression
from: "windows-[a-z0-9]{6}"
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: win10
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images

Expand Down
8 changes: 4 additions & 4 deletions templates/centos-stream8.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -137,10 +137,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/centos-stream9.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -137,10 +137,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/centos6.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -141,10 +141,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/centos7.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -137,10 +137,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/fedora.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -148,10 +148,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/opensuse.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -139,10 +139,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/rhel6.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -141,10 +141,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/rhel7.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -146,10 +146,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/rhel8.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -146,10 +146,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/rhel9.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -159,10 +159,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/ubuntu.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ objects:
storage: 30Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -142,10 +142,10 @@ parameters:
from: '{{ os }}-[a-z0-9]{16}'
generate: expression
name: NAME
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: '{{ majorrelease }}'
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
- description: Randomized password for the cloud-init user {{ cloudusername }}
Expand Down
8 changes: 4 additions & 4 deletions templates/windows10.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ objects:
storage: 60Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -182,9 +182,9 @@ parameters:
description: VM name
generate: expression
from: "windows-[a-z0-9]{6}"
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: win10
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
8 changes: 4 additions & 4 deletions templates/windows2k12.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ objects:
storage: 60Gi
sourceRef:
kind: DataSource
name: ${SRC_PVC_NAME}
namespace: ${SRC_PVC_NAMESPACE}
name: ${DATA_SOURCE_NAME}
namespace: ${DATA_SOURCE_NAMESPACE}
running: false
template:
metadata:
Expand Down Expand Up @@ -182,9 +182,9 @@ parameters:
description: VM name
generate: expression
from: "windows-[a-z0-9]{6}"
- name: SRC_PVC_NAME
- name: DATA_SOURCE_NAME
description: Name of the DataSource to clone
value: win2k12r2
- name: SRC_PVC_NAMESPACE
- name: DATA_SOURCE_NAMESPACE
description: Namespace of the DataSource
value: kubevirt-os-images
Loading