Repository navigation
feat(helm): add Helm chart for mlxcel-server - #3549
Conversation
Implementation Review SummaryIntent
Findings Addressed
Remaining Items
Verification
Checked against the source: |
Security and Performance ReviewFixed
Remaining (not auto-fixed)
Checked, no issue
Validation: |
Add charts/mlxcel for running mlxcel-server from the ghcr.io/lablup/mlxcel CUDA image on a GPU node: a single-replica Recreate Deployment, Service, optional Ingress, PDB and ServiceMonitor, and PVCs for the model store and the kernel cache. Model mode is hf (a download initContainer, then the server starts with --offline), pvc (snapshot already under /models), or router (--models-dir, --models-max); invalid combinations fail rendering. Every container runs as 65532 with fsGroup 65532 and no root step, and the default render is admitted under the restricted Pod Security Standard. The cache stays at /cache/mlxcel under the trusted root /cache, fsGroupChangePolicy defaults to OnRootMismatch because Always made cache entries 660 on remount of a local PV on kind, and HF_HOME/HF_HUB_CACHE point into /models so a writable cache volume cannot substitute the model. Probes use /health with a 30 minute startup budget; terminationGracePeriodSeconds follows the drain timeout plus 15 s. The helm-chart CI job runs helm lint, ct lint, kubeconform with chart invariant checks (scripts/ci/check_helm_chart.py) and a kind install under restricted Pod Security (scripts/ci/check_helm_chart_kind.sh). Validated locally on kind v0.33.0; no GPU pod was run. Closes #3486
The helm-chart job failed at its install step on the first CI run: helm/chart-testing-action exports VIRTUAL_ENV and prepends its uv-built venv to PATH, and that venv has no pip, so `python3 -m pip install pyyaml` exited with "No module named pip". Install PyYAML with `uv pip`, which targets the active venv, so check_helm_chart.py runs under the same python3. Refs #3486
In router mode mlxcel-server serves POST /models (download any HuggingFace repo into the model store) and DELETE /models (remove a stored snapshot), and the router API-key middleware lets every request through when no key is configured. The chart hands model.hfToken to the server container in this mode, so a router install with a token and no apiKey let any client that reaches the Service, or the Ingress, spend the token on gated or private repositories and fill or empty the models volume. mlxcel.validate now fails the render for router.enabled with model.hfToken.existingSecret and no apiKey.existingSecret. The chart README states the requirement, and check_helm_chart.py gains a failure case for it. Validated with helm lint --strict over the default and every ci values file, and check_helm_chart.py (kubeconform plus all render and rejection cases). Refs #3486
The security review pointed out that the cache warning named the wrong adversary: with MLXCEL_CACHE_TRUSTED_ROOT set, another uid that can write the cache volume can only turn the cache off, while a workload running as the same uid (65532 is also the distroless default) passes the owner checks and could plant kernels. values.yaml and the README now say to mount the cache volume into no other workload. The template now also rejects podSecurityContext.runAsGroup or fsGroup 0 when the schema is skipped, the README notes that hf mode contacts the HuggingFace API on every start, and the helm-chart job moves above the workflow lint comment block it had split from its job.
Add one bullet to the CUDA container image section of docs/installation.md linking charts/mlxcel/README.md, so a reader who has the image and wants to run it on Kubernetes finds the chart. Full publishing docs stay with their own sub-issue. Validation: helm lint --strict, scripts/ci/check_helm_chart.py, ruff, shellcheck and actionlint all pass on the PR files. Refs #3486
8e24f68 to
42becb7
Compare
Resolves the ci.yml conflict with #3549 by keeping both sides: the docker and docker_tags filters and jobs from this branch and the helm_chart filter and helm-chart job from main.
Bilingual reports for the eight PRs of epic #3488: #3508 (graceful drain), #3509 (CUDA PTX cache trust), #3530 (ROCm hsaco cache trust), #3540 (NVRTC redistributable headers), #3543 (CUDA container image), #3549 (Helm chart), #3550 (GHCR image publishing) and #3554 (chart OCI publishing and docs). Each report names what the PR record leaves unvalidated: a real GHCR push, a GPU pod on a cluster, the amd64 and debug images. The HuggingFace cache follow-up is #3570.
Summary
Adds
charts/mlxcel, a Helm chart formlxcel-serveron a GPU node, plus ahelm-chartCI job. One replica,Recreate, Service, optional Ingress, PDB and ServiceMonitor, PVCs for/modelsand (optionally)/cache. Three model modes:hf(adownloadinitContainer, the default),pvc(snapshot already under/models) and router (--models-dir,--models-max); other combinations fail rendering with a message naming the value.Decisions beyond the issue text
model.source: hf, so a default install works on an empty volume. The server always runs with--offlinein model mode: only the initContainer fetches,HF_TOKENnever reaches the server, and--revisiongoes to the download only (a revision-qualified-mskips the/modelsstore in the resolver).HF_HOME/HF_HUB_CACHEpoint into/models/.huggingface, closing the feat(docker): add CUDA container image for mlxcel and mlxcel-server #3543 finding thatHOME=/cachemakes the resolver read/cache/.cache/huggingface/hubbefore/modelswithout an owner check.MLXCEL_CACHE_DIR=/cache/mlxcelunder the trusted root/cache,fsGroup: 65532,fsGroupChangePolicy: OnRootMismatch. No root container and no values switch for one; the container security context is fixed.resources(GPU limit) because the binary links the NVIDIA driver library; kubelet reuses init-container devices for the server.enableServiceLinks: false(a release namedmlxcelwould injectMLXCEL_*variables),automountServiceAccountToken: false, andextraEnvmay not repeat a chart-set name (server-side apply rejects duplicates).model.hfTokenrequiresapiKey.existingSecret(the router'sPOST /modelsandDELETE /modelsare open without a key);podSecurityContextrejects uid, gid orfsGroup0 even with schema validation skipped.charts/**: a one-line pointer indocs/installation.md,scripts/ci/check_helm_chart.py(template matrix, kubeconform, invariants, rejection cases),scripts/ci/check_helm_chart_kind.sh(restricted Pod Security admission with a negative control), and the recorddocs/benchmark_results/helm-chart-kind-2026-11-29.md.kind findings (kind v0.33.0, Kubernetes v1.37.0)
2777 0:65532; kindlocal-pathPVC root777 0:0(a hostPath PV, kubelet applies nofsGroup); hand-madelocalPV root2775 0:65532.localPV,Alwaysrelabeled the server-style entries on remount to2770dirs and660files;OnRootMismatchkept2700/600. The cache rules refuse group-writable directories and entries below the trusted root, soAlwayswould disable the cache from the second pod on (from the source, not observed with the server).Changes during review
helm-chartjob installs PyYAML withuv pip: the chart-testing action puts a pip-less venv first on PATH, which failed the first CI run.values.yamland the README now warns against same-uid workloads on the cache volume (they pass the owner checks), not other uids (which can only turn the cache off).Test plan
helm lint --strict(default and everyci/*-values.yaml) andct lint(chart-testing v3.15.0) passscripts/ci/check_helm_chart.pypasses under Helm 4.3.2 and Helm 3.16.4, kubeconform v0.8.0 strict with the ServiceMonitor CRD schemascripts/ci/check_helm_chart_kind.shon kind: default (hf), hf, pvc and router releases admitted underenforce=restricted, control pod rejectedhelm chartCI job passes (lint, ct lint, kubeconform, kind install under restricted Pod Security)Closes #3486