Skip to content

madengine v2 refactor(k8s) secrets handling, launcher mixin, and template updates#88

Merged
coketaste merged 2 commits intocoketaste/refactor-disfrom
coketaste/refactor-dis-k8s-fix
Mar 23, 2026
Merged

madengine v2 refactor(k8s) secrets handling, launcher mixin, and template updates#88
coketaste merged 2 commits intocoketaste/refactor-disfrom
coketaste/refactor-dis-k8s-fix

Conversation

@coketaste
Copy link
Copy Markdown
Collaborator

  • Add k8s_secrets helpers for image pull / runtime secrets with configurable strategies; add unit tests.
  • Introduce KubernetesLauncherMixin for torchrun and related launcher command generation; wire into kubernetes deployment.
  • Update K8s Job/ConfigMap templates, k8s defaults preset, and kubernetes.py.
  • Refresh configuration/deployment docs and k8s-configs README.
  • Adjust tests (conftest, dummy credential fixture) for new behavior.
  • Fix CLI merge of --additional-context with --additional-context-file when the CLI value uses Python dict syntax (fallback after JSON parse failure).

- Add k8s_secrets helpers for image pull / runtime secrets with configurable
  strategies; add unit tests.
- Introduce KubernetesLauncherMixin for torchrun and related launcher command
  generation; wire into kubernetes deployment.
- Update K8s Job/ConfigMap templates, k8s defaults preset, and kubernetes.py.
- Refresh configuration/deployment docs and k8s-configs README.
- Adjust tests (conftest, dummy credential fixture) for new behavior.
- Fix CLI merge of --additional-context with --additional-context-file when
  the CLI value uses Python dict syntax (fallback after JSON parse failure).
@coketaste coketaste self-assigned this Mar 22, 2026
@coketaste coketaste changed the title madengine v2 refactor(k8s): secrets handling, launcher mixin, and template updates madengine v2 refactor(k8s) secrets handling, launcher mixin, and template updates Mar 22, 2026
@coketaste coketaste requested review from Copilot and gargrahul March 22, 2026 01:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors madengine’s Kubernetes (v2) deployment to improve secret handling, launcher command generation, and manifest templating—aiming to keep credentials out of ConfigMaps while supporting multiple secret strategies and more launchers.

Changes:

  • Add k8s_secrets helpers + defaults to create/resolve image-pull/runtime Secrets (with ConfigMap size preflight + unit tests).
  • Introduce KubernetesLauncherMixin and wire it into KubernetesDeployment; update K8s Job/ConfigMap templates to mount credentials via Secret when applicable.
  • Improve CLI --additional-context merge behavior (JSON first, fallback to Python dict syntax) and refresh K8s-related docs.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/test_k8s_secrets.py Adds unit tests for secret strategy merging, secret ref resolution, and ConfigMap payload size estimation.
tests/conftest.py Ensures src/ is on sys.path for consistent test imports.
src/madengine/deployment/templates/kubernetes/job.yaml.j2 Adds TTL support, conditional imagePullSecrets, and mounts runtime credentials from Secret when configured; gates privileged profiling securityContext.
src/madengine/deployment/templates/kubernetes/configmap.yaml.j2 Stops embedding credential.json unless explicitly requested.
src/madengine/deployment/presets/k8s/defaults.json Adds defaults for TTL, privileged profiling toggle, and k8s.secrets configuration.
src/madengine/deployment/kubernetes_launcher_mixin.py New mixin providing launcher command string generators (torchrun/deepspeed/torchtitan/vLLM/SGLang/etc.).
src/madengine/deployment/kubernetes.py Integrates secrets strategy + ConfigMap size preflight, uses launcher mixin, updates GPU plugin validation messaging, and propagates imagePullSecrets to collector pod.
src/madengine/deployment/k8s_secrets.py New module for creating/deleting secrets from credential.json, resolving secret refs, and estimating ConfigMap payload sizes.
src/madengine/cli/commands/run.py Fixes merging of --additional-context with file-based context by attempting JSON parse first, then ast.literal_eval.
examples/k8s-configs/README.md Documents new Secrets behavior and multi-node DNS differences across launcher types.
docs/deployment.md Documents Secrets behavior, manifest validation workflow, and clarifies TTL cleanup behavior.
docs/configuration.md Updates K8s preset docs and documents new k8s.secrets/TTL/profiling fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…t helper

- Import Path at module level in kubernetes_launcher_mixin so
  _generate_vllm_command and _generate_sglang_command do not raise
  NameError; drop redundant inner import in _generate_torchrun_command.
- Rename _build_registry_secret_data to build_registry_secret_data and
  document it as the supported API for dockerconfigjson preview logic.
- Update kubernetes.py and unit tests accordingly.
@coketaste coketaste merged commit 37d72ee into coketaste/refactor-dis Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants