fiaas-deploy-daemon icon indicating copy to clipboard operation
fiaas-deploy-daemon copied to clipboard

Proposal: Multiple config-map support for fiaas

Open skogie opened this issue 3 years ago • 2 comments

We are using config-maps in fiaas today but it can be tedious at times updating and keeping track of all our config-maps when making changes. For example for our database config we use a different port in dev and production, and it also requires som difference in the ssl part of the connection-string. I'm wondering if this could have been solved using only a single config-map named i.e database-config and applied this config-map to all our apps via fiaas.yml, something like this:

---
version: 3
admin_access: true
replicas:
  maximum: 1
  minimum: 1
resources:
  requests:
    memory: 128Mi
ports:
  - target_port: 5000
healthchecks:
  liveness:
    http:
      path: /healthz
metrics:
  prometheus:
    path: /internal-backstage/prometheus
config_maps:
    - team-db-config
    - team-kafka-config

The default can stay the same that a config-map with the same name as an application would be applied by default. And a default for the config-maps in fiaas.yml could be something like: config_maps: []

As far as I'm aware multiple config-maps can be applied to a pod like this:

spec:
  containers:
    - name: example-pod
      envFrom:
      - configMapRef:
          name: config-1
      - configMapRef:
          name: config-2

Let me know what you think, I would love this feature 👍

skogie avatar Aug 28 '20 09:08 skogie

Opened PR #113 as a WIP

skogie avatar Aug 28 '20 13:08 skogie

The configmap we currently make available is made available in two ways: As environment variables, and mounted on disk at /var/run/config/fiaas/. If we are adding this feature, I feel it natural that any additional configmaps are also made available in both ways.

There are a couple open questions that probably need to be discussed, and also documented properly:

  1. Configmaps may have the same keys, and when exposing as environment variables, ordering matters. Where should the "default" configmap be in the order? First or last? Which value is kept when multiple configmaps has the same key?
  2. Where should the configmaps be mounted on disk? They probably should be under /var/run/config/. Should it just use the name of the configmap (would that always work?), or does the config need to be a mapping of configmap to path?

mortenlj avatar Aug 28 '20 19:08 mortenlj