4040from ..utils .file import write_tmp_file
4141from ..utils .console import xpk_print , xpk_exit
4242from ..utils .templates import TEMPLATE_PATH , get_templates_absolute_path
43+ from packaging .version import Version
4344
4445WAIT_FOR_KUEUE_TIMEOUT = "10m"
4546CLUSTER_QUEUE_NAME = "cluster-queue"
5152KUEUE_SUB_SLICING_TOPOLOGY_JINJA_FILE = "kueue_sub_slicing_topology.yaml.j2"
5253MEMORY_SIZE_PER_VM = 1.2
5354MIN_MEMORY_LIMIT_SIZE = 4096
54- KUEUE_VERSION = "v0.12.2"
55+ KUEUE_VERSION = Version ( "v0.12.2" )
5556
5657
5758@dataclass
@@ -78,7 +79,7 @@ class KueueManager:
7879
7980 def __init__ (
8081 self ,
81- kueue_version : str = KUEUE_VERSION ,
82+ kueue_version : Version = KUEUE_VERSION ,
8283 template_path = TEMPLATE_PATH ,
8384 ):
8485 self .kueue_version = kueue_version
@@ -111,17 +112,17 @@ def install_or_upgrade(
111112 )
112113 return 0
113114 else :
114- xpk_print (f"Upgrading Kueue to version { self .kueue_version } ..." )
115+ xpk_print (f"Upgrading Kueue to version v { self .kueue_version } ..." )
115116 else :
116- xpk_print (f"Installing Kueue version { self .kueue_version } ..." )
117+ xpk_print (f"Installing Kueue version v { self .kueue_version } ..." )
117118
118119 install_return_code = self .__install (tolerations )
119120 if install_return_code != 0 :
120121 return install_return_code
121122
122123 return self .__configure (kueue_config )
123124
124- def get_installed_kueue_version (self ) -> tuple [int , str | None ]:
125+ def get_installed_kueue_version (self ) -> tuple [int , Version | None ]:
125126 command = (
126127 "kubectl get deployment kueue-controller-manager -n kueue-system -o"
127128 " jsonpath='{.spec.template.spec.containers[0].image}'"
@@ -130,15 +131,14 @@ def get_installed_kueue_version(self) -> tuple[int, str | None]:
130131 return_code , val = run_command_for_value (
131132 command ,
132133 task ,
133- dry_run_return_val = """
134- v0.12.1""" ,
134+ dry_run_return_val = "" ,
135135 )
136136 if return_code != 0 :
137137 return return_code , None
138138 version_tag = val .split (":" )
139139 if len (version_tag ) == 1 :
140140 return 1 , None
141- return return_code , version_tag [- 1 ]
141+ return return_code , Version ( version_tag [- 1 ])
142142
143143 def __install (
144144 self ,
@@ -162,7 +162,7 @@ def __install(
162162 return self .__wait_for_kueue_available ()
163163
164164 def __install_kueue_crs (self ) -> int :
165- manifest_url = f"https://github.com/kubernetes-sigs/kueue/releases/download/{ self .kueue_version } /manifests.yaml"
165+ manifest_url = f"https://github.com/kubernetes-sigs/kueue/releases/download/v { self .kueue_version } /manifests.yaml"
166166 install_command = (
167167 f"kubectl apply --server-side --force-conflicts -f { manifest_url } "
168168 )
0 commit comments