From 73d644a7c965d64a0c52042e5f83399853a9544e Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Wed, 21 Sep 2022 11:48:08 -0700 Subject: [PATCH] Check if error via ListKeys of Storage Interface. 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 }