stack-orchestrator/stack_orchestrator/deploy
Prathamesh Musale ac4a509d6f feat(k8s): decouple deployment-id from cluster-id
cluster-id plays two roles today: (a) which kind cluster this
deployment attaches to (used for the kube-config context name) and
(b) compose_project_name -> app_name, the prefix for every k8s
resource the deployment creates. _get_existing_kind_cluster() in
deploy create forces (a) to inherit the running cluster's name, and
because (a) and (b) are the same field, (b) inherits too — so two
deployments that share a cluster also share an app_name and collide
on every resource whose suffix isn't naturally distinct (PVs are
cluster-scoped; same-stack deployments collide there in particular).

Decouple: add a distinct `deployment-id` field. cluster-id keeps its
current behavior (inherit running cluster, else fresh). deployment-id
is always fresh per `deploy create`. K8sDeployer sources
kind_cluster_name from cluster-id and app_name from deployment-id.

Backward compatibility:
- Existing deployment.yml files have only cluster-id; no on-disk
  change until the next `deploy create`.
- DeploymentContext.init() falls back: deployment-id = cluster-id
  when the field is absent. Existing deployments keep their current
  app_name and resource names on next start — no PV renames, no
  re-binds, no data orphaning.
- `compose_project_name` parameter to K8sDeployer is retained (still
  used by the compose deployer path); only the k8s-side internals
  switch to deployment_context getters.
- The helm chart generator continues to derive chart names from
  cluster-id; untouched here, worth a follow-up for consistency.

Effect on woodburn: dumpster/rpc/trashscan each already carry a
distinct cluster-id in their deployment.yml (pre-`_get_existing_kind_cluster`
era). Under the fallback, they all adopt their existing cluster-id
as deployment-id, so resource names are identical to today.

Effect on new deployments: even when they share a running cluster
(kind-cluster-name in kube-config matches cluster-id), they get
distinct deployment-ids at deploy create, and thus distinct resource
name prefixes. The same-stack PV collision the namespace ownership
check surfaces goes away by construction.

Test: run-deploy-test.sh now reads deployment-id from the new field,
falling back to cluster-id for pre-decouple fixtures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 05:27:11 +00:00
..
compose so-l2l: in-place stop/restart via label-scoped cleanup (#743) 2026-04-16 12:10:04 +05:30
k8s feat(k8s): decouple deployment-id from cluster-id 2026-04-21 05:27:11 +00:00
webapp Merge wd-a7b: cluster-id/namespace naming, jobs, multi-cert, secrets 2026-04-01 18:22:07 +00:00
__init__.py Rename app -> stack_orchestrator (#625) 2023-11-07 00:06:55 -07:00
deploy.py so-l2l: in-place stop/restart via label-scoped cleanup (#743) 2026-04-16 12:10:04 +05:30
deploy_types.py Add Job and secrets support for k8s-kind deployments (#995) 2026-03-11 03:56:21 +00:00
deploy_util.py Fix pyright type errors across codebase 2026-01-22 01:10:36 -05:00
deployer.py so-l2l: in-place stop/restart via label-scoped cleanup (#743) 2026-04-16 12:10:04 +05:30
deployer_factory.py Add Job and secrets support for k8s-kind deployments (#995) 2026-03-11 03:56:21 +00:00
deployment.py so-l2l: in-place stop/restart via label-scoped cleanup (#743) 2026-04-16 12:10:04 +05:30
deployment_context.py feat(k8s): decouple deployment-id from cluster-id 2026-04-21 05:27:11 +00:00
deployment_create.py feat(k8s): decouple deployment-id from cluster-id 2026-04-21 05:27:11 +00:00
dns_probe.py feat(deploy): add deployment restart command 2026-02-03 17:15:19 -05:00
images.py Apply pre-commit linting fixes 2026-01-21 20:58:31 -05:00
spec.py Add ip mode to external-services for static IP endpoints (#740) 2026-04-02 17:53:23 +05:30
stack.py Apply pre-commit linting fixes 2026-01-21 20:58:31 -05:00
stack_state.py Rename app -> stack_orchestrator (#625) 2023-11-07 00:06:55 -07:00