From c47c08feec0f00458307d9a57a0bf0959d164df6 Mon Sep 17 00:00:00 2001 From: Michal Kuratczyk Date: Mon, 8 Mar 2021 10:02:38 +0100 Subject: [PATCH] `kubectl rabbitmq manage` command now supports TLS Previously 15672 was always used to access Management. Now, the plugin will check if the instances is TLS enabled and if it is, it will use 15671. --- bin/kubectl-rabbitmq | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/kubectl-rabbitmq b/bin/kubectl-rabbitmq index cf5c7b67d..572a88f3c 100755 --- a/bin/kubectl-rabbitmq +++ b/bin/kubectl-rabbitmq @@ -138,11 +138,20 @@ perf_test() { manage() { get_instance_details "$@" + TLS="$(kubectl $NAMESPACE get service ${service} -o jsonpath='{.spec.ports[?(@.name=="management-tls")]}')" + if [[ -n "$TLS" ]]; then + MGMT_PORT=15671 + MGMT_URL="https://localhost:$MGMT_PORT/" + + else + MGMT_PORT=15672 + MGMT_URL="http://localhost:$MGMT_PORT/" + fi ( sleep 2 - open "http://localhost:15672/" + open "$MGMT_URL" ) & - kubectl ${NAMESPACE} port-forward "service/${service}" 15672 + kubectl ${NAMESPACE} port-forward "service/${service}" $MGMT_PORT } list_rabbitmq_clusters() {