From 11349be989d2e81ad59e896f20a17e080f973d7b Mon Sep 17 00:00:00 2001 From: Manuel Grandeit Date: Wed, 30 Oct 2024 15:10:55 +0100 Subject: [PATCH] Fix log spam from spoke_token_controller Signed-off-by: Manuel Grandeit --- .../spoketoken/spoke_token_controller.go | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/pkg/controller/spoketoken/spoke_token_controller.go b/pkg/controller/spoketoken/spoke_token_controller.go index 7557c150..a2b01515 100644 --- a/pkg/controller/spoketoken/spoke_token_controller.go +++ b/pkg/controller/spoketoken/spoke_token_controller.go @@ -435,12 +435,7 @@ var applicationManagerSecretPredicateFunctions = predicate.Funcs{ return false } - if newSecret.Namespace != appAddonNS { - klog.Infof("secret namespace not matched, appAddonNS= %v", appAddonNS) - return false - } - - if newSecret.Type == "kubernetes.io/service-account-token" && + if strings.EqualFold(newSecret.Namespace, appAddonNS) && newSecret.Type == "kubernetes.io/service-account-token" && newSecret.GetAnnotations()["kubernetes.io/service-account.name"] == appAddonName { klog.Infof("secret updated: %v/%v", appAddonNS, appAddonName) @@ -455,12 +450,7 @@ var applicationManagerSecretPredicateFunctions = predicate.Funcs{ return false } - if newSecret.Namespace != appAddonNS { - klog.Infof("secret namespace not matched, appAddonNS= %v", appAddonNS) - return false - } - - if newSecret.Type == "kubernetes.io/service-account-token" && + if strings.EqualFold(newSecret.Namespace, appAddonNS) && newSecret.Type == "kubernetes.io/service-account-token" && newSecret.GetAnnotations()["kubernetes.io/service-account.name"] == appAddonName { klog.Infof("secret created: %v/%v", appAddonNS, appAddonName) @@ -475,12 +465,7 @@ var applicationManagerSecretPredicateFunctions = predicate.Funcs{ return false } - if newSecret.Namespace != appAddonNS { - klog.Infof("secret namespace not matched, appAddonNS= %v", appAddonNS) - return false - } - - if newSecret.Type == "kubernetes.io/service-account-token" && + if strings.EqualFold(newSecret.Namespace, appAddonNS) && newSecret.Type == "kubernetes.io/service-account-token" && newSecret.GetAnnotations()["kubernetes.io/service-account.name"] == appAddonName { klog.Infof("secret deleted: %v/%v", appAddonNS, appAddonName)