@@ -185,10 +185,10 @@ def copy_local_registry_certs(host: host.Host, path: str) -> None:
185
185
host .copy_to (f"{ directory } /{ file } " , f"{ path } /{ file } " )
186
186
187
187
188
- def build_dpu_operator_images () -> str :
188
+ def build_dpu_operator_images (repo : str , branch : str ) -> str :
189
189
logger .info ("Building dpu operator images" )
190
190
lh = host .LocalHost ()
191
- git_repo_setup (REPO_DIR , repo_wipe = True , url = DPU_OPERATOR_REPO , branch = "main" )
191
+ git_repo_setup (REPO_DIR , repo_wipe = True , url = repo , branch = branch )
192
192
update_dockerfiles_with_ose_images (REPO_DIR )
193
193
194
194
# Start a local registry to store dpu-operator images
@@ -201,26 +201,24 @@ def build_dpu_operator_images() -> str:
201
201
return registry
202
202
203
203
204
- def start_dpu_operator (h : host .Host , client : K8sClient , repo_wipe : bool = False ) -> None :
204
+ def start_dpu_operator (h : host .Host , client : K8sClient , repo_wipe : bool = False , repo : str = DPU_OPERATOR_REPO , branch : str = "main" ) -> None :
205
205
logger .info (f"Deploying dpu operator containers on { h .hostname ()} " )
206
206
if repo_wipe :
207
207
h .run (f"rm -rf { REPO_DIR } " )
208
- h .run_or_die (f"git clone { DPU_OPERATOR_REPO } " )
208
+ h .run_or_die (f"git clone --branch { branch } { repo } { REPO_DIR } " )
209
209
210
- REGISTRY = host .LocalHost ().hostname ()
211
210
h .run ("dnf install -y pip" )
212
211
h .run_or_die ("pip install yq" )
213
212
ensure_go_installed (h )
214
213
if h .is_localhost ():
215
214
env = os .environ .copy ()
216
215
env ["KUBECONFIG" ] = client ._kc
217
- env ["REGISTRY" ] = REGISTRY
218
216
h .run (f"make -C { REPO_DIR } undeploy" , env = env )
219
217
ret = h .run (f"make -C { REPO_DIR } local-deploy" , env = env )
220
218
if not ret .success ():
221
219
logger .error_and_exit ("Failed to deploy dpu operator" )
222
220
else :
223
- env_cmds = f"export KUBECONFIG={ client ._kc } && export REGISTRY={ REGISTRY } "
221
+ env_cmds = f"export KUBECONFIG={ client ._kc } && export REGISTRY={ host . LocalHost (). hostname () } "
224
222
h .run (f"cd { REPO_DIR } && { env_cmds } && make undeploy" )
225
223
h .run_or_die (f"cd { REPO_DIR } && { env_cmds } && make local-deploy" )
226
224
logger .info ("Waiting for all dpu operator pods to become ready" )
@@ -240,7 +238,7 @@ def ExtraConfigDpu(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[str,
240
238
client = K8sClient (MICROSHIFT_KUBECONFIG , acc )
241
239
242
240
if cfg .rebuild_dpu_operators_images :
243
- registry = build_dpu_operator_images ()
241
+ registry = build_dpu_operator_images (repo = cfg . dpu_operator_repo , branch = cfg . dpu_operator_branch )
244
242
else :
245
243
logger .info ("Will not rebuild dpu-operator images" )
246
244
registry = _ensure_local_registry_running (lh , delete_all = False )
@@ -257,7 +255,7 @@ def ExtraConfigDpu(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[str,
257
255
acc .run_or_die (cmd )
258
256
vendor_plugin .build_and_start (acc , client , registry )
259
257
260
- start_dpu_operator (acc , client , repo_wipe = True )
258
+ start_dpu_operator (acc , client , repo_wipe = True , repo = cfg . dpu_operator_repo , branch = cfg . dpu_operator_branch )
261
259
262
260
# Disable firewall to ensure host-side can reach dpu
263
261
acc .run ("systemctl stop firewalld" )
@@ -293,7 +291,7 @@ def ExtraConfigDpuHost(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[s
293
291
client = K8sClient (cc .kubeconfig )
294
292
295
293
if cfg .rebuild_dpu_operators_images :
296
- registry = build_dpu_operator_images ()
294
+ registry = build_dpu_operator_images (repo = cfg . dpu_operator_repo , branch = cfg . dpu_operator_branch )
297
295
else :
298
296
logger .info ("Will not rebuild dpu-operator images" )
299
297
registry = _ensure_local_registry_running (lh , delete_all = False )
@@ -306,7 +304,7 @@ def ExtraConfigDpuHost(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[s
306
304
vendor_plugin = init_vendor_plugin (h )
307
305
vendor_plugin .build_and_start (lh , client , registry )
308
306
309
- start_dpu_operator (lh , client )
307
+ start_dpu_operator (lh , client , repo_wipe = False , repo = cfg . dpu_operator_repo , branch = cfg . dpu_operator_branch )
310
308
311
309
def helper (h : host .Host , node : NodeConfig ) -> Optional [host .Result ]:
312
310
# Temporary workaround, remove once 4.16 installations are working
0 commit comments