From 81793404042d8492f4efa11644739bd325f85f66 Mon Sep 17 00:00:00 2001 From: linzhecheng Date: Mon, 27 Nov 2023 18:00:08 +0800 Subject: [PATCH] fix(spd): remove interface Signed-off-by: linzhecheng --- pkg/controller/spd/indicator-plugin/manager.go | 18 ------------------ pkg/controller/spd/spd_indicator.go | 1 - pkg/controller/spd/spd_test.go | 2 -- 3 files changed, 21 deletions(-) diff --git a/pkg/controller/spd/indicator-plugin/manager.go b/pkg/controller/spd/indicator-plugin/manager.go index a571fd1c0..e25bbfb25 100644 --- a/pkg/controller/spd/indicator-plugin/manager.go +++ b/pkg/controller/spd/indicator-plugin/manager.go @@ -39,8 +39,6 @@ type IndicatorUpdater interface { UpdateBusinessIndicatorSpec(_ types.NamespacedName, _ []apiworkload.ServiceBusinessIndicatorSpec) UpdateSystemIndicatorSpec(_ types.NamespacedName, _ []apiworkload.ServiceSystemIndicatorSpec) UpdateBusinessIndicatorStatus(_ types.NamespacedName, _ []apiworkload.ServiceBusinessIndicatorStatus) - - UpdateBaselinePercent(_ types.NamespacedName, _ int32) } // IndicatorGetter is used by spd controller as indicator notifier to trigger @@ -134,22 +132,6 @@ func (u *IndicatorManager) UpdateBusinessIndicatorStatus(nn types.NamespacedName } } -func (u *IndicatorManager) UpdateBaselinePercent(nn types.NamespacedName, baselinePercent int32) { - u.specMtx.Lock() - defer u.specMtx.Unlock() - - spec, ok := u.specMap[nn] - if !ok { - spec = initServiceProfileDescriptorSpec() - u.specMap[nn] = spec - } - - if spec.BaselinePercent == nil || *spec.BaselinePercent != baselinePercent { - spec.BaselinePercent = &baselinePercent - u.specQueue <- nn - } -} - func (u *IndicatorManager) GetIndicatorSpecChan() chan types.NamespacedName { return u.specQueue } diff --git a/pkg/controller/spd/spd_indicator.go b/pkg/controller/spd/spd_indicator.go index 3d3237e46..04f91436a 100644 --- a/pkg/controller/spd/spd_indicator.go +++ b/pkg/controller/spd/spd_indicator.go @@ -200,7 +200,6 @@ func (sc *SPDController) mergeIndicatorSpec(spd *apiworkload.ServiceProfileDescr spd.Spec.SystemIndicator = append(spd.Spec.SystemIndicator[:i], spd.Spec.SystemIndicator[i+1:]...) } } - spd.Spec.BaselinePercent = expected.BaselinePercent } func (sc *SPDController) mergeIndicatorStatus(spd *apiworkload.ServiceProfileDescriptor, expected apiworkload.ServiceProfileDescriptorStatus) { diff --git a/pkg/controller/spd/spd_test.go b/pkg/controller/spd/spd_test.go index 182bc55f0..2b60375f7 100644 --- a/pkg/controller/spd/spd_test.go +++ b/pkg/controller/spd/spd_test.go @@ -748,7 +748,6 @@ func TestIndicatorUpdater(t *testing.T) { Current: &value, }, }) - sc.indicatorManager.UpdateBaselinePercent(nn, 20) time.Sleep(time.Millisecond * 100) newSPD, err := controlCtx.Client.InternalClient.WorkloadV1alpha1(). ServiceProfileDescriptors("default").Get(ctx, "spd1", metav1.GetOptions{}) @@ -756,5 +755,4 @@ func TestIndicatorUpdater(t *testing.T) { assert.Equal(t, expectedSpd.Spec.BusinessIndicator, newSPD.Spec.BusinessIndicator) assert.Equal(t, expectedSpd.Spec.SystemIndicator, newSPD.Spec.SystemIndicator) assert.Equal(t, expectedSpd.Status.BusinessStatus, newSPD.Status.BusinessStatus) - assert.Equal(t, expectedSpd.Spec.BaselinePercent, newSPD.Spec.BaselinePercent) }