@@ -21,6 +21,7 @@ import (
2121 "github.com/go-logr/logr"
2222 appsv1 "k8s.io/api/apps/v1"
2323
24+ v1 "k8s.io/api/apps/v1"
2425 corev1 "k8s.io/api/core/v1"
2526 "k8s.io/apimachinery/pkg/api/errors"
2627 "k8s.io/apimachinery/pkg/api/meta"
@@ -158,9 +159,6 @@ func add(c ctrlruntime.Controller, r *ReconcileAPIServer) error {
158159 if err = c .WatchObject (& corev1.Namespace {ObjectMeta : metav1.ObjectMeta {Name : render .APIServerNamespace }}, & handler.EnqueueRequestForObject {}); err != nil {
159160 return fmt .Errorf ("apiserver-controller failed to watch resource: %w" , err )
160161 }
161- if err = c .WatchObject (& corev1.Namespace {ObjectMeta : metav1.ObjectMeta {Name : render .APIServerNamespace }}, & handler.EnqueueRequestForObject {}); err != nil {
162- return fmt .Errorf ("apiserver-controller failed to watch resource: %w" , err )
163- }
164162
165163 for _ , secretName := range []string {
166164 "calico-apiserver-certs" , "tigera-apiserver-certs" ,
@@ -513,8 +511,8 @@ func validateAPIServerResource(instance *operatorv1.APIServer) error {
513511// prior to the CNI plugin being removed.
514512func (r * ReconcileAPIServer ) maintainFinalizer (ctx context.Context , apiserver client.Object ) error {
515513 // These objects require graceful termination before the CNI plugin is torn down.
516- apiServerNamespace := & corev1. Namespace {ObjectMeta : metav1.ObjectMeta {Name : render .APIServerNamespace }}
517- return utils .MaintainInstallationFinalizer (ctx , r .client , apiserver , render .APIServerFinalizer , apiServerNamespace )
514+ apiServerDeployment := v1. Deployment {ObjectMeta : metav1.ObjectMeta {Name : "calico-apiserver" , Namespace : render .APIServerNamespace }}
515+ return utils .MaintainInstallationFinalizer (ctx , r .client , apiserver , render .APIServerFinalizer , & apiServerDeployment )
518516}
519517
520518// canCleanupLegacyNamespace determines whether the legacy "tigera-system" namespace
0 commit comments