From 355f39ad5c341c2c90d817a7e5907f0b75a691ca Mon Sep 17 00:00:00 2001 From: Steve Kuznetsov Date: Thu, 22 Jun 2023 08:20:50 -0600 Subject: [PATCH] operator: use a partial metadata watch for Namespaces We only watch namespaces to react to their creation, and the only information we need about a namespace is its' name, so we can use a partial metadata watch to winnow down the size of our cache. Namespaces don't really store much in spec and status, so this effect is likely to not be enormous, but every bit helps. Signed-off-by: Steve Kuznetsov --- .../credentialsrequest/credentialsrequest_controller.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/operator/credentialsrequest/credentialsrequest_controller.go b/pkg/operator/credentialsrequest/credentialsrequest_controller.go index ae768ab340..dc589e690e 100644 --- a/pkg/operator/credentialsrequest/credentialsrequest_controller.go +++ b/pkg/operator/credentialsrequest/credentialsrequest_controller.go @@ -273,7 +273,12 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { } err = c.Watch( - &source.Kind{Type: &corev1.Namespace{}}, + &source.Kind{Type: &metav1.PartialObjectMetadata{ + TypeMeta: metav1.TypeMeta{ + Kind: "Namespace", + APIVersion: "v1", + }, + }}, namespaceMapFn, namespacePred) if err != nil {