diff --git a/pkg/controller/placementrule/manifestwork.go b/pkg/controller/placementrule/manifestwork.go index 7f1401cbc..2f3bb935b 100644 --- a/pkg/controller/placementrule/manifestwork.go +++ b/pkg/controller/placementrule/manifestwork.go @@ -103,8 +103,10 @@ func createManifestWork(client client.Client, clusterNamespace string, manifests = injectIntoWork(manifests, secret) //create image pull secret - pull := getPullSecret(imagePullSecret) - manifests = injectIntoWork(manifests, pull) + if imagePullSecret != nil { + pull := getPullSecret(imagePullSecret) + manifests = injectIntoWork(manifests, pull) + } // inject the hub info secret hubInfo, err := newHubInfoSecret(client, mco.Namespace, spokeNameSpace, clusterName) diff --git a/pkg/controller/placementrule/placementrule_controller.go b/pkg/controller/placementrule/placementrule_controller.go index e7d71b805..f4949b022 100644 --- a/pkg/controller/placementrule/placementrule_controller.go +++ b/pkg/controller/placementrule/placementrule_controller.go @@ -290,8 +290,12 @@ func (r *ReconcilePlacementRule) Reconcile(request reconcile.Request) (reconcile Namespace: request.Namespace, }, imagePullSecret) if err != nil { - // Error reading the object - requeue the request. - return reconcile.Result{}, err + if errors.IsNotFound(err) { + imagePullSecret = nil + } else { + // Error reading the object - requeue the request. + return reconcile.Result{}, err + } } mco.Namespace = watchNamespace // Fetch the PlacementRule instance