Skip to content

Commit ee6e1cf

Browse files
authored
fix(helm): Fix persistence configuration for Memcached (#14049)
* Memcached must create a file smaller than disk size * `ext_wbuf_size` must be bigger than max item size and be divisible by `wbuf_size` which is 64 by default * Add pod permissions to access local volume
1 parent 73d69a1 commit ee6e1cf

File tree

6 files changed

+24
-9
lines changed

6 files changed

+24
-9
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,7 @@ null
20392039
<tr>
20402040
<td>chunksCache.persistence.storageSize</td>
20412041
<td>string</td>
2042-
<td>Size of persistent disk</td>
2042+
<td>Size of persistent disk, must be in G or Gi</td>
20432043
<td><pre lang="json">
20442044
"10G"
20452045
</pre>
@@ -6545,7 +6545,12 @@ false
65456545
<td>object</td>
65466546
<td>The SecurityContext override for memcached pods</td>
65476547
<td><pre lang="json">
6548-
{}
6548+
{
6549+
"fsGroup": 11211,
6550+
"runAsGroup": 11211,
6551+
"runAsNonRoot": true,
6552+
"runAsUser": 11211
6553+
}
65496554
</pre>
65506555
</td>
65516556
</tr>
@@ -9584,7 +9589,7 @@ null
95849589
<tr>
95859590
<td>resultsCache.persistence.storageSize</td>
95869591
<td>string</td>
9587-
<td>Size of persistent disk</td>
9592+
<td>Size of persistent disk, must be in G or Gi</td>
95889593
<td><pre lang="json">
95899594
"10G"
95909595
</pre>

production/helm/loki/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
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.14.1
17+
18+
- [BUGFIX] Fixed Memcached persistence options.
19+
1620
## 6.14.0
1721

1822
- [FEATURE] Add additional service annotations for components in distributed mode

production/helm/loki/Chart.yaml

Lines changed: 1 addition & 1 deletion
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.14.0
6+
version: 6.14.1
77
home: https://grafana.github.io/helm-charts
88
sources:
99
- https://github.com/grafana/loki

production/helm/loki/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# loki
22

3-
![Version: 6.14.0](https://img.shields.io/badge/Version-6.14.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)
3+
![Version: 6.14.1](https://img.shields.io/badge/Version-6.14.1-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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ spec:
102102
ports:
103103
- containerPort: {{ .port }}
104104
name: client
105+
{{- /* Calculate storage size as round(.persistence.storageSize * 0.9). But with integer built-in operators. */}}
106+
{{- $persistenceSize := (div (mul (trimSuffix "Gi" .persistence.storageSize | trimSuffix "G") 9) 10 ) }}
105107
args:
106108
- -m {{ .allocatedMemory }}
107-
- --extended=modern,track_sizes{{ if .persistence.enabled }},ext_path={{ .persistence.mountPath }}/file:{{ .persistence.storageSize }}{{ end }}{{ with .extraExtendedOptions }},{{ . }}{{ end }}
109+
- --extended=modern,track_sizes{{ if .persistence.enabled }},ext_path={{ .persistence.mountPath }}/file:{{ $persistenceSize }}G,ext_wbuf_size=16{{ end }}{{ with .extraExtendedOptions }},{{ . }}{{ end }}
108110
- -I {{ .maxItemMemory }}m
109111
- -c {{ .connectionLimit }}
110112
- -v

production/helm/loki/values.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2962,7 +2962,11 @@ memcached:
29622962
# -- Memcached Docker image pull policy
29632963
pullPolicy: IfNotPresent
29642964
# -- The SecurityContext override for memcached pods
2965-
podSecurityContext: {}
2965+
podSecurityContext:
2966+
runAsNonRoot: true
2967+
runAsUser: 11211
2968+
runAsGroup: 11211
2969+
fsGroup: 11211
29662970
# -- The name of the PriorityClass for memcached pods
29672971
priorityClassName: null
29682972
# -- The SecurityContext for memcached containers
@@ -3085,7 +3089,7 @@ resultsCache:
30853089
persistence:
30863090
# -- Enable creating PVCs for the results-cache
30873091
enabled: false
3088-
# -- Size of persistent disk
3092+
# -- Size of persistent disk, must be in G or Gi
30893093
storageSize: 10G
30903094
# -- Storage class to be used.
30913095
# If defined, storageClassName: <storageClass>.
@@ -3187,7 +3191,7 @@ chunksCache:
31873191
persistence:
31883192
# -- Enable creating PVCs for the chunks-cache
31893193
enabled: false
3190-
# -- Size of persistent disk
3194+
# -- Size of persistent disk, must be in G or Gi
31913195
storageSize: 10G
31923196
# -- Storage class to be used.
31933197
# If defined, storageClassName: <storageClass>.

0 commit comments

Comments
 (0)