From e4eb5660d687deb405fbcaeb153f4c05a059e6a1 Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Wed, 21 Sep 2022 20:30:19 -0700 Subject: [PATCH] Check if error via ListKeys of Storage Interface. (#1015) Signed-off-by: Tomoya Fujita Signed-off-by: Tomoya Fujita --- pkg/yurthub/gc/gc.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/yurthub/gc/gc.go b/pkg/yurthub/gc/gc.go index 8bf56cb8fc7..6ae777fedd9 100644 --- a/pkg/yurthub/gc/gc.go +++ b/pkg/yurthub/gc/gc.go @@ -91,7 +91,10 @@ func (m *GCManager) Run() { func (m *GCManager) gcPodsWhenRestart() { localPodKeys, err := m.store.ListKeys("kubelet/pods") - if err != nil || len(localPodKeys) == 0 { + if err != nil { + klog.Errorf("failed to list keys for kubelet pods, %v", err) + return + } else if len(localPodKeys) == 0 { klog.Infof("local storage for kubelet pods is empty, not need to gc pods") return }