[memcached] Change deployment type to statefulset
For effective cache use all endpoints should be specified explicitly as memcache client use specific algorithm to identify on which cache server key is stored based on servers availability and key name. If memcached deployed behind the service unless same key is stored on all memcached instances clients will always got cache misses and will require to use heavy calls to database. So in the end all keys will be stored on all memcached instances. Furthermore delete operations such as revoke token or remove keystone group call logic in service to remove data from cache if Loadbalancer is used this functionality can't work as we can't remove keys from all backends behind LB with single call. Change-Id: I253cfa2740fed5e1c70ced7308a489568e0f10b9
This commit is contained in:
parent
2acad7bad8
commit
14b84a79db
@ -15,6 +15,6 @@ apiVersion: v1
|
||||
appVersion: v1.5.5
|
||||
description: OpenStack-Helm Memcached
|
||||
name: memcached
|
||||
version: 0.1.15
|
||||
version: 0.1.16
|
||||
home: https://github.com/memcached/memcached
|
||||
...
|
||||
|
@ -18,7 +18,18 @@ limitations under the License.
|
||||
{{- $_ := set . "deployment_name" .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.manifests.deployment }}
|
||||
{{- define "memcachedProbeTemplate" }}
|
||||
tcpSocket:
|
||||
port: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "exporterProbeTemplate" }}
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: {{ tuple "oslo_cache" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.manifests.statefulset }}
|
||||
{{- $envAll := . }}
|
||||
|
||||
{{- $rcControllerName := printf "%s-%s" $envAll.deployment_name "memcached" }}
|
||||
@ -27,7 +38,7 @@ limitations under the License.
|
||||
{{ tuple $envAll "memcached" $rcControllerName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ $rcControllerName | quote }}
|
||||
annotations:
|
||||
@ -35,7 +46,9 @@ metadata:
|
||||
labels:
|
||||
{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||
spec:
|
||||
podManagementPolicy: Parallel
|
||||
replicas: {{ .Values.pod.replicas.server }}
|
||||
serviceName: "{{ tuple "oslo_cache" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}"
|
||||
selector:
|
||||
matchLabels:
|
||||
{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
|
||||
@ -79,9 +92,8 @@ spec:
|
||||
- /tmp/memcached.sh
|
||||
ports:
|
||||
- containerPort: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
{{ dict "envAll" $envAll "component" "memcached" "container" "memcached" "type" "readiness" "probeTemplate" (include "memcachedProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
|
||||
{{ dict "envAll" $envAll "component" "memcached" "container" "memcached" "type" "liveness" "probeTemplate" (include "memcachedProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
|
||||
volumeMounts:
|
||||
- name: pod-tmp
|
||||
mountPath: /tmp
|
||||
@ -91,8 +103,7 @@ spec:
|
||||
readOnly: true
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
- name: memcached-exporter
|
||||
image: {{ .Values.images.tags.prometheus_memcached_exporter }}
|
||||
imagePullPolicy: {{ .Values.images.pull_policy }}
|
||||
{{ tuple $envAll "prometheus_memcached_exporter" | include "helm-toolkit.snippets.image" | indent 10 }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.prometheus_memcached_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||
{{ dict "envAll" $envAll "application" "server" "container" "memcached_exporter" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
|
||||
command:
|
||||
@ -101,9 +112,8 @@ spec:
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ tuple "oslo_cache" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: {{ tuple "oslo_cache" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
{{ dict "envAll" $envAll "component" "memcached" "container" "memcached_exporter" "type" "readiness" "probeTemplate" (include "exporterProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
|
||||
{{ dict "envAll" $envAll "component" "memcached" "container" "memcached_exporter" "type" "liveness" "probeTemplate" (include "exporterProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
|
||||
volumeMounts:
|
||||
- name: pod-tmp
|
||||
mountPath: /tmp
|
@ -139,7 +139,7 @@ labels:
|
||||
|
||||
manifests:
|
||||
configmap_bin: true
|
||||
deployment: true
|
||||
statefulset: true
|
||||
job_image_repo_sync: true
|
||||
network_policy: false
|
||||
service: true
|
||||
@ -157,6 +157,28 @@ pod:
|
||||
memcached_exporter:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
probes:
|
||||
memcached:
|
||||
memcached:
|
||||
readiness:
|
||||
enabled: True
|
||||
params:
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
memcached_exporter:
|
||||
liveness:
|
||||
enabled: True
|
||||
params:
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 60
|
||||
timeoutSeconds: 10
|
||||
readiness:
|
||||
enabled: True
|
||||
params:
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 60
|
||||
timeoutSeconds: 10
|
||||
affinity:
|
||||
anti:
|
||||
topologyKey:
|
||||
|
@ -16,4 +16,5 @@ memcached:
|
||||
- 0.1.13 Replace node-role.kubernetes.io/master with control-plane
|
||||
- 0.1.14 Use quay.io/airshipit/kubernetes-entrypoint:latest-ubuntu_focal by default
|
||||
- 0.1.15 Allow to pass additional service parameters
|
||||
- 0.1.16 Change deployment type to statefulset
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user