diff --git a/pkg/controllers/dataexport/reconcile.go b/pkg/controllers/dataexport/reconcile.go index bcba057fb..082756fd6 100644 --- a/pkg/controllers/dataexport/reconcile.go +++ b/pkg/controllers/dataexport/reconcile.go @@ -1531,6 +1531,11 @@ func (c *Controller) cleanUp(driver drivers.Interface, de *kdmpapi.DataExport) e logrus.Errorf(errMsg) return fmt.Errorf(errMsg) } + if err := core.Instance().DeleteSecret(utils.GetImageSecretName(jobName), namespace); err != nil && !k8sErrors.IsNotFound(err) { + errMsg := fmt.Sprintf("deletion of image secret %s failed: %v", jobName, err) + logrus.Errorf(errMsg) + return fmt.Errorf(errMsg) + } } if err := core.Instance().DeleteSecret(utils.GetCredSecretName(de.Name), namespace); err != nil && !k8sErrors.IsNotFound(err) { diff --git a/pkg/controllers/resourceexport/reconcile.go b/pkg/controllers/resourceexport/reconcile.go index cf6d6072e..56fb7b4a9 100644 --- a/pkg/controllers/resourceexport/reconcile.go +++ b/pkg/controllers/resourceexport/reconcile.go @@ -280,6 +280,11 @@ func (c *Controller) cleanupResources(resourceExport *kdmpapi.ResourceExport) er logrus.Errorf(errMsg) return fmt.Errorf(errMsg) } + if err := core.Instance().DeleteSecret(utils.GetImageSecretName(rbName), rbNamespace); err != nil && !k8sErrors.IsNotFound(err) { + errMsg := fmt.Sprintf("deletion of image secret %s failed: %v", rbName, err) + logrus.Errorf(errMsg) + return fmt.Errorf(errMsg) + } return nil }