-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
statefulset-memcached-chunks.yaml
160 lines (160 loc) · 5.81 KB
/
statefulset-memcached-chunks.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
{{- if .Values.memcachedChunks.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "loki.memcachedChunksFullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.memcachedChunksLabels" . | nindent 4 }}
{{- with .Values.loki.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.memcachedChunks.replicas }}
updateStrategy:
rollingUpdate:
partition: 0
serviceName: {{ include "loki.memcachedChunksFullname" . }}
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
selector:
matchLabels:
{{- include "loki.memcachedChunksSelectorLabels" . | nindent 6 }}
template:
metadata:
{{- if or .Values.loki.podAnnotations .Values.memcachedChunks.podAnnotations }}
annotations:
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.memcachedChunks.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
labels:
{{- include "loki.memcachedChunksSelectorLabels" . | nindent 8 }}
{{- with .Values.loki.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.memcachedChunks.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "loki.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.memcachedChunks.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "loki.memcachedChunksPriorityClassName" . | nindent 6 }}
securityContext:
{{- toYaml .Values.memcached.podSecurityContext | nindent 8 }}
terminationGracePeriodSeconds: {{ .Values.memcachedChunks.terminationGracePeriodSeconds }}
containers:
- name: memcached
{{- if .Values.memcachedChunks.persistence.enabled }}
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -ec
- |
/usr/bin/pkill -10 memcached
sleep 60s
{{- end }}
image: {{ include "loki.memcachedImage" . }}
imagePullPolicy: {{ .Values.memcached.image.pullPolicy }}
{{- if or .Values.memcachedChunks.extraArgs .Values.memcachedChunks.persistence.enabled }}
args:
{{- if .Values.memcachedChunks.persistence.enabled }}
- --memory-file=/cache-state/memory_file
{{- end }}
{{- with .Values.memcachedChunks.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: 11211
protocol: TCP
{{- with .Values.memcachedChunks.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.memcachedChunks.extraEnvFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
securityContext:
{{- toYaml .Values.memcached.containerSecurityContext | nindent 12 }}
readinessProbe:
{{- toYaml .Values.memcached.readinessProbe | nindent 12 }}
livenessProbe:
{{- toYaml .Values.memcached.livenessProbe | nindent 12 }}
{{- if or .Values.memcachedChunks.persistence.enabled .Values.memcachedChunks.extraVolumeMounts }}
volumeMounts:
{{- if .Values.memcachedChunks.persistence.enabled }}
- name: data
mountPath: /cache-state
{{- end }}
{{- if .Values.memcachedChunks.extraVolumeMounts }}
{{- toYaml .Values.memcachedChunks.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.memcachedChunks.resources | nindent 12 }}
{{- if .Values.memcachedExporter.enabled }}
- name: exporter
args:
- --memcached.address=localhost:11211
- --web.listen-address=0.0.0.0:9150
image: {{ include "loki.memcachedExporterImage" . }}
imagePullPolicy: {{ .Values.memcachedExporter.image.pullPolicy }}
ports:
- name: http-metrics
containerPort: 9150
protocol: TCP
securityContext:
{{- toYaml .Values.memcachedExporter.containerSecurityContext | nindent 12 }}
resources:
{{- toYaml .Values.memcachedExporter.resources | nindent 12 }}
{{- end }}
{{- if .Values.memcachedChunks.extraContainers }}
{{- toYaml .Values.memcachedChunks.extraContainers | nindent 8}}
{{- end }}
{{- with .Values.memcachedChunks.affinity }}
affinity:
{{- tpl . $ | nindent 8 }}
{{- end }}
{{- with .Values.memcachedChunks.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.memcachedChunks.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or .Values.memcachedChunks.persistence.enabled .Values.memcachedChunks.volumeClaimTemplates }}
volumeClaimTemplates:
{{- if .Values.memcachedChunks.persistence.enabled }}
- metadata:
name: data
spec:
accessModes:
- ReadWriteOnce
{{- with .Values.memcachedChunks.persistence.storageClass }}
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
{{- end }}
resources:
requests:
storage: {{ .Values.memcachedChunks.persistence.size | quote }}
{{- end }}
{{- with .Values.memcachedChunks.volumeClaimTemplates }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}