Deploy memcached exporter from extraContainers
This is aligned with the Helm best practices when users can inject optional snippets into templates and exporter sidecars is exactly one of such optional things. Change-Id: I273e03dfc0cd70f918bc6c407aa5f857504611e2 Signed-off-by: Vladimir Kozhukalov <kozhukalov@gmail.com>
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
set -ex
|
||||
COMMAND="${@:-start}"
|
||||
|
||||
function start () {
|
||||
exec /bin/memcached_exporter --memcached.address "$MEMCACHED_HOST:$MEMCACHED_PORT"
|
||||
}
|
||||
|
||||
function stop () {
|
||||
kill -TERM 1
|
||||
}
|
||||
|
||||
$COMMAND
|
||||
@@ -33,6 +33,4 @@ data:
|
||||
{{- end }}
|
||||
memcached.sh: |
|
||||
{{ tuple "bin/_memcached.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
memcached-exporter.sh: |
|
||||
{{ tuple "bin/_memcached-exporter.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
@@ -24,14 +24,9 @@ spec:
|
||||
ports:
|
||||
- name: memcache
|
||||
port: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
{{/*
|
||||
Keep exporter port here to be able to scrape over endpoints.
|
||||
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#endpoints
|
||||
*/}}
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
- name: metrics
|
||||
port: {{ tuple "oslo_cache" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
{{- end }}
|
||||
{{- with .Values.memcached.extraServicePorts }}
|
||||
{{- tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||
{{ .Values.network.memcached | include "helm-toolkit.snippets.service_params" | indent 2 }}
|
||||
|
||||
@@ -23,12 +23,6 @@ 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 := . }}
|
||||
|
||||
@@ -100,32 +94,9 @@ spec:
|
||||
mountPath: /tmp/memcached.sh
|
||||
subPath: memcached.sh
|
||||
readOnly: true
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
- name: memcached-exporter
|
||||
env:
|
||||
- name: MEMCACHED_HOST
|
||||
value: 127.0.0.1
|
||||
- name: MEMCACHED_PORT
|
||||
value: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
|
||||
{{ 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:
|
||||
- /tmp/memcached-exporter.sh
|
||||
- start
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ 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
|
||||
- name: memcached-bin
|
||||
mountPath: /tmp/memcached-exporter.sh
|
||||
subPath: memcached-exporter.sh
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- with .Values.memcached.extraContainers }}
|
||||
{{- tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: pod-tmp
|
||||
emptyDir: {}
|
||||
|
||||
@@ -84,8 +84,6 @@ endpoints:
|
||||
port:
|
||||
memcache:
|
||||
default: 11211
|
||||
metrics:
|
||||
default: 9150
|
||||
kube_dns:
|
||||
namespace: kube-system
|
||||
name: kubernetes-dns
|
||||
@@ -113,18 +111,11 @@ network_policy:
|
||||
egress:
|
||||
- {}
|
||||
|
||||
monitoring:
|
||||
prometheus:
|
||||
enabled: false
|
||||
memcached_exporter:
|
||||
scrape: true
|
||||
|
||||
images:
|
||||
pull_policy: IfNotPresent
|
||||
tags:
|
||||
dep_check: 'quay.io/airshipit/kubernetes-entrypoint:latest-ubuntu_jammy'
|
||||
memcached: 'quay.io/airshipit/memcached:1.6.32'
|
||||
prometheus_memcached_exporter: docker.io/prom/memcached-exporter:v0.4.1
|
||||
image_repo_sync: quay.io/airshipit/docker:27.5.0
|
||||
local_registry:
|
||||
active: false
|
||||
@@ -145,6 +136,10 @@ manifests:
|
||||
service: true
|
||||
secret_registry: true
|
||||
|
||||
memcached:
|
||||
extraContainers: []
|
||||
extraServicePorts: []
|
||||
|
||||
pod:
|
||||
security_context:
|
||||
server:
|
||||
@@ -159,12 +154,7 @@ pod:
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
memcached_exporter:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
probes:
|
||||
memcached:
|
||||
memcached:
|
||||
@@ -180,19 +170,7 @@ pod:
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 10
|
||||
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:
|
||||
@@ -232,13 +210,6 @@ pod:
|
||||
requests:
|
||||
cpu: "500m"
|
||||
memory: "128Mi"
|
||||
prometheus_memcached_exporter:
|
||||
limits:
|
||||
memory: "1024Mi"
|
||||
cpu: "2000m"
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 128Mi
|
||||
jobs:
|
||||
image_repo_sync:
|
||||
requests:
|
||||
|
||||
7
releasenotes/notes/memcached-1ae10613b2e36813.yaml
Normal file
7
releasenotes/notes/memcached-1ae10613b2e36813.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
memcached:
|
||||
- |
|
||||
Add .Values.memcached.extraContainers hook to make it possible to
|
||||
add extra containers to memcached statefulset, e.g. for monitoring
|
||||
purposes. Also move the exporter sidecar to values_overrides.
|
||||
...
|
||||
46
values_overrides/memcached/exporter.yaml
Normal file
46
values_overrides/memcached/exporter.yaml
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
memcached:
|
||||
extraServicePorts:
|
||||
- name: metrics
|
||||
port: 9150
|
||||
targetPort: 9150
|
||||
protocol: TCP
|
||||
extraContainers:
|
||||
- name: memcached-exporter
|
||||
image: docker.io/prom/memcached-exporter:v0.15.5
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- /bin/memcached_exporter
|
||||
args:
|
||||
- --memcached.address=127.0.0.1:11211
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: 9150
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: 9150
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 60
|
||||
timeoutSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: 9150
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 60
|
||||
timeoutSeconds: 10
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "500m"
|
||||
limits:
|
||||
memory: "1024Mi"
|
||||
cpu: "2000m"
|
||||
...
|
||||
@@ -143,7 +143,9 @@
|
||||
- ./tools/deployment/common/setup-client.sh
|
||||
- export VOLUME_HELM_ARGS="--set volume.enabled=false"; ./tools/deployment/component/common/rabbitmq.sh
|
||||
- ./tools/deployment/db/mariadb.sh
|
||||
- ./tools/deployment/component/common/memcached.sh
|
||||
- >-
|
||||
export OSH_EXTRA_HELM_ARGS="--values ../openstack-helm/values_overrides/memcached/exporter.yaml";
|
||||
./tools/deployment/component/common/memcached.sh
|
||||
- ./tools/deployment/component/keystone/keystone.sh
|
||||
- ./tools/deployment/component/heat/heat.sh
|
||||
- export GLANCE_BACKEND=local; ./tools/deployment/component/glance/glance.sh
|
||||
@@ -152,7 +154,7 @@
|
||||
export OSH_EXTRA_HELM_ARGS="--values ../openstack-helm/values_overrides/libvirt/inovex_exporter.yaml";
|
||||
./tools/deployment/component/compute-kit/libvirt.sh
|
||||
- ./tools/deployment/component/compute-kit/compute-kit.sh
|
||||
- export OSH_TEST_TIMEOUT=1200;./tools/deployment/common/run-helm-tests.sh neutron
|
||||
- export OSH_TEST_TIMEOUT=1200; ./tools/deployment/common/run-helm-tests.sh neutron
|
||||
- ./tools/deployment/common/run-helm-tests.sh nova
|
||||
- ./tools/deployment/common/run-helm-tests.sh glance
|
||||
- ./tools/deployment/common/run-helm-tests.sh keystone
|
||||
|
||||
Reference in New Issue
Block a user