Uploaded image for project: 'Red Hat Advanced Cluster Management'
  1. Red Hat Advanced Cluster Management
  2. ACM-15721

RFE - Copy data from ConfigMap during template rendering

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • SiteConfig Operator
    • None
    • None

      As a user, I want to be able to consume information from a ConfigMap within my templates.

      Example:

      Similar to what the policygenerator offers, it would be great to get information from ConfigMaps when rendering the templates.

      Sometimes we may want to copy the entire configmap, other times we may want to reference specific data from the configmap.

      Some examples of how this could work:

      Let's say I have this template:

            etcd:
              managed:
                storage:
                  persistentVolume:
                    size: 8Gi
                    storageClassName: lvms-local
                  restoreSnapshotURL: null
                  type: PersistentVolume 

       

      Since there is information I could have as parameters (like PV Size or StorageClassName) but SiteConfig doesn't have these fields, I could configure them in a configmap like this:

      apiVersion: v1
      kind: ConfigMap
      metadata:
        name: myparams
        namespace: myns
      data:
        etcd: |-
          managed:
            storage:
              persistentVolume:
                size: 8Gi
                storageClassName: lvms-local
              restoreSnapshotURL: null
              type: PersistentVolume

      And consume them like this:

            etcd:
              {{ .CopyFromConfigMap.myns.myparams.etcd }}

      Or maybe I want to have my configmap like this:

      apiVersion: v1
      kind: ConfigMap
      metadata:
        name: myparams
        namespace: myns
      data:
        etcd-storageclass: lvms-local
        etcd-pv-size: 8Gi

      And consume them like this:

            etcd:
              managed:
                storage:
                  persistentVolume:
                    size: {{ .CopyFromConfigMap.myns.myparams.etcd-pv-size }}
                    storageClassName: {{ .CopyFromConfigMap.myns.myparams.etcd-storageclass }}
                  restoreSnapshotURL: null
                  type: PersistentVolume

              Unassigned Unassigned
              mavazque@redhat.com Mario Vazquez Cebrian
              Sharat Akhoury Sharat Akhoury
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: