stack-orchestrator/stack_orchestrator/deploy/k8s
Prathamesh Musale 4733631572 feat(k8s): namespace ownership check to prevent silent cross-deployment override
Two deployments whose stack_name derives the same namespace (e.g. two
deployments of the test stack, or any spec without an explicit
`namespace:` override) silently patch each other's Deployment,
ConfigMaps, Services, and PVCs when they share a cluster — last
`deployment start` wins. No error today; operator sees only "Updated
Deployment ... (rolling update)" and can't tell what happened.

Stamp the namespace with a `laconic.com/deployment-dir` annotation on
first creation. On subsequent `deployment start`:

- Annotation missing (legacy / user-created namespace): adopt by
  stamping, so the NEXT conflicting deployment fails loudly.
- Annotation matches this deployment's dir: proceed.
- Annotation points to a different deployment dir: raise
  DeployerException with both dirs and the exact `namespace:` spec
  override to fix it.

Low migration risk: the woodburn pattern (multiple stacks, each with
its own stack_name-derived namespace) continues to work — those
namespaces don't collide by construction. Only same-stack+same-cluster
deployments are affected, which never worked correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 13:30:53 +00:00
..
helm Fix pyright type errors across codebase 2026-01-22 01:10:36 -05:00
__init__.py Rename app -> stack_orchestrator (#625) 2023-11-07 00:06:55 -07:00
cluster_info.py feat(k8s): auto-ConfigMap for file-level host-path compose volumes 2026-04-20 13:13:43 +00:00
deploy_k8s.py feat(k8s): namespace ownership check to prevent silent cross-deployment override 2026-04-20 13:30:53 +00:00
helpers.py feat(k8s): auto-ConfigMap for file-level host-path compose volumes 2026-04-20 13:13:43 +00:00
k8s_command.py Apply pre-commit linting fixes 2026-01-21 20:58:31 -05:00