summaryrefslogtreecommitdiffstats
path: root/certServiceK8sExternalProvider
diff options
context:
space:
mode:
authorTomasz Wrobel <tomasz.wrobel@nokia.com>2021-06-10 10:44:58 +0200
committerTomasz Wrobel <tomasz.wrobel@nokia.com>2021-06-15 08:58:57 +0200
commit0a1fb4e210c79a7ecc8f8acdb82c53ad79bf94aa (patch)
tree150d945c72905cc6c509e4d229ce16965c332a72 /certServiceK8sExternalProvider
parentdd21ec585367e5e75372795dddf9838dd138881e (diff)
[OOM-CERT-SERVICE] Fix cmpv2 issuer error when CRD is removed
Issue-ID: OOM-2771 Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com> Change-Id: I28f7a0d7fb3e7f6227b0a4ac64ca45c274956b8e
Diffstat (limited to 'certServiceK8sExternalProvider')
-rw-r--r--certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller.go b/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller.go
index cb667bd6..51d13590 100644
--- a/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller.go
+++ b/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller.go
@@ -97,7 +97,7 @@ func (controller *CertificateRequestController) Reconcile(k8sRequest ctrl.Reques
}
if err := controller.Client.Get(ctx, issuerNamespaceName, &issuer); err != nil {
controller.handleErrorGettingCMPv2Issuer(certUpdater, log, err, certificateRequest, issuerNamespaceName, k8sRequest)
- return ctrl.Result{}, err
+ return ctrl.Result{}, client.IgnoreNotFound(err)
}
// 5. Check if CMPv2Issuer is ready to sing certificates
@@ -110,7 +110,7 @@ func (controller *CertificateRequestController) Reconcile(k8sRequest ctrl.Reques
provisioner, ok := provisioners.Load(issuerNamespaceName)
if !ok {
err := controller.handleErrorCouldNotLoadCMPv2Provisioner(certUpdater, log, issuerNamespaceName)
- return ctrl.Result{}, err
+ return ctrl.Result{}, client.IgnoreNotFound(err)
}
// 7. Get private key matching CertificateRequest
@@ -221,8 +221,9 @@ func (controller *CertificateRequestController) handleErrorFailedToDecodeCSR(upd
func handleErrorResourceNotFound(log leveledlogger.Logger, err error) error {
if apierrors.IsNotFound(err) {
log.Error(err, "CertificateRequest resource not found")
+ return nil
} else {
log.Error(err, "Failed to retrieve CertificateRequest resource")
+ return err
}
- return err
}