From fd4fb40fcab159a1f5fdb076a9bab28f81be93ec Mon Sep 17 00:00:00 2001 From: ivan katliarchuk Date: Sat, 17 Aug 2024 14:13:45 +0100 Subject: [PATCH 1/2] chore(issue-7071): added verbosity levels Signed-off-by: ivan katliarchuk --- cluster-autoscaler/clusterstate/clusterstate.go | 6 ++++-- .../clusterstate/utils/node_instances_cache.go | 2 +- cluster-autoscaler/core/static_autoscaler.go | 4 +++- cluster-autoscaler/update_toc.py | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cluster-autoscaler/clusterstate/clusterstate.go b/cluster-autoscaler/clusterstate/clusterstate.go index 894fe1008aa2..30c501e59ac6 100644 --- a/cluster-autoscaler/clusterstate/clusterstate.go +++ b/cluster-autoscaler/clusterstate/clusterstate.go @@ -645,7 +645,9 @@ func (csr *ClusterStateRegistry) updateReadinessStats(currentTime time.Time) { continue } if nodeGroup == nil || reflect.ValueOf(nodeGroup).IsNil() { - klog.Warningf("Nodegroup is nil for %s", unregistered.Node.Name) + if klog.V(10).Enabled() { + klog.Warningf("Nodegroup is nil for %s", unregistered.Node.Name) + } continue } perNgCopy := perNodeGroup[nodeGroup.Id()] @@ -1052,7 +1054,7 @@ func (csr *ClusterStateRegistry) hasCloudProviderInstance(node *apiv1.Node) bool if err == nil { return exists } - if !errors.Is(err, cloudprovider.ErrNotImplemented) { + if !errors.Is(err, cloudprovider.ErrNotImplemented) && klog.V(10).Enabled() { klog.Warningf("Failed to check cloud provider has instance for %s: %v", node.Name, err) } return !taints.HasToBeDeletedTaint(node) diff --git a/cluster-autoscaler/clusterstate/utils/node_instances_cache.go b/cluster-autoscaler/clusterstate/utils/node_instances_cache.go index ac2723eb4acd..89d9dccae615 100644 --- a/cluster-autoscaler/clusterstate/utils/node_instances_cache.go +++ b/cluster-autoscaler/clusterstate/utils/node_instances_cache.go @@ -153,7 +153,7 @@ func (cache *CloudProviderNodeInstancesCache) InvalidateCacheEntry(nodeGroup clo // Refresh refreshes cache. func (cache *CloudProviderNodeInstancesCache) Refresh() { - klog.Infof("Start refreshing cloud provider node instances cache") + klog.V(5).Infof("Start refreshing cloud provider node instances cache") refreshStart := time.Now() nodeGroups := cache.cloudProvider.NodeGroups() diff --git a/cluster-autoscaler/core/static_autoscaler.go b/cluster-autoscaler/core/static_autoscaler.go index 027ec59630b3..013f4f31b408 100644 --- a/cluster-autoscaler/core/static_autoscaler.go +++ b/cluster-autoscaler/core/static_autoscaler.go @@ -748,7 +748,9 @@ func (a *StaticAutoscaler) removeOldUnregisteredNodes(allUnregisteredNodes []clu continue } if nodeGroup == nil || reflect.ValueOf(nodeGroup).IsNil() { - klog.Warningf("No node group for node %s, skipping", unregisteredNode.Node.Name) + if klog.V(10).Enabled() { + klog.Warningf("No node group for node %s, skipping", unregisteredNode.Node.Name) + } continue } diff --git a/cluster-autoscaler/update_toc.py b/cluster-autoscaler/update_toc.py index 34a7d2639b51..c7c8c7980b92 100755 --- a/cluster-autoscaler/update_toc.py +++ b/cluster-autoscaler/update_toc.py @@ -24,7 +24,7 @@ def updateFAQ(): faq_content = faq_file.read() faq_lines = faq_content.splitlines() while faq_lines and faq_lines[-1] == '': - faq_lines = faq_lines[:-1] + faq_lines = faq_lines[:-1] prefixes = (SECTION_PREFIX, QUESTION_PREFIX) toc_elements = [] From 2138a74d501d87b502452b4b11aaed357354c08f Mon Sep 17 00:00:00 2001 From: ivan katliarchuk Date: Sat, 17 Aug 2024 14:22:32 +0100 Subject: [PATCH 2/2] chore(issue-7071): added verbosity levels Signed-off-by: ivan katliarchuk --- cluster-autoscaler/clusterstate/clusterstate.go | 6 ++---- .../clusterstate/utils/node_instances_cache.go | 2 +- cluster-autoscaler/core/static_autoscaler.go | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cluster-autoscaler/clusterstate/clusterstate.go b/cluster-autoscaler/clusterstate/clusterstate.go index 30c501e59ac6..a2335193e073 100644 --- a/cluster-autoscaler/clusterstate/clusterstate.go +++ b/cluster-autoscaler/clusterstate/clusterstate.go @@ -645,9 +645,7 @@ func (csr *ClusterStateRegistry) updateReadinessStats(currentTime time.Time) { continue } if nodeGroup == nil || reflect.ValueOf(nodeGroup).IsNil() { - if klog.V(10).Enabled() { - klog.Warningf("Nodegroup is nil for %s", unregistered.Node.Name) - } + klog.V(4).Infof("Nodegroup is nil for %s", unregistered.Node.Name) continue } perNgCopy := perNodeGroup[nodeGroup.Id()] @@ -1054,7 +1052,7 @@ func (csr *ClusterStateRegistry) hasCloudProviderInstance(node *apiv1.Node) bool if err == nil { return exists } - if !errors.Is(err, cloudprovider.ErrNotImplemented) && klog.V(10).Enabled() { + if !errors.Is(err, cloudprovider.ErrNotImplemented) && klog.V(4).Enabled() { klog.Warningf("Failed to check cloud provider has instance for %s: %v", node.Name, err) } return !taints.HasToBeDeletedTaint(node) diff --git a/cluster-autoscaler/clusterstate/utils/node_instances_cache.go b/cluster-autoscaler/clusterstate/utils/node_instances_cache.go index 89d9dccae615..b4241fbf86ec 100644 --- a/cluster-autoscaler/clusterstate/utils/node_instances_cache.go +++ b/cluster-autoscaler/clusterstate/utils/node_instances_cache.go @@ -153,7 +153,7 @@ func (cache *CloudProviderNodeInstancesCache) InvalidateCacheEntry(nodeGroup clo // Refresh refreshes cache. func (cache *CloudProviderNodeInstancesCache) Refresh() { - klog.V(5).Infof("Start refreshing cloud provider node instances cache") + klog.V(4).Infof("Start refreshing cloud provider node instances cache") refreshStart := time.Now() nodeGroups := cache.cloudProvider.NodeGroups() diff --git a/cluster-autoscaler/core/static_autoscaler.go b/cluster-autoscaler/core/static_autoscaler.go index 013f4f31b408..7090c36fcf73 100644 --- a/cluster-autoscaler/core/static_autoscaler.go +++ b/cluster-autoscaler/core/static_autoscaler.go @@ -748,7 +748,7 @@ func (a *StaticAutoscaler) removeOldUnregisteredNodes(allUnregisteredNodes []clu continue } if nodeGroup == nil || reflect.ValueOf(nodeGroup).IsNil() { - if klog.V(10).Enabled() { + if klog.V(4).Enabled() { klog.Warningf("No node group for node %s, skipping", unregisteredNode.Node.Name) } continue