Add ConfigMap support for k8s. #714

Merged
telackey merged 10 commits from telackey/k8s_001 into main 2024-01-31 05:09:49 +00:00
Member

Adds support for read-only ConfigMap-based volumes to be used with k8s deployments. This provides us a simple mechanism for supplying configuration files in remote k8s deployments. A regular volume will not do in that case, because we cannot bind to a host directory and any brand-new volume will be provisioned empty.

Note; An important limitation of ConfigMap volumes is that they only support files in a single directory. They do not descend recursively through the source directory.

The current mechanism for determining if a volume, as defined in a compose file, should be considered a ConfigMap rather than a regular volume is:

  1. Is the deploy-to type k8s or k8s-kind?
  2. And is the volume marked read-only (ro) everywhere it is used?
  3. And does it have "config" in its name?

If all are the above are true, it is placed in the spec file under the configmaps heading rather than volumes:

stack: package-registry
deploy-to: k8s
kube-config: /home/telackey/.kube/config-desktop
image-registry: localhost:5000
network:
  ports:
    server:
     - 3000
    runner:
     - '8088'
volumes:
  gitea-data: ./data/gitea-data
  postgres-data: ./data/postgres-data
  act-runner-data: ./data/act-runner-data
configmaps:
  act-runner-config: ./data/act-runner-config
❯ k get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                              STORAGECLASS   REASON   AGE
laconic-c69373e24c18fd31-act-runner-data   2Gi        RWO            Retain           Bound    default/laconic-c69373e24c18fd31-act-runner-data   manual                  11m
laconic-c69373e24c18fd31-gitea-data        2Gi        RWO            Retain           Bound    default/laconic-c69373e24c18fd31-gitea-data        manual                  11m
laconic-c69373e24c18fd31-postgres-data     2Gi        RWO            Retain           Bound    default/laconic-c69373e24c18fd31-postgres-data     manual                  11m
❯ k get cm
NAME                                         DATA   AGE
kube-root-ca.crt                             1      4d1h
laconic-c69373e24c18fd31-act-runner-config   1      11m
Adds support for read-only ConfigMap-based volumes to be used with k8s deployments. This provides us a simple mechanism for supplying configuration files in remote k8s deployments. A regular volume will not do in that case, because we cannot bind to a host directory and any brand-new volume will be provisioned empty. > Note; An important limitation of ConfigMap volumes is that they only support files in a single directory. They do not descend recursively through the source directory. The current mechanism for determining if a volume, as defined in a compose file, should be considered a ConfigMap rather than a regular volume is: 1. Is the deploy-to type k8s or k8s-kind? 2. And is the volume marked read-only (`ro`) everywhere it is used? 3. And does it have "config" in its name? If all are the above are true, it is placed in the spec file under the `configmaps` heading rather than `volumes`: ``` stack: package-registry deploy-to: k8s kube-config: /home/telackey/.kube/config-desktop image-registry: localhost:5000 network: ports: server: - 3000 runner: - '8088' volumes: gitea-data: ./data/gitea-data postgres-data: ./data/postgres-data act-runner-data: ./data/act-runner-data configmaps: act-runner-config: ./data/act-runner-config ``` ``` ❯ k get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE laconic-c69373e24c18fd31-act-runner-data 2Gi RWO Retain Bound default/laconic-c69373e24c18fd31-act-runner-data manual 11m laconic-c69373e24c18fd31-gitea-data 2Gi RWO Retain Bound default/laconic-c69373e24c18fd31-gitea-data manual 11m laconic-c69373e24c18fd31-postgres-data 2Gi RWO Retain Bound default/laconic-c69373e24c18fd31-postgres-data manual 11m ``` ``` ❯ k get cm NAME DATA AGE kube-root-ca.crt 1 4d1h laconic-c69373e24c18fd31-act-runner-config 1 11m ```
dboreham approved these changes 2024-01-31 05:05:09 +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#714
No description provided.