Skip to content

Commit

Permalink
fix: fix errorlog print waiting time
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxinbot committed Apr 15, 2022
1 parent 0515a94 commit 5445d29
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/infrastructure/kube/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func DiscoverGVK(gvk schema.GroupVersionKind) bool {
return true
}
discoveryClient := genericClient.DiscoveryClient
startTime := time.Now()

err := retry.OnError(
backOff,
Expand All @@ -75,11 +76,13 @@ func DiscoverGVK(gvk schema.GroupVersionKind) bool {

if err != nil {
if err == errKindNotFound {
klog.Errorf("not found kind %s in group version %s, waiting time %s", gvk.Kind, gvk.GroupVersion().String())
klog.Errorf("not found kind %s in group version %s, waiting time %s",
gvk.Kind, gvk.GroupVersion().String(), time.Since(startTime))
return false
}
// This might be caused by abnormal apiserver or etcd, ignore it
klog.Errorf("failed to find resources in group version %s: %v, waiting time %s", gvk.GroupVersion().String(), err)
klog.Errorf("failed to find resources in group version %s: %v, waiting time %s",
gvk.GroupVersion().String(), err, time.Since(startTime))
}
return true
}

0 comments on commit 5445d29

Please sign in to comment.