Skip to content

Commit 0b2058e

Browse files
committed
update generate_template_labels method
on multi-arch clusters multiple templates of same OS (with diff arch) exists added optional architecture param
1 parent e10b867 commit 0b2058e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ocp_resources/template.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Labels:
1212
FLAVOR = "flavor.template.kubevirt.io"
1313
OS = "os.template.kubevirt.io"
1414
WORKLOAD = "workload.template.kubevirt.io"
15+
ARCHITECTURE = f"{NamespacedResource.ApiGroup.TEMPLATE_KUBEVIRT_IO}/architecture"
1516

1617
class Workload:
1718
DESKTOP = "desktop"
@@ -61,9 +62,12 @@ def process(self, client=None, **kwargs):
6162
return response.to_dict()["objects"]
6263

6364
@staticmethod
64-
def generate_template_labels(os, workload, flavor):
65-
return [
66-
f"{Template.Labels.OS}/{os}",
67-
(f"{Template.Labels.WORKLOAD}/{getattr(Template.Workload, workload.upper())}"),
68-
f"{Template.Labels.FLAVOR}/{getattr(Template.Flavor, flavor.upper())}",
65+
def generate_template_labels(os, workload, flavor, architecture=None):
66+
labels = [
67+
f"{Template.Labels.OS}/{os}=true",
68+
(f"{Template.Labels.WORKLOAD}/{getattr(Template.Workload, workload.upper())}=true"),
69+
f"{Template.Labels.FLAVOR}/{getattr(Template.Flavor, flavor.upper())}=true",
6970
]
71+
if architecture:
72+
labels.append(f"{Template.Labels.ARCHITECTURE}={architecture}")
73+
return labels

0 commit comments

Comments
 (0)