From 68a5ab1ea65d3b08ccdd205bfaa637f27b5e0c00 Mon Sep 17 00:00:00 2001 From: wangmin Date: Wed, 11 Sep 2024 23:03:16 +0800 Subject: [PATCH 1/2] koordlet(qos-manager): Add the statesInformer.HasSynced method to wait for the PVC resource synchronization to complete. If the WaitForCacheSync method is not passed a second parameter, the return value is always true --- pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile.go b/pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile.go index 13d4e7fbe..9c40e43c5 100644 --- a/pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile.go +++ b/pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile.go @@ -97,7 +97,8 @@ func New(opt *framework.Options) framework.QOSStrategy { func (b *blkIOReconcile) init(stopCh <-chan struct{}) error { b.executor.Run(stopCh) - if !cache.WaitForCacheSync(stopCh) { + + if !cache.WaitForCacheSync(stopCh, b.statesInformer.HasSynced) { return fmt.Errorf("%s: timed out waiting for pvc caches to sync", BlkIOReconcileName) } return nil From 23249e057fe439ce445ea5fe8e047c000f6089ac Mon Sep 17 00:00:00 2001 From: wangmin Date: Thu, 12 Sep 2024 15:27:25 +0800 Subject: [PATCH 2/2] koordlet: fix TestBlkIOReconcile_reconcile unit test, add implementation of statesInformer HasSync method --- pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile_test.go b/pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile_test.go index fae05ba4c..7793e4c8f 100644 --- a/pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile_test.go +++ b/pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile_test.go @@ -125,6 +125,7 @@ func TestBlkIOReconcile_reconcile(t *testing.T) { testingPodMeta1, testingPodMeta2}).AnyTimes() statesInformer.EXPECT().GetNodeSLO().Return(testingNodeSLO).AnyTimes() + statesInformer.EXPECT().HasSynced().Return(true).AnyTimes() statesInformer.EXPECT().GetVolumeName("default", PVCName).Return(PVName).AnyTimes() mockMetricCache := mock_metriccache.NewMockMetricCache(ctrl)