Skip to content

metrics.exporter.extraEnvs does not support Kubernetes secret references #151

@vladislavzamuruev-arch

Description

@vladislavzamuruev-arch

metrics.exporter.extraEnvs only supports plain string values due to how the template renders them:

{{- range $key, $val := .Values.metrics.exporter.extraEnvs }}
- name: {{ $key }}
  value: "{{ $val }}"
{{- end }}

This makes it impossible to reference Kubernetes secrets (e.g. secretKeyRef) for sensitive values like passwords, which is a common requirement when running Valkey with authentication enabled and wanting to scrape metrics via redis_exporter.

Fix: update the template in statefulset.yaml and deploy_valkey.yaml to check the value type:

{{- range $key, $val := .Values.metrics.exporter.extraEnvs }}

- name: {{ $key }}
  {{- if kindIs "string" $val }}
  value: "{{ $val }}"
  {{- else }}
  valueFrom:
    {{- toYaml $val | nindent 4 }}
  {{- end }}
{{- end }}

This is backwards compatible, plain string values continue to work, while map values are treated as valueFrom blocks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions