# ConfigMap to Substitute values

**URL:** <https://forums.percona.com/t/configmap-to-substitute-values/31390>\
**Category:** Percona Operator for MongoDB\
**Created:** [July 3, 2024, 11:52am UTC](https://forums.percona.com/t/configmap-to-substitute-values/31390 "2024-07-03T11:52:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kay\_Khan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/kay_khan/32/17023_2.png) [@Kay\_Khan](https://forums.percona.com/u/Kay_Khan)\
**Post date:** [July 3, 2024, 11:52am UTC](https://forums.percona.com/t/configmap-to-substitute-values/31390/1 "2024-07-03T11:52:00Z")

</div>

Hi friends

Is there a way for me to reference a config map in mongodb percona server helm values.yaml

My usecase is that i need to substitute ${db\_name} with a value found in a config map

```auto
finalizers:
  - delete-psmdb-pods-in-order
  - delete-psmdb-pvc
nameOverride: ${db_name}
unsafeFlags:
  replsetSize: true
upgradeOptions:
  apply: disabled
image:
  repository: percona/percona-server-mongodb
  tag: 7.0.11-6-multi
replsets:
  rs0:
    name: rs0
    size: 1
    tolerations:
      - key: "karpenter/mongodb"
        operator: "Exists"
        effect: "NoSchedule"
    nodeSelector:
      karpenter-node-pool: mongodb
    configuration: |
      net:
        ipv6: true
    expose:
      enabled: true
      exposeType: LoadBalancer
      serviceAnnotations:
        service.beta.kubernetes.io/aws-load-balancer-target-group-attributes: preserve_client_ip.enabled=false
        service.beta.kubernetes.io/aws-load-balancer-attributes: access_logs.s3.enabled=true,access_logs.s3.bucket=geeiq-test-lb-access-logs,access_logs.s3.prefix=${access_log_prefix}
        service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
        service.beta.kubernetes.io/aws-load-balancer-scheme: internal
        service.beta.kubernetes.io/aws-load-balancer-ip-address-type: dualstack
    volumeSpec:
      pvc:
        storageClassName: mongodb
        resources:
          requests:
            storage: 250Gi
    sidecars:
      - image: percona/mongodb_exporter:0.40
        name: metrics
        env:
          - name: EXPORTER_USER
            valueFrom:
              secretKeyRef:
                name: ${db_name}-secrets
                key: MONGODB_CLUSTER_MONITOR_USER
          - name: EXPORTER_PASS
            valueFrom:
              secretKeyRef:
                name: ${db_name}-secrets
                key: MONGODB_CLUSTER_MONITOR_PASSWORD
          - name: POD_IP
            valueFrom:
              fieldRef:
                fieldPath: status.podIP
          - name: MONGODB_URI
            value: "mongodb://$(EXPORTER_USER):$(EXPORTER_PASS)@[$(POD_IP)]:27017"
        args:
          [
            "--discovering-mode",
            "--compatible-mode",
            "--collect-all",
            "--mongodb.uri=$(MONGODB_URI)",
          ]
backup:
  enabled: false
sharding:
  enabled: false

```

For example:

> <https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml#L526>

Allowes me

```auto
  envValueFrom:
    DATABASE_REPLICA_HOST:
      secretKeyRef:
        name: prod-rds
        key: REPLICA_HOST

# allows me to use this below

      - name: MySQL 
        type: mysql 
        url: $DATABASE_REPLICA_HOST

```

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [July 8, 2024, 8:35am UTC](https://forums.percona.com/t/configmap-to-substitute-values/31390/2 "2024-07-08T08:35:50Z")

</div>

I think [lookup](https://helm.sh/docs/chart_template_guide/functions_and_pipelines/#using-the-lookup-function) function can help with that.

To be more detailed - our default helm chart will not allow you to do that, but you can fine tune our helm chart and rely on a lookup function.

We might think on how this can be implemented to support various use cases and be useful for a broader community, but for now you may try a fine tuning approach.
