Helm regex on secretKeyRef

8/5/2021

I am calling a value from config map. I need to make a small regex change in the value I get. I do not want to change the value from config-map because other helm chats are using it too.

Is there a way to manipulate the value of "db_url" I get from the config map ?

 spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "digital-channel.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          env:
            - name: "URL"
              valueFrom:
                configMapKeyRef:
                  name: {{ .Values.configMapName }}
                  key: db_url

I thought to store the value in a new var on which I'll make the regex on. But I am not sure if it's even possible. Are there better ways?

-- jrz
charts
kubernetes
kubernetes-helm

0 Answers