From cdc2824edff203d62f5fb66cd63642e59fb59059 Mon Sep 17 00:00:00 2001 From: Raghav Muddur Date: Wed, 21 Jul 2021 08:44:37 -0700 Subject: [PATCH] New error code for Secret not found (#33) Updated from `ackerr.NotFound` to `SecretNotFound` --- pkg/errors/error.go | 3 +++ pkg/runtime/reconciler.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/errors/error.go b/pkg/errors/error.go index ca58447..bfd6ef0 100644 --- a/pkg/errors/error.go +++ b/pkg/errors/error.go @@ -55,6 +55,9 @@ var ( // SecretTypeNotSupported is returned if non opaque secret is used. SecretTypeNotSupported = fmt.Errorf( "only opaque secrets can be used") + // SecretNotFound is returned if specified kubernetes secret is not found. + SecretNotFound = fmt.Errorf( + "kubernetes secret not found") ) // AWSError returns the type conversion for the supplied error to an aws-sdk-go diff --git a/pkg/runtime/reconciler.go b/pkg/runtime/reconciler.go index 4c176f2..9a084ed 100644 --- a/pkg/runtime/reconciler.go +++ b/pkg/runtime/reconciler.go @@ -105,7 +105,7 @@ func (r *reconciler) SecretValueFromReference( } var secret corev1.Secret if err := r.kc.Get(ctx, nsn, &secret); err != nil { - return "", err + return "", ackerr.SecretNotFound } // Currently we have only Opaque secrets in scope. @@ -118,7 +118,7 @@ func (r *reconciler) SecretValueFromReference( return valuestr, nil } - return "", ackerr.NotFound + return "", ackerr.SecretNotFound } // Reconcile implements `controller-runtime.Reconciler` and handles reconciling