stack-orchestrator/docs
Prathamesh Musale cb84388d00 feat(k8s): auto-ConfigMap for file-level host-path compose volumes
File-level host-path compose volumes (e.g. `../config/foo.sh:/opt/foo.sh`)
were synthesized into a kind extraMount + hostPath PV chain with a
sanitized containerPath (`/mnt/host-path-<sanitized>`). The sanitized
name is derived from the compose volume source and is identical across
deployments of the same stack, so two deployments sharing a cluster
collided at the containerPath — kind only honors the first deployment's
bind, subsequent deployments' pods silently read the first's content.
The same code path was also broken on real k8s, which has no way to
populate `/mnt/host-path-*` on worker nodes.

File-level compose binds are conceptually k8s ConfigMaps. The snowball
stack already uses the ConfigMap-backed named-volume pattern by hand.
Make that automatic at the k8s object-generation layer, without
touching deployment-dir compose or spec files.

Behavior at deploy create (validation only, no file mutation):
- :rw on a host-path bind        -> DeployerException (use a named
                                     volume for writable data)
- Directory with subdirectories  -> DeployerException (embed in image,
                                     split into configmaps, or use
                                     initContainer)
- Directory or file > ~700 KiB   -> DeployerException (ConfigMap budget)
- File, or flat small directory  -> accepted, handled at deploy start

Behavior at deploy start:
- cluster_info.get_configmaps() additionally walks pod + job compose
  volumes and emits a V1ConfigMap per host-path bind (deduped by
  sanitized name across all pods/services). Content read from
  {deployment_dir}/config/<pod>/<file> (already populated by
  _copy_extra_config_dirs).
- volumes_for_pod_files emits V1ConfigMapVolumeSource instead of
  V1HostPathVolumeSource for host-path binds.
- volume_mounts_for_service stats the source and sets V1VolumeMount
  sub_path to the filename when source is a regular file — single-key
  ConfigMaps land as files, whole-dir ConfigMaps land as directories.
- _generate_kind_mounts no longer emits `/mnt/host-path-*` extraMounts
  for these binds (the ConfigMap path bypasses kind node FS entirely).

Deployment dir layout is unchanged. Compose files, spec.yml, and
{deployment_dir}/config/<pod>/ remain exactly as today — trivially
diffable against stack source, no synthetic volume names. ConfigMaps
are visible only in k8s (kubectl get cm -n <ns>).

The existing `/mnt/host-path-*` skip in check_mounts_compatible is
retained as a transition tolerance for deployments created before
this change.

Updates:
- deployment_create: _validate_host_path_mounts() called per pod/job
  in the create loops; 700 KiB ConfigMap budget (accounts for base64
  + metadata overhead)
- helpers: _generate_kind_mounts skips host-path entries;
  volumes_for_pod_files emits ConfigMap-backed V1Volume;
  volume_mounts_for_service takes optional deployment_dir and
  auto-sets sub_path for single-file sources
- cluster_info: new _host_path_bind_configmaps() walked from
  get_configmaps(); volume_mounts_for_service call passes
  deployment_dir from spec.file_path
- docs: document the behavior and the rejected shapes in
  deployment_patterns.md
- tests: k8s-deploy asserts the host-path ConfigMaps exist,
  compose/spec unchanged, and no `/mnt/host-path-*` extraMounts

Refs: so-b86

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 13:13:43 +00:00
..
images stack diagram: fix diagram & compress img 2023-01-20 11:04:24 -05:00
CONTRIBUTING.md Migrate canonical source from Gitea to GitHub (#738) 2026-04-02 10:58:14 +05:30
README.md Gitea x Laconicd + some doc updates (#549) 2023-09-27 17:36:12 -04:00
adding-a-new-stack.md Update links from github.com to git.vdb.to (#732) 2024-02-06 22:42:44 +00:00
cli.md Add Job and secrets support for k8s-kind deployments (#995) 2026-03-11 03:56:21 +00:00
deployment_patterns.md feat(k8s): auto-ConfigMap for file-level host-path compose volumes 2026-04-20 13:13:43 +00:00
docker-compose-deployment.md Add Docker Compose deployment guide 2026-01-17 18:17:01 -05:00
fetching-containers.md Apply pre-commit linting fixes 2026-01-20 23:16:44 -05:00
gitea-with-laconicd-fixturenet.md Apply pre-commit linting fixes 2026-01-20 23:16:44 -05:00
helm-chart-generation.md Add support for generating Helm charts when creating a deployment (#974) 2025-11-27 06:43:07 +00:00
k8s-deployment-enhancements.md Apply pre-commit linting fixes 2026-01-20 23:16:44 -05:00
laconicd-with-console.md Update fixturenet-laconicd stack for renaming changes (#891) 2024-07-25 08:50:15 +00:00
release-process.md Apply pre-commit linting fixes 2026-01-20 23:16:44 -05:00
spec.md Apply pre-commit linting fixes 2026-01-20 23:16:44 -05:00
webapp.md Apply pre-commit linting fixes 2026-01-20 23:16:44 -05:00

README.md

Stack Orchestrator

Here you will find information about the design of stack orchestrator, contributing to it, and deploying services/applications that combine two or more "stacks".

Most "stacks" contain their own README which has plenty of information on deploying, but stacks can be combined in a variety of ways which are document here, for example: