Skip to content

Commit 013aa17

Browse files
feat(helm): allow external memcached setup (#17432)
Co-authored-by: J Stickler <[email protected]>
1 parent eb1e039 commit 013aa17

File tree

7 files changed

+47
-46
lines changed

7 files changed

+47
-46
lines changed

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

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,15 @@ null
18901890
<td><pre lang="json">
18911891
[]
18921892
</pre>
1893+
</td>
1894+
</tr>
1895+
<tr>
1896+
<td>chunksCache.addresses</td>
1897+
<td>string</td>
1898+
<td>Comma separated addresses list in DNS Service Discovery format</td>
1899+
<td><pre lang="json">
1900+
"dnssrvnoa+_memcached-client._tcp.{{ template \"loki.fullname\" $ }}-chunks-cache.{{ $.Release.Namespace }}.svc"
1901+
</pre>
18931902
</td>
18941903
</tr>
18951904
<tr>
@@ -6282,30 +6291,6 @@ null
62826291
<td><pre lang="json">
62836292
{}
62846293
</pre>
6285-
</td>
6286-
</tr>
6287-
<tr>
6288-
<td>loki.memcached</td>
6289-
<td>object</td>
6290-
<td>Configure memcached as an external cache for chunk and results cache. Disabled by default must enable and specify a host for each cache you would like to use.</td>
6291-
<td><pre lang="json">
6292-
{
6293-
"chunk_cache": {
6294-
"batch_size": 256,
6295-
"enabled": false,
6296-
"host": "",
6297-
"parallelism": 10,
6298-
"service": "memcached-client"
6299-
},
6300-
"results_cache": {
6301-
"default_validity": "12h",
6302-
"enabled": false,
6303-
"host": "",
6304-
"service": "memcached-client",
6305-
"timeout": "500ms"
6306-
}
6307-
}
6308-
</pre>
63096294
</td>
63106295
</tr>
63116296
<tr>
@@ -6905,6 +6890,15 @@ false
69056890
"readOnlyRootFilesystem": true
69066891
}
69076892
</pre>
6893+
</td>
6894+
</tr>
6895+
<tr>
6896+
<td>memcached.enabled</td>
6897+
<td>bool</td>
6898+
<td>Enable the built in memcached server provided by the chart</td>
6899+
<td><pre lang="json">
6900+
true
6901+
</pre>
69086902
</td>
69096903
</tr>
69106904
<tr>
@@ -10199,6 +10193,15 @@ null
1019910193
<td><pre lang="json">
1020010194
[]
1020110195
</pre>
10196+
</td>
10197+
</tr>
10198+
<tr>
10199+
<td>resultsCache.addresses</td>
10200+
<td>string</td>
10201+
<td>Comma separated addresses list in DNS Service Discovery format</td>
10202+
<td><pre lang="json">
10203+
"dnssrvnoa+_memcached-client._tcp.{{ template \"loki.fullname\" $ }}-results-cache.{{ $.Release.Namespace }}.svc"
10204+
</pre>
1020210205
</td>
1020310206
</tr>
1020410207
<tr>

production/helm/loki/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ Entries should include a reference to the pull request that introduced the chang
2929
- [BUGFIX] Ensure global.extraEnv and global.extraEnvFrom applied to all resources consistently ([#16828](https://github.com/grafana/loki/pull/16828))
3030
- [BUGFIX] Fixed statement logic to enable annotations for deployment-gateway, deployment-read, and statefulset-write
3131
- [BUGFIX] Fix `extraArgs`, `extraVolumes`, `extraVolumeMounts` global values.
32+
- [FEATURE] Add config support for external memcache cluster by setting the following config:
33+
memcached:
34+
enabled: false # <- setting false here
35+
resultsCache:
36+
addresses: 'my-resultsCache-memcached-address' # <- setting results cache address here
37+
chunksCache:
38+
addresses: 'my-chunksCache-memcached-address' # <- setting chunks cache address here
3239

3340
## 6.29.0
3441

production/helm/loki/templates/chunks-cache/poddisruptionbudget-chunks-cache.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.chunksCache.enabled }}
1+
{{- if and .Values.chunksCache.enabled (.Values.memcached.enabled) }}
22
apiVersion: {{ include "loki.pdb.apiVersion" . }}
33
kind: PodDisruptionBudget
44
metadata:

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ valuesSection and component are specified separately because helm prefers camelc
88
*/}}
99
{{- define "loki.memcached.statefulSet" -}}
1010
{{ with (index $.ctx.Values $.valuesSection) }}
11-
{{- if .enabled -}}
11+
{{- if and .enabled ($.ctx.Values.memcached.enabled) -}}
1212
apiVersion: apps/v1
1313
kind: StatefulSet
1414
metadata:
@@ -181,4 +181,3 @@ spec:
181181
{{- end -}}
182182
{{- end -}}
183183
{{- end -}}
184-

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ valuesSection and component are specified separately because helm prefers camelc
88
*/}}
99
{{- define "loki.memcached.service" -}}
1010
{{ with (index $.ctx.Values $.valuesSection) }}
11-
{{- if .enabled -}}
11+
{{- if and .enabled ($.ctx.Values.memcached.enabled) -}}
1212
apiVersion: v1
1313
kind: Service
1414
metadata:

production/helm/loki/templates/results-cache/poddisruptionbudget-results-cache.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.resultsCache.enabled }}
1+
{{- if and .Values.resultsCache.enabled (.Values.memcached.enabled) }}
22
apiVersion: {{ include "loki.pdb.apiVersion" . }}
33
kind: PodDisruptionBudget
44
metadata:

production/helm/loki/values.yaml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ loki:
212212
batch_size: {{ .batchSize }}
213213
parallelism: {{ .parallelism }}
214214
memcached_client:
215-
addresses: dnssrvnoa+_memcached-client._tcp.{{ template "loki.fullname" $ }}-chunks-cache.{{ $.Release.Namespace }}.svc
215+
addresses: {{ .addresses }}
216216
consistent_hash: true
217217
timeout: {{ .timeout }}
218218
max_idle_conns: 72
@@ -260,8 +260,8 @@ loki:
260260
writeback_buffer: {{ .writebackBuffer }}
261261
writeback_size_limit: {{ .writebackSizeLimit }}
262262
memcached_client:
263+
addresses: {{ .addresses }}
263264
consistent_hash: true
264-
addresses: dnssrvnoa+_memcached-client._tcp.{{ template "loki.fullname" $ }}-results-cache.{{ $.Release.Namespace }}.svc
265265
timeout: {{ .timeout }}
266266
update_interval: 1m
267267
{{- end }}
@@ -462,21 +462,6 @@ loki:
462462
# Optional storage account key
463463
account_key: null
464464

465-
# -- Configure memcached as an external cache for chunk and results cache. Disabled by default
466-
# must enable and specify a host for each cache you would like to use.
467-
memcached:
468-
chunk_cache:
469-
enabled: false
470-
host: ""
471-
service: "memcached-client"
472-
batch_size: 256
473-
parallelism: 10
474-
results_cache:
475-
enabled: false
476-
host: ""
477-
service: "memcached-client"
478-
timeout: "500ms"
479-
default_validity: "12h"
480465
# -- Check https://grafana.com/docs/loki/latest/configuration/#schema_config for more info on how to configure schemas
481466
schemaConfig: {}
482467
# -- a real Loki install requires a proper schemaConfig defined above this, however for testing or playing around
@@ -3205,7 +3190,10 @@ overridesExporter:
32053190
appProtocol:
32063191
grpc: ""
32073192

3193+
# You can use a self hosted memcached by setting enabled to false and providing addresses.
32083194
memcached:
3195+
# -- Enable the built in memcached server provided by the chart
3196+
enabled: true
32093197
image:
32103198
# -- Memcached Docker image repository
32113199
repository: memcached
@@ -3264,6 +3252,8 @@ memcachedExporter:
32643252
resultsCache:
32653253
# -- Specifies whether memcached based results-cache should be enabled
32663254
enabled: true
3255+
# -- Comma separated addresses list in DNS Service Discovery format
3256+
addresses: dnssrvnoa+_memcached-client._tcp.{{ template "loki.fullname" $ }}-results-cache.{{ $.Release.Namespace }}.svc
32673257
# -- Specify how long cached results should be stored in the results-cache before being expired
32683258
defaultValidity: 12h
32693259
# -- Memcached operation timeout
@@ -3362,6 +3352,8 @@ resultsCache:
33623352
chunksCache:
33633353
# -- Specifies whether memcached based chunks-cache should be enabled
33643354
enabled: true
3355+
# -- Comma separated addresses list in DNS Service Discovery format
3356+
addresses: dnssrvnoa+_memcached-client._tcp.{{ template "loki.fullname" $ }}-chunks-cache.{{ $.Release.Namespace }}.svc
33653357
# -- Batchsize for sending and receiving chunks from chunks cache
33663358
batchSize: 4
33673359
# -- Parallel threads for sending and receiving chunks from chunks cache

0 commit comments

Comments
 (0)