From 39e18510490b36bd43004ca1fc9b591be404fe8c Mon Sep 17 00:00:00 2001 From: Gabriele Santomaggio Date: Tue, 5 Jan 2021 15:12:41 +0100 Subject: [PATCH] Prometheus fix standard port in TLS deploy (#541) fix standard port for Prometheus --- internal/resource/configmap.go | 9 +++++++++ internal/resource/configmap_test.go | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/internal/resource/configmap.go b/internal/resource/configmap.go index 0031d3aae..fac36f138 100644 --- a/internal/resource/configmap.go +++ b/internal/resource/configmap.go @@ -104,6 +104,10 @@ func (builder *ServerConfigMapBuilder) Update(object runtime.Object) error { if _, err := defaultSection.NewKey("management.tcp.port", "15672"); err != nil { return err } + + if _, err := defaultSection.NewKey("prometheus.tcp.port", "15692"); err != nil { + return err + } } if builder.Instance.AdditionalPluginEnabled("rabbitmq_mqtt") { if _, err := defaultSection.NewKey("mqtt.listeners.ssl.default", "8883"); err != nil { @@ -138,6 +142,11 @@ func (builder *ServerConfigMapBuilder) Update(object runtime.Object) error { if _, err := defaultSection.NewKey("management.ssl.cacertfile", caCertPath); err != nil { return err } + + if _, err := defaultSection.NewKey("prometheus.ssl.cacertfile", caCertPath); err != nil { + return err + } + if builder.Instance.AdditionalPluginEnabled("rabbitmq_web_mqtt") { if _, err := defaultSection.NewKey("web_mqtt.ssl.port", "15676"); err != nil { return err diff --git a/internal/resource/configmap_test.go b/internal/resource/configmap_test.go index 72a082f2b..0abd43922 100644 --- a/internal/resource/configmap_test.go +++ b/internal/resource/configmap_test.go @@ -257,6 +257,7 @@ prometheus.ssl.keyfile = /etc/rabbitmq-tls/tls.key prometheus.ssl.port = 15691 management.tcp.port = 15672 +prometheus.tcp.port = 15692 `) @@ -286,6 +287,7 @@ prometheus.ssl.keyfile = /etc/rabbitmq-tls/tls.key prometheus.ssl.port = 15691 management.tcp.port = 15672 +prometheus.tcp.port = 15692 mqtt.listeners.ssl.default = 8883 @@ -319,9 +321,13 @@ prometheus.ssl.port = 15691 management.tcp.port = 15672 +prometheus.tcp.port = 15692 + ssl_options.cacertfile = /etc/rabbitmq-tls/ca.crt ssl_options.verify = verify_peer management.ssl.cacertfile = /etc/rabbitmq-tls/ca.crt +prometheus.ssl.cacertfile = /etc/rabbitmq-tls/ca.crt + `) Expect(configMapBuilder.Update(configMap)).To(Succeed()) @@ -351,10 +357,13 @@ management.ssl.cacertfile = /etc/rabbitmq-tls/ca.crt prometheus.ssl.port = 15691 management.tcp.port = 15672 + prometheus.tcp.port = 15692 ssl_options.cacertfile = /etc/rabbitmq-tls/ca.crt ssl_options.verify = verify_peer management.ssl.cacertfile = /etc/rabbitmq-tls/ca.crt + + prometheus.ssl.cacertfile = /etc/rabbitmq-tls/ca.crt web_mqtt.ssl.port = 15676 web_mqtt.ssl.cacertfile = /etc/rabbitmq-tls/ca.crt @@ -491,6 +500,7 @@ listeners.tcp = none ssl_options.cacertfile = /etc/rabbitmq-tls/ca.crt ssl_options.verify = verify_peer management.ssl.cacertfile = /etc/rabbitmq-tls/ca.crt +prometheus.ssl.cacertfile = /etc/rabbitmq-tls/ca.crt web_mqtt.ssl.port = 15676 web_mqtt.ssl.cacertfile = /etc/rabbitmq-tls/ca.crt