Skip to content

Commit fdad50e

Browse files
committed
Add APIServer finalizer only to the deployment
1 parent c9bb143 commit fdad50e

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pkg/controller/apiserver/apiserver_controller.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
514512
func (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

pkg/render/apiserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2332,7 +2332,7 @@ func (c *apiServerComponent) getDeprecatedResources() []client.Object {
23322332
}
23332333

23342334
// Delete the older namespace for OSS and EE.
2335-
// this is to support older version OSS update to newer EE and vice versa.
2335+
// This supports upgrades from older OSS versions to newer EE versions, and vice versa.
23362336
// CanCleanupOlderResources ensure the newdeployment is up and running in calico-system in both variant.
23372337
if c.cfg.CanCleanupOlderResources {
23382338
renamedRscList = append(renamedRscList, &corev1.Namespace{

0 commit comments

Comments
 (0)