Skip to content

Commit ef1df0e

Browse files
authored
feat(helm): Add persistence option to memcached on Helm chart (#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.
1 parent 281407f commit ef1df0e

File tree

6 files changed

+155
-5
lines changed

6 files changed

+155
-5
lines changed

docs/sources/setup/install/helm/reference.md

+100
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,56 @@ true
16231623
<td><pre lang="json">
16241624
5
16251625
</pre>
1626+
</td>
1627+
</tr>
1628+
<tr>
1629+
<td>chunksCache.persistence</td>
1630+
<td>object</td>
1631+
<td>Persistence settings for the chunks-cache</td>
1632+
<td><pre lang="json">
1633+
{
1634+
"enabled": false,
1635+
"mountPath": "/data",
1636+
"storageClass": null,
1637+
"storageSize": "10G"
1638+
}
1639+
</pre>
1640+
</td>
1641+
</tr>
1642+
<tr>
1643+
<td>chunksCache.persistence.enabled</td>
1644+
<td>bool</td>
1645+
<td>Enable creating PVCs for the chunks-cache</td>
1646+
<td><pre lang="json">
1647+
false
1648+
</pre>
1649+
</td>
1650+
</tr>
1651+
<tr>
1652+
<td>chunksCache.persistence.mountPath</td>
1653+
<td>string</td>
1654+
<td>Volume mount path</td>
1655+
<td><pre lang="json">
1656+
"/data"
1657+
</pre>
1658+
</td>
1659+
</tr>
1660+
<tr>
1661+
<td>chunksCache.persistence.storageClass</td>
1662+
<td>string</td>
1663+
<td>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).</td>
1664+
<td><pre lang="json">
1665+
null
1666+
</pre>
1667+
</td>
1668+
</tr>
1669+
<tr>
1670+
<td>chunksCache.persistence.storageSize</td>
1671+
<td>string</td>
1672+
<td>Size of persistent disk</td>
1673+
<td><pre lang="json">
1674+
"10G"
1675+
</pre>
16261676
</td>
16271677
</tr>
16281678
<tr>
@@ -9035,6 +9085,56 @@ true
90359085
<td><pre lang="json">
90369086
{}
90379087
</pre>
9088+
</td>
9089+
</tr>
9090+
<tr>
9091+
<td>resultsCache.persistence</td>
9092+
<td>object</td>
9093+
<td>Persistence settings for the results-cache</td>
9094+
<td><pre lang="json">
9095+
{
9096+
"enabled": false,
9097+
"mountPath": "/data",
9098+
"storageClass": null,
9099+
"storageSize": "10G"
9100+
}
9101+
</pre>
9102+
</td>
9103+
</tr>
9104+
<tr>
9105+
<td>resultsCache.persistence.enabled</td>
9106+
<td>bool</td>
9107+
<td>Enable creating PVCs for the results-cache</td>
9108+
<td><pre lang="json">
9109+
false
9110+
</pre>
9111+
</td>
9112+
</tr>
9113+
<tr>
9114+
<td>resultsCache.persistence.mountPath</td>
9115+
<td>string</td>
9116+
<td>Volume mount path</td>
9117+
<td><pre lang="json">
9118+
"/data"
9119+
</pre>
9120+
</td>
9121+
</tr>
9122+
<tr>
9123+
<td>resultsCache.persistence.storageClass</td>
9124+
<td>string</td>
9125+
<td>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).</td>
9126+
<td><pre lang="json">
9127+
null
9128+
</pre>
9129+
</td>
9130+
</tr>
9131+
<tr>
9132+
<td>resultsCache.persistence.storageSize</td>
9133+
<td>string</td>
9134+
<td>Size of persistent disk</td>
9135+
<td><pre lang="json">
9136+
"10G"
9137+
</pre>
90389138
</td>
90399139
</tr>
90409140
<tr>

production/helm/loki/CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Entries should include a reference to the pull request that introduced the chang
1313

1414
[//]: # (<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.)
1515

16+
## 6.11.0
17+
18+
- [FEATURE] Add support for configuring persistence for memcached.
19+
1620
## 6.10.2
1721

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

30-
3134
## 6.9.0
3235

3336
- [BUGFIX] Fixed how we set imagePullSecrets for the memcached and provisioner.

production/helm/loki/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: loki
33
description: Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both simple, scalable and distributed modes.
44
type: application
55
appVersion: 3.1.1
6-
version: 6.10.2
6+
version: 6.11.0
77
home: https://grafana.github.io/helm-charts
88
sources:
99
- https://github.com/grafana/loki

production/helm/loki/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# loki
22

3-
![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)
3+
![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)
44

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

production/helm/loki/templates/memcached/_memcached-statefulset.tpl

+21-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ spec:
104104
name: client
105105
args:
106106
- -m {{ .allocatedMemory }}
107-
- --extended=modern,track_sizes{{ with .extraExtendedOptions }},{{ . }}{{ end }}
107+
- --extended=modern,track_sizes{{ if .persistence.enabled }},ext_path={{ .persistence.mountPath }}/file:{{ .persistence.storageSize }}{{ end }}{{ with .extraExtendedOptions }},{{ . }}{{ end }}
108108
- -I {{ .maxItemMemory }}m
109109
- -c {{ .connectionLimit }}
110110
- -v
@@ -122,10 +122,16 @@ spec:
122122
{{- end }}
123123
securityContext:
124124
{{- toYaml $.ctx.Values.memcached.containerSecurityContext | nindent 12 }}
125-
{{- if .extraVolumeMounts }}
125+
{{- if or .persistence.enabled .extraVolumeMounts }}
126126
volumeMounts:
127+
{{- if .persistence.enabled }}
128+
- name: data
129+
mountPath: {{ .persistence.mountPath }}
130+
{{- end }}
131+
{{- if .extraVolumeMounts }}
127132
{{- toYaml .extraVolumeMounts | nindent 12 }}
128133
{{- end }}
134+
{{- end }}
129135

130136
{{- if $.ctx.Values.memcachedExporter.enabled }}
131137
- name: exporter
@@ -151,6 +157,19 @@ spec:
151157
{{- toYaml .extraVolumeMounts | nindent 12 }}
152158
{{- end }}
153159
{{- end }}
160+
{{- if .persistence.enabled }}
161+
volumeClaimTemplates:
162+
- metadata:
163+
name: data
164+
spec:
165+
accessModes: [ "ReadWriteOnce" ]
166+
{{- with .persistence.storageClass }}
167+
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
168+
{{- end }}
169+
resources:
170+
requests:
171+
storage: {{ .persistence.storageSize | quote }}
172+
{{- end }}
154173
{{- end -}}
155174
{{- end -}}
156175
{{- end -}}

production/helm/loki/values.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -2967,6 +2967,20 @@ resultsCache:
29672967
service:
29682968
annotations: {}
29692969
labels: {}
2970+
# -- Persistence settings for the results-cache
2971+
persistence:
2972+
# -- Enable creating PVCs for the results-cache
2973+
enabled: false
2974+
# -- Size of persistent disk
2975+
storageSize: 10G
2976+
# -- Storage class to be used.
2977+
# If defined, storageClassName: <storageClass>.
2978+
# If set to "-", storageClassName: "", which disables dynamic provisioning.
2979+
# If empty or set to null, no storageClassName spec is
2980+
# set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack).
2981+
storageClass: null
2982+
# -- Volume mount path
2983+
mountPath: /data
29702984
chunksCache:
29712985
# -- Specifies whether memcached based chunks-cache should be enabled
29722986
enabled: true
@@ -3055,6 +3069,20 @@ chunksCache:
30553069
service:
30563070
annotations: {}
30573071
labels: {}
3072+
# -- Persistence settings for the chunks-cache
3073+
persistence:
3074+
# -- Enable creating PVCs for the chunks-cache
3075+
enabled: false
3076+
# -- Size of persistent disk
3077+
storageSize: 10G
3078+
# -- Storage class to be used.
3079+
# If defined, storageClassName: <storageClass>.
3080+
# If set to "-", storageClassName: "", which disables dynamic provisioning.
3081+
# If empty or set to null, no storageClassName spec is
3082+
# set, choosing the default provisioner (gp2 on AWS, standard on GKE, AWS, and OpenStack).
3083+
storageClass: null
3084+
# -- Volume mount path
3085+
mountPath: /data
30583086
######################################################################################################################
30593087
#
30603088
# Subchart configurations

0 commit comments

Comments
 (0)