From 07caea65e9ed147cdd9b1e0998a5c136ea592120 Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Tue, 16 Jul 2024 15:39:29 +0200 Subject: [PATCH] Fix panic if no spec is provided for rabbitmq LoadBalancer override Jira: https://issues.redhat.com/browse/OSPRH-8490 Signed-off-by: Martin Schuppert --- pkg/openstack/rabbitmq.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/openstack/rabbitmq.go b/pkg/openstack/rabbitmq.go index 9bc0c4fa8..550d26a4d 100644 --- a/pkg/openstack/rabbitmq.go +++ b/pkg/openstack/rabbitmq.go @@ -342,10 +342,13 @@ func reconcileRabbitMQ( } if rabbitmq.Spec.Override.Service != nil && + rabbitmq.Spec.Override.Service.Spec != nil && rabbitmq.Spec.Override.Service.Spec.Type == corev1.ServiceTypeLoadBalancer { if rabbitmq.Spec.Override.Service.EmbeddedLabelsAnnotations == nil { rabbitmq.Spec.Override.Service.EmbeddedLabelsAnnotations = &rabbitmqv2.EmbeddedLabelsAnnotations{} } + + // add annotation to register service name in dnsmasq rabbitmq.Spec.Override.Service.Annotations = util.MergeStringMaps(rabbitmq.Spec.Override.Service.Annotations, map[string]string{networkv1.AnnotationHostnameKey: hostname})