Add init containers, shared namespaces, per-volume sizing, and user/label support #997

Merged
prathamesh merged 7 commits from feature/init-containers into main 2026-03-12 10:34:46 +00:00
Member
No description provided.
prathamesh added 6 commits 2026-03-12 09:07:22 +00:00
Add support for k8s init containers defined in docker-compose files
using the `laconic.init-container` label. Services with this label
set to "true" are built as init containers instead of regular
containers in the pod spec.

This enables stacks to fetch runtime-created ConfigMaps (e.g. from
deployer jobs) before the main containers start, without requiring
manual operator steps between deployments.

Example compose usage:

  services:
    fetch-config:
      image: bitnami/kubectl:latest
      labels:
        laconic.init-container: "true"
      command: ["sh", "-c", "kubectl get configmap ..."]
      volumes:
        - shared-config:/config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add optional 'namespace' and 'kind-cluster-name' fields to spec
files. When 'namespace' is set, SO uses it instead of deriving one
from the cluster-id. When 'kind-cluster-name' is set, SO uses it
for the kube context instead of the cluster-id. Together these allow
multiple stacks with different cluster-ids (unique resource names)
to share a namespace and kind cluster.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the spec explicitly sets a namespace (shared with other stacks),
down() now deletes only this stack's resources by app label instead of
deleting the entire namespace. Prevents stopping one stack from wiping
all other stacks in the same namespace.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Deployments were the only resource type missing the `app` label on
their metadata. Services, ConfigMaps, PVCs, and Jobs all had it.
Without it, _delete_resources_by_label() in down() couldn't find
Deployments when cleaning up in a shared namespace.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Read the user: field from compose service definitions and map it to
securityContext.runAsUser on the k8s container spec. Needed for init
containers using images that run as non-root by default (e.g.
bitnami/kubectl runs as UID 1001).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Support per-volume resource sizing in spec files
Some checks failed
Lint Checks / Run linter (pull_request) Failing after 1h23m55s
Deploy Test / Run deploy test suite (pull_request) Has been cancelled
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Has been cancelled
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Has been cancelled
Webapp Test / Run webapp test suite (pull_request) Has been cancelled
Smoke Test / Run basic test suite (pull_request) Has been cancelled
a9bd110001
Add get_volume_resources_for(volume_name) to look up per-volume storage
sizes from the spec. Supports both the original global format and a new
per-volume format:

  # Global (unchanged, backwards compatible)
  resources:
    volumes:
      reservations:
        storage: 5Gi

  # Per-volume (new)
  resources:
    volumes:
      my-data:
        reservations:
          storage: 10Gi
      my-cache:
        reservations:
          storage: 1Gi

Fallback chain: per-volume -> global -> default (2Gi).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
prathamesh added 1 commit 2026-03-12 10:33:12 +00:00
Fix lint and deploy test failures
Some checks failed
Smoke Test / Run basic test suite (pull_request) Has been cancelled
Webapp Test / Run webapp test suite (pull_request) Has been cancelled
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Has been cancelled
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Has been cancelled
Deploy Test / Run deploy test suite (pull_request) Has been cancelled
Lint Checks / Run linter (pull_request) Has been cancelled
6c00176048
- Rename ambiguous variable 'l' to 'item' in cluster_info.py (flake8 E741)
- Use underscore in test config variable name (Docker Compose rejects
  hyphens in env var names)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
prathamesh merged commit e7483bc7d1 into main 2026-03-12 10:34:46 +00:00
prathamesh deleted branch feature/init-containers 2026-03-12 10:34:46 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/stack-orchestrator#997
No description provided.