From 5a34107e400c768da56ca98e0a06b29de2b66316 Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Tue, 15 Oct 2024 11:13:15 +0200 Subject: [PATCH] Use storagemgmt network by default if defined Swift uses the storage network currently, but the correct network should be the storagemgmt one. This fix prefers the storagemgmt and falls back to storage to prevent failures in already deployed environments. --- controllers/swiftstorage_controller.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/controllers/swiftstorage_controller.go b/controllers/swiftstorage_controller.go index 35128f3..199be00 100644 --- a/controllers/swiftstorage_controller.go +++ b/controllers/swiftstorage_controller.go @@ -343,9 +343,15 @@ func (r *SwiftStorageReconciler) Reconcile(ctx context.Context, req ctrl.Request for _, swiftPod := range podList.Items { dnsIP := "" if len(instance.Spec.NetworkAttachments) > 0 { - dnsIP, err = getPodIPInNetwork(swiftPod, instance.Namespace, "storage") + dnsIP, err = getPodIPInNetwork(swiftPod, instance.Namespace, "storagemgmt") + if err != nil { - return ctrl.Result{}, err + previousErr := err + dnsIP, err = getPodIPInNetwork(swiftPod, instance.Namespace, "storage") + if err != nil { + err = errors.Join(previousErr, err) + return ctrl.Result{}, err + } } }