Skip to content
2 changes: 1 addition & 1 deletion charts/loki/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Helm chart for Grafana Loki supporting monolithic, simple scalable,
type: application
# renovate: docker=docker.io/grafana/loki
appVersion: 3.7.1
version: 11.4.9
version: 11.4.10
kubeVersion: ">=1.25.0-0"
home: https://grafana-community.github.io/helm-charts
sources:
Expand Down
4 changes: 4 additions & 0 deletions charts/loki/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ spec:
{{- end }}
- name: sc-rules-temp
emptyDir: {}
{{- end }}
{{- if has $target (list "ruler" "backend" "single-binary") }}
{{- range $dir, $_ := .Values.ruler.directories }}
- name: {{ include "loki.rulerRulesDirName" $dir }}
configMap:
Expand Down Expand Up @@ -270,6 +272,8 @@ spec:
{{- if and $component.sidecar .Values.sidecar.rules.enabled }}
- name: sc-rules-volume
mountPath: {{ .Values.sidecar.rules.folder | quote }}
{{- end }}
{{- if has $target (list "ruler" "backend" "single-binary") }}
{{- range $dir, $_ := .Values.ruler.directories }}
- name: {{ include "loki.rulerRulesDirName" $dir }}
mountPath: /etc/loki/rules/{{ $dir }}
Expand Down
37 changes: 37 additions & 0 deletions charts/loki/tests/ruler/sidecar_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,43 @@ tests:
name: rules-tenant-foo
mountPath: /etc/loki/rules/Tenant_Foo-

- it: should render configmap-backed rule volumes and mounts for ruler directories without the rules sidecar
set:
sidecar.rules.enabled: false
loki.rulerConfig.storage.type: local
ruler:
directories:
fake:
alerts.yaml: |
groups:
asserts:
- template: ruler/statefulset.yaml
hasDocuments:
count: 1
- template: ruler/statefulset.yaml
contains:
path: spec.template.spec.volumes
content:
name: rules-fake
configMap:
name: RELEASE-NAME-loki-ruler-rules-fake
- template: ruler/statefulset.yaml
contains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: rules-fake
mountPath: /etc/loki/rules/fake
- template: ruler/statefulset.yaml
notContains:
path: spec.template.spec.containers
content:
name: loki-sc-rules
- template: ruler/statefulset.yaml
notContains:
path: spec.template.spec.volumes
content:
name: sc-rules-volume

- it: should not add the sidecar container or shared volume when disabled via sidecar.rules.enabled
set:
sidecar.rules.enabled: false
Expand Down
Loading