Skip to content

Commit 6b51473

Browse files
authored
render manifests for ms (llm-d#902)
Signed-off-by: vezio <tyler.rimaldi@ibm.com>
1 parent f1ed7fc commit 6b51473

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

llmdbenchmark/standup/steps/step_09_deploy_modelservice.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ def execute( # pylint: disable=too-many-branches,too-many-locals,too-many-state
8484
helmfile_work = helm_dir / "helmfile.yaml"
8585

8686
if helmfile_work.exists():
87+
# Render modelservice manifests to workspace for inspection
88+
# before applying. This gives full visibility into what the
89+
# Helm chart produces and enables post-render patching.
90+
self._render_ms_manifests(
91+
cmd, context, helmfile_work, namespace,
92+
model_id_label, stack_name, helm_dir,
93+
)
94+
8795
result = cmd.helmfile(
8896
"--namespace",
8997
namespace,
@@ -100,6 +108,10 @@ def execute( # pylint: disable=too-many-branches,too-many-locals,too-many-state
100108
else:
101109
main_helmfile = self._find_yaml(stack_path, "10_helmfile-main")
102110
if main_helmfile:
111+
self._render_ms_manifests(
112+
cmd, context, main_helmfile, namespace,
113+
model_id_label, stack_name, helm_dir,
114+
)
103115
result = cmd.helmfile(
104116
"--namespace",
105117
namespace,
@@ -314,6 +326,46 @@ def execute( # pylint: disable=too-many-branches,too-many-locals,too-many-state
314326
stack_name=stack_name,
315327
)
316328

329+
def _render_ms_manifests(
330+
self,
331+
cmd: CommandExecutor,
332+
context: ExecutionContext,
333+
helmfile_path,
334+
namespace: str,
335+
model_id_label: str,
336+
stack_name: str,
337+
helm_dir: Path,
338+
) -> None:
339+
"""Render modelservice Helm chart manifests to workspace for inspection.
340+
341+
Runs ``helmfile template`` to produce the fully rendered K8s manifests
342+
that the chart would create, and writes them to
343+
``{helm_dir}/rendered-modelservice.yaml``. This gives users full
344+
visibility into decode/prefill Deployments, Services, ConfigMaps, etc.
345+
before they are applied to the cluster.
346+
"""
347+
if context.dry_run:
348+
return
349+
350+
rendered_path = helm_dir / "rendered-modelservice.yaml"
351+
result = cmd.helmfile(
352+
"--namespace", namespace,
353+
"--selector", f"name={model_id_label}-ms",
354+
"template", "-f", str(helmfile_path),
355+
"--skip-schema-validation",
356+
)
357+
if result.success and result.stdout.strip():
358+
rendered_path.write_text(result.stdout, encoding="utf-8")
359+
context.logger.log_info(
360+
f"📄 Rendered modelservice manifests to {rendered_path.name} "
361+
f"({len(result.stdout.splitlines())} lines)"
362+
)
363+
elif not result.success:
364+
context.logger.log_warning(
365+
f"Could not render modelservice manifests (non-fatal): "
366+
f"{result.stderr[:200]}"
367+
)
368+
317369
def _check_priority_class(
318370
self,
319371
cmd: CommandExecutor,

0 commit comments

Comments
 (0)