Skip to content

Provide a way in the helm template / values.yml to use ConfigMap as a Volume mount

Release notes

The Gitlab Auto Deploy image previously supported specifying Persistent Volumes (Claims) for Kubernetes volumes only, but Kubernetes knows much more Volume types. The default Auto Deploy Helm chart now supports extraVolumes and extraVolumeMounts options. These options are a common way to configure 'non-persistent' Volumes.

This contribution addresses the following use cases:

  • mount Secrets as files to Deployments, CronJobs, and Workers,
  • mount Configmaps as files to Deployments, CronJobs, and Workers,
  • mount existing/external created Persistent Volumes Claims to Deployments, CronJobs, and Workers,
  • mount private PKI CA certificates with hostPath mounts to achieve trust with this private PKI,
  • and all other things you can achieve with Kubernetes Volume mounts.

We are thankful to Maik Boltze for his contribution.

Proposal

This would be scenario 3 "Add a file in read-only volume, for the application to read" of the Kubernetes documentation about ConfigMaps : https://kubernetes.io/docs/concepts/configuration/configmap/

The template would be able to render the following sections (from documentation above):

[snip]
      volumeMounts:
      - name: config
        mountPath: "/config"
        readOnly: true
  volumes:
    # You set volumes at the Pod level, then mount them into containers inside that Pod
    - name: config
      configMap:
        # Provide the name of the ConfigMap you want to mount.
        name: game-demo
        # An array of keys from the ConfigMap to create as files
        items:
        - key: "game.properties"
          path: "game.properties"
        - key: "user-interface.properties"
          path: "user-interface.properties"

Unless I am mistaken there doesn't seem to be a way to do this with the current way persistence.volumes is done...

Edited by Viktor Nagy (GitLab)