From 597fc5d7fb725d0e1a2b3ece10e595752949bbfc Mon Sep 17 00:00:00 2001 From: Roman Hros Date: Fri, 12 Jan 2024 12:01:56 +0100 Subject: [PATCH] Catch NotFound secret and provide more useful error message Signed-off-by: Roman Hros --- internal/controller/openstacknodeimagerelease_controller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/controller/openstacknodeimagerelease_controller.go b/internal/controller/openstacknodeimagerelease_controller.go index 5a93b920..be959340 100644 --- a/internal/controller/openstacknodeimagerelease_controller.go +++ b/internal/controller/openstacknodeimagerelease_controller.go @@ -286,6 +286,9 @@ func (r *OpenStackNodeImageReleaseReconciler) getCloudFromSecret(ctx context.Con Name: secretName, }, secret) if err != nil { + if apierrors.IsNotFound(err) { + return emptyCloud, fmt.Errorf("secret %s in namespace %s does not exist: %w", secretName, secretNamespace, err) + } return emptyCloud, fmt.Errorf("failed to get secret %s: %w", secretName, err) } content, ok := secret.Data[cloudsSecretKey]