From bb7580944a5268a1e5f7fcd195b156f53dc668c5 Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Tue, 7 Apr 2020 11:09:34 +0300 Subject: [PATCH] [rabbitmq] Use short rabbitmq node name The patch switches rabbitmq to use short node names, this will allow to do not care about internal domain name as it is can't be get from k8s API. Change-Id: I6d80bc4db4e497f7485fb5416818e0b61f821741 Related-Prod: PRODX-3456 --- rabbitmq/Chart.yaml | 2 +- rabbitmq/templates/bin/_rabbitmq-start.sh.tpl | 2 +- .../monitoring/prometheus/exporter-deployment.yaml | 2 +- rabbitmq/templates/statefulset.yaml | 6 +++--- releasenotes/notes/rabbitmq.yaml | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/rabbitmq/Chart.yaml b/rabbitmq/Chart.yaml index 73fce9313..c87378892 100644 --- a/rabbitmq/Chart.yaml +++ b/rabbitmq/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v3.12.0 description: OpenStack-Helm RabbitMQ name: rabbitmq -version: 0.1.40 +version: 0.1.41 home: https://github.com/rabbitmq/rabbitmq-server ... diff --git a/rabbitmq/templates/bin/_rabbitmq-start.sh.tpl b/rabbitmq/templates/bin/_rabbitmq-start.sh.tpl index 4ef849fd1..0f84cf5a9 100644 --- a/rabbitmq/templates/bin/_rabbitmq-start.sh.tpl +++ b/rabbitmq/templates/bin/_rabbitmq-start.sh.tpl @@ -82,7 +82,7 @@ if ! [ "${POD_INCREMENT}" -eq "0" ] && ! [ -d "/var/lib/rabbitmq/mnesia" ] ; the # Wait for server to join cluster, reset if it does not POD_INCREMENT=$(echo "${MY_POD_NAME}" | awk -F '-' '{print $NF}') END=$(($(date +%s) + 180)) - while ! rabbitmqctl -l --node $(get_node_name 0) -q cluster_status | grep -q "$(get_node_name ${POD_INCREMENT})"; do + while ! rabbitmqctl --node $(get_node_name 0) -q cluster_status | grep -q "$(get_node_name ${POD_INCREMENT})"; do sleep 5 NOW=$(date +%s) [ $NOW -gt $END ] && reset_rabbit diff --git a/rabbitmq/templates/monitoring/prometheus/exporter-deployment.yaml b/rabbitmq/templates/monitoring/prometheus/exporter-deployment.yaml index b08fc8857..6cfc74812 100644 --- a/rabbitmq/templates/monitoring/prometheus/exporter-deployment.yaml +++ b/rabbitmq/templates/monitoring/prometheus/exporter-deployment.yaml @@ -79,7 +79,7 @@ spec: - name: RABBIT_TIMEOUT value: "{{ .Values.conf.rabbitmq_exporter.rabbit_timeout }}" - name: RABBIT_URL - value: {{ printf "%s" $protocol }}://{{ tuple "oslo_messaging" "internal" . | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" }}:{{ tuple "oslo_messaging" "internal" $protocol . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} + value: {{ printf "%s" $protocol }}://{{ tuple "oslo_messaging" "internal" . | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}:{{ tuple "oslo_messaging" "internal" $protocol . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - name: RABBIT_USER valueFrom: secretKeyRef: diff --git a/rabbitmq/templates/statefulset.yaml b/rabbitmq/templates/statefulset.yaml index 17400d370..2f2d16fc3 100644 --- a/rabbitmq/templates/statefulset.yaml +++ b/rabbitmq/templates/statefulset.yaml @@ -245,13 +245,13 @@ spec: fieldRef: fieldPath: status.podIP - name: RABBITMQ_USE_LONGNAME - value: "true" + value: "false" - name: RABBITMQ_NODENAME - value: "rabbit@$(MY_POD_NAME).{{ tuple "oslo_messaging" "internal" . | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" }}" + value: "rabbit@$(MY_POD_NAME)" - name: K8S_SERVICE_NAME value: {{ tuple "oslo_messaging" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} - name: K8S_HOSTNAME_SUFFIX - value: ".{{ tuple "oslo_messaging" "internal" . | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" }}" + value: ".{{ tuple "oslo_messaging" "internal" . | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}" - name: RABBITMQ_ERLANG_COOKIE value: "{{ $envAll.Values.endpoints.oslo_messaging.auth.erlang_cookie }}" - name: PORT_HTTP diff --git a/releasenotes/notes/rabbitmq.yaml b/releasenotes/notes/rabbitmq.yaml index 10d2523ac..da012f2da 100644 --- a/releasenotes/notes/rabbitmq.yaml +++ b/releasenotes/notes/rabbitmq.yaml @@ -40,4 +40,5 @@ rabbitmq: - 0.1.38 Do not use hardcoded username in rabbitmq chown container - 0.1.39 Allow to bootstrap rabbitmq with initial config - 0.1.40 Set password for guest user rabbitmq + - 0.1.41 Use short rabbitmq node name ...