Skip to content

[loki-helm-chart] Template Error: volumeAttributesClassName nested inside storageClass with block #20276

@tico24

Description

@tico24

There's appears to be a template bug in the ingester StatefulSet templates that causes a rendering error when storageClass is set and volumeAttributesClassName is defined in the persistence claims configuration.

Error Message

Error: template: loki/charts/loki/templates/ingester/statefulset-ingester-zone-b.yaml:237:17: executing "loki/charts/loki/templates/ingester/statefulset-ingester-zone-b.yaml" at <.volumeAttributesClassName>: can't evaluate field volumeAttributesClassName in type string

Root Cause

In the volumeClaimTemplates section, the volumeAttributesClassName field is nested inside the {{- with .storageClass }} block:

{{- with .storageClass }}
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
{{- with .volumeAttributesClassName }}
volumeAttributesClassName: {{ . }}
{{- end }}
{{- end }}

When {{- with .storageClass }} is entered, the context (.) becomes the value of storageClass (e.g., "gp3" string). When the inner {{- with .volumeAttributesClassName }} tries to access .volumeAttributesClassName, it's attempting to access this field on the string "gp3" instead of the parent claim object, causing the error.

Steps to Reproduce

  1. Configure ingester persistence with a storageClass and volumeAttributesClassName:
ingester:
  zoneAwareReplication:
    enabled: true
  persistence:
    enabled: true
    claims:
      - name: data
        accessModes:
          - ReadWriteOnce
        size: 10Gi
        storageClass: gp3
        volumeAttributesClassName: null
  1. Run helm template or deploy the chart
  2. Observe the template rendering error

Environment

  • Helm Chart Version: 6.49.0
  • Loki Version: 3.6.3
  • Kubernetes Version: 1.34

I imagine the fix is to just end the {{- with .storageClass }} prior to starting the {{- with .volumeAttributesClassName }} and to also add volumeAttributesClassName to the values.yaml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/helmtype/bugSomehing is not working as expected

    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