Skip to content

Commit

Permalink
feat(helm): Add persistence option to memcached on Helm chart (grafan…
Browse files Browse the repository at this point in the history
…a#13619)

Add an option to configure persistence on memcached, very useful with extstore option.

More info on Grafana Blog post (https://grafana.com/blog/2023/08/23/how-we-scaled-grafana-cloud-logs-memcached-cluster-to-50tb-and-improved-reliability/), based mostly on `loki-distributed` Helm chart.
  • Loading branch information
AndreZiviani authored Sep 2, 2024
1 parent 4d246ab commit 4f50e5e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 5 deletions.
5 changes: 4 additions & 1 deletion production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Entries should include a reference to the pull request that introduced the chang

[//]: # (<AUTOMATED_UPDATES_LOCATOR> : do not remove this line. This locator is used by the CI pipeline to automatically create a changelog entry for each new Loki release. Add other chart versions and respective changelog entries bellow this line.)

## 6.11.0

- [FEATURE] Add support for configuring persistence for memcached.

## 6.10.2

- [CHANGE] Bumped version of `nginxinc/nginx-unprivileged` to 1.27-alpine; this remediates several CVE
Expand All @@ -27,7 +31,6 @@ Entries should include a reference to the pull request that introduced the chang
- [CHANGE] Changed version of Grafana Loki to 3.1.1
- [ENHANCEMENT] Added ability to disable AWS S3 dualstack endpoint usage.


## 6.9.0

- [BUGFIX] Fixed how we set imagePullSecrets for the memcached and provisioner.
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: loki
description: Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both simple, scalable and distributed modes.
type: application
appVersion: 3.1.1
version: 6.10.2
version: 6.11.0
home: https://grafana.github.io/helm-charts
sources:
- https://github.com/grafana/loki
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# loki

![Version: 6.10.2](https://img.shields.io/badge/Version-6.10.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.1.1](https://img.shields.io/badge/AppVersion-3.1.1-informational?style=flat-square)
![Version: 6.11.0](https://img.shields.io/badge/Version-6.11.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.1.1](https://img.shields.io/badge/AppVersion-3.1.1-informational?style=flat-square)

Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both simple, scalable and distributed modes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ spec:
name: client
args:
- -m {{ .allocatedMemory }}
- --extended=modern,track_sizes{{ with .extraExtendedOptions }},{{ . }}{{ end }}
- --extended=modern,track_sizes{{ if .persistence.enabled }},ext_path={{ .persistence.mountPath }}/file:{{ .persistence.storageSize }}{{ end }}{{ with .extraExtendedOptions }},{{ . }}{{ end }}
- -I {{ .maxItemMemory }}m
- -c {{ .connectionLimit }}
- -v
Expand All @@ -122,10 +122,16 @@ spec:
{{- end }}
securityContext:
{{- toYaml $.ctx.Values.memcached.containerSecurityContext | nindent 12 }}
{{- if .extraVolumeMounts }}
{{- if or .persistence.enabled .extraVolumeMounts }}
volumeMounts:
{{- if .persistence.enabled }}
- name: data
mountPath: {{ .persistence.mountPath }}
{{- end }}
{{- if .extraVolumeMounts }}
{{- toYaml .extraVolumeMounts | nindent 12 }}
{{- end }}
{{- end }}

{{- if $.ctx.Values.memcachedExporter.enabled }}
- name: exporter
Expand All @@ -151,6 +157,19 @@ spec:
{{- toYaml .extraVolumeMounts | nindent 12 }}
{{- end }}
{{- end }}
{{- if .persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
{{- with .persistence.storageClass }}
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
{{- end }}
resources:
requests:
storage: {{ .persistence.storageSize | quote }}
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}
Expand Down
28 changes: 28 additions & 0 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2967,6 +2967,20 @@ resultsCache:
service:
annotations: {}
labels: {}
# -- Persistence settings for the results-cache
persistence:
# -- Enable creating PVCs for the results-cache
enabled: false
# -- Size of persistent disk
storageSize: 10G
# -- Storage class to be used.
# If defined, storageClassName: <storageClass>.
# If set to "-", storageClassName: "", which disables dynamic provisioning.
# If empty or set to null, no storageClassName spec is
# set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack).
storageClass: null
# -- Volume mount path
mountPath: /data
chunksCache:
# -- Specifies whether memcached based chunks-cache should be enabled
enabled: true
Expand Down Expand Up @@ -3055,6 +3069,20 @@ chunksCache:
service:
annotations: {}
labels: {}
# -- Persistence settings for the chunks-cache
persistence:
# -- Enable creating PVCs for the chunks-cache
enabled: false
# -- Size of persistent disk
storageSize: 10G
# -- Storage class to be used.
# If defined, storageClassName: <storageClass>.
# If set to "-", storageClassName: "", which disables dynamic provisioning.
# If empty or set to null, no storageClassName spec is
# set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack).
storageClass: null
# -- Volume mount path
mountPath: /data
######################################################################################################################
#
# Subchart configurations
Expand Down

0 comments on commit 4f50e5e

Please sign in to comment.