From c3421c16ec7894e6c666ef8516b19dccc8295e21 Mon Sep 17 00:00:00 2001 From: leonarliu Date: Fri, 26 Nov 2021 10:41:38 +0800 Subject: [PATCH] fix(monitor): dynamic clientset is nil --- pkg/monitor/util/cache/cache.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/monitor/util/cache/cache.go b/pkg/monitor/util/cache/cache.go index 3cff588e4..c525a275d 100644 --- a/pkg/monitor/util/cache/cache.go +++ b/pkg/monitor/util/cache/cache.go @@ -348,6 +348,9 @@ func NewCacher(platformClient platformversionedclient.PlatformV1Interface, func (c *cacher) getTApps(ctx context.Context, curDynamicClientSet util.DynamicClientSet, cluster string) int { count := 0 + if curDynamicClientSet == nil { + log.Warn("Query TApps failed", log.Any("cluster", cluster), log.Err(fmt.Errorf("DynamicClientSet is nil"))) + } content, err := curDynamicClientSet[cluster].Resource(TAppResource). Namespace(AllNamespaces).List(ctx, metav1.ListOptions{}) if content == nil || (err != nil && !errors.IsNotFound(err)) {