Skip to content

Commit 636a9dc

Browse files
committed
Make dpu operator repo / branch configurable
Allow users to specify the repo/branch they want to build and deploy from in the CDA config file. i.e. - name: "dpu_operator_dpu" dpu_operator_repo: "https://github.com/SalDaniele/cluster-deployment-automation.git" dpu_operator_branch: "my_branch" Signed-off-by: Salvatore Daniele <[email protected]>
1 parent 2504039 commit 636a9dc

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

clustersConfig.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ class ExtraConfigArgs:
5757
rebuild_dpu_operators_images: bool = True
5858

5959
dpu_net_interface: Optional[str] = "ens2f0"
60+
dpu_operator_repo: str = "https://github.com/openshift/dpu-operator.git"
61+
dpu_operator_branch: str = "main"
6062

6163
def pre_check(self) -> None:
6264
if self.sriov_network_operator_local:

extraConfigDpu.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ def copy_local_registry_certs(host: host.Host, path: str) -> None:
185185
host.copy_to(f"{directory}/{file}", f"{path}/{file}")
186186

187187

188-
def build_dpu_operator_images() -> str:
188+
def build_dpu_operator_images(repo: str, branch: str) -> str:
189189
logger.info("Building dpu operator images")
190190
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)
192192
update_dockerfiles_with_ose_images(REPO_DIR)
193193

194194
# Start a local registry to store dpu-operator images
@@ -201,11 +201,11 @@ def build_dpu_operator_images() -> str:
201201
return registry
202202

203203

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:
205205
logger.info(f"Deploying dpu operator containers on {h.hostname()}")
206206
if repo_wipe:
207207
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}")
209209

210210
REGISTRY = host.LocalHost().hostname()
211211
h.run("dnf install -y pip")
@@ -240,7 +240,7 @@ def ExtraConfigDpu(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[str,
240240
client = K8sClient(MICROSHIFT_KUBECONFIG, acc)
241241

242242
if cfg.rebuild_dpu_operators_images:
243-
registry = build_dpu_operator_images()
243+
registry = build_dpu_operator_images(repo=cfg.dpu_operator_repo, branch=cfg.dpu_operator_branch)
244244
else:
245245
logger.info("Will not rebuild dpu-operator images")
246246
registry = _ensure_local_registry_running(lh, delete_all=False)
@@ -257,7 +257,7 @@ def ExtraConfigDpu(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[str,
257257
acc.run_or_die(cmd)
258258
vendor_plugin.build_and_start(acc, client, registry)
259259

260-
start_dpu_operator(acc, client, repo_wipe=True)
260+
start_dpu_operator(acc, client, repo_wipe=True, repo=cfg.dpu_operator_repo, branch=cfg.dpu_operator_branch)
261261

262262
# Disable firewall to ensure host-side can reach dpu
263263
acc.run("systemctl stop firewalld")
@@ -293,7 +293,7 @@ def ExtraConfigDpuHost(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[s
293293
client = K8sClient(cc.kubeconfig)
294294

295295
if cfg.rebuild_dpu_operators_images:
296-
registry = build_dpu_operator_images()
296+
registry = build_dpu_operator_images(repo=cfg.dpu_operator_repo, branch=cfg.dpu_operator_branch)
297297
else:
298298
logger.info("Will not rebuild dpu-operator images")
299299
registry = _ensure_local_registry_running(lh, delete_all=False)
@@ -306,7 +306,7 @@ def ExtraConfigDpuHost(cc: ClustersConfig, cfg: ExtraConfigArgs, futures: dict[s
306306
vendor_plugin = init_vendor_plugin(h)
307307
vendor_plugin.build_and_start(lh, client, registry)
308308

309-
start_dpu_operator(lh, client)
309+
start_dpu_operator(lh, client, repo_wipe=False, repo=cfg.dpu_operator_repo, branch=cfg.dpu_operator_branch)
310310

311311
def helper(h: host.Host, node: NodeConfig) -> Optional[host.Result]:
312312
# Temporary workaround, remove once 4.16 installations are working

0 commit comments

Comments
 (0)