[memcached] Unhardcode port in exporter

* Pick up port for exporter from endpoints
* Drop exporter port from service as we should not use
  service that do loadbalancing among pods which are independent

Change-Id: I0408039ba87aca5b8b3c9333644fa0c92f0ca01a
This commit is contained in:
Vasyl Saienko 2025-01-01 11:04:29 +00:00
parent 8c6fb7afec
commit 11915a30a7
3 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@ set -ex
COMMAND="${@:-start}"
function start () {
exec /bin/memcached_exporter
exec /bin/memcached_exporter --memcached.address "$MEMCACHED_HOST:$MEMCACHED_PORT"
}
function stop () {

View File

@ -24,10 +24,6 @@ spec:
ports:
- name: memcache
port: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{- if .Values.monitoring.prometheus.enabled }}
- name: metrics
port: {{ tuple "oslo_cache" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{- 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 }}

View File

@ -102,6 +102,11 @@ spec:
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 }}