-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Helm template rendering fails in the loki chart when storageClass is specified in ingester.persistence.claims (and likely other components using the same persistence pattern). The error occurs because volumeAttributesClassName is checked inside a with .storageClass block, which changes the Go template context (.) to the storageClass string value. Attempting to access .volumeAttributesClassName on a string type fails.
Template error:
Error: template: loki/templates/ingester/statefulset-ingester-zone-b.yaml:237:17:
executing "loki/templates/ingester/statefulset-ingester-zone-b.yaml" at <.volumeAttributesClassName>:
can't evaluate field volumeAttributesClassName in type string
The buggy template logic (line ~235-240):
{{- with .storageClass }}
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
{{- with .volumeAttributesClassName }} # BUG: context is now the storageClass string
volumeAttributesClassName: {{ . }}
{{- end }}
{{- end }}
To Reproduce
- Helm chart version: 6.48.0 (bug introduced in 6.47.0, works in 6.46.x)
- Create values file with:
deploymentMode: Distributed
ingester:
replicas: 3
persistence:
enabled: true
claims:
- name: data
storageClass: gp3 # Any non-null value triggers the bug
size: 50Gi
accessModes:
- ReadWriteOnce- Run:
helm template grafana/loki --version 6.48.0 -f values.yaml
Expected behavior
Template renders successfully with the specified storageClass applied to the PersistentVolumeClaim.
Environment:
- Infrastructure: Kubernetes (EKS)
- Deployment tool: Helm 3
Screenshots, Promtail config, or terminal output
Error: template: loki/templates/ingester/statefulset-ingester-zone-b.yaml:237:17: executing "loki/templates/ingester/statefulset-ingester-zone-b.yaml" at <.volumeAttributesClassName>: can't evaluate field volumeAttributesClassName in type string```
Suggested fix:
Move the volumeAttributesClassName block outside the storageClass with block:
{{- with .storageClass }}
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
{{- end }}
{{- with .volumeAttributesClassName }}
volumeAttributesClassName: {{ . }}
{{- end }}
Affected templates likely include all ingester zone StatefulSets and possibly compactor, pattern-ingester, and other components using the same persistence claim pattern.