Copy config under a volume for Docker (similar to a ConfigMap for K8S). #914

Merged
telackey merged 1 commits from telackey/configdata into main 2024-08-10 02:32:22 +00:00
Member

This emulates the K8S ConfigMap behavior on Docker by using a regular volume.

If a directory exists under config/ which matches a named volume, the contents will be copied to the volume on create (provided the destination volume is empty). That is, rather than a ConfigMap, it is essentially a "config volume".

For example, with a compose file like:

version: '3.7'
services:
  caddy:
    image: cerc/caddy-ethcache:local
    restart: always
    volumes:
      - caddyconfig:/etc/caddy:ro
volumes:
  caddyconfig:

And a directory:

❯ ls stack-orchestrator/config/caddyconfig/
Caddyfile

After laconic-so deploy create --spec-file caddy.yml --deployment-dir /srv/caddy there will be:

❯ ls /srv/caddy/data/caddyconfig
Caddyfile

Mounted at /etc/caddy

This emulates the K8S ConfigMap behavior on Docker by using a regular volume. If a directory exists under `config/` which matches a named volume, the contents will be copied to the volume on `create` (provided the destination volume is empty). That is, rather than a ConfigMap, it is essentially a "config volume". For example, with a compose file like: ``` version: '3.7' services: caddy: image: cerc/caddy-ethcache:local restart: always volumes: - caddyconfig:/etc/caddy:ro volumes: caddyconfig: ``` And a directory: ``` ❯ ls stack-orchestrator/config/caddyconfig/ Caddyfile ``` After `laconic-so deploy create --spec-file caddy.yml --deployment-dir /srv/caddy` there will be: ``` ❯ ls /srv/caddy/data/caddyconfig Caddyfile ``` Mounted at `/etc/caddy`
telackey added 1 commit 2024-08-09 03:35:44 +00:00
Copy config under a volume for Docker too (similar to a configmap).
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 39s
Smoke Test / Run basic test suite (pull_request) Successful in 4m6s
Webapp Test / Run webapp test suite (pull_request) Successful in 4m39s
Deploy Test / Run deploy test suite (pull_request) Successful in 4m56s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 7m39s
09479e605c
telackey requested review from dboreham 2024-08-09 03:38:13 +00:00
telackey changed title from Copy config under a volume for Docker too (similar to a configmap). to Copy config under a volume for Docker (similar to a ConfigMap for K8S). 2024-08-09 03:38:46 +00:00
dboreham approved these changes 2024-08-10 01:37:32 +00:00
telackey merged commit 6087e1cd31 into main 2024-08-10 02:32:22 +00:00
telackey deleted branch telackey/configdata 2024-08-10 02:32:23 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 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#914
No description provided.