From 7126d2ebac2e4b02ea5e4990f9ef86d78bb21e2c Mon Sep 17 00:00:00 2001 From: free6om Date: Thu, 25 Apr 2024 22:28:08 +0800 Subject: [PATCH] chore: remove updatePodReplicaLabel4Scaling (#7175) --- .../apps/transformer_component_workload.go | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/controllers/apps/transformer_component_workload.go b/controllers/apps/transformer_component_workload.go index 95cd554af36..02117dcad1e 100644 --- a/controllers/apps/transformer_component_workload.go +++ b/controllers/apps/transformer_component_workload.go @@ -22,7 +22,6 @@ package apps import ( "fmt" "reflect" - "strconv" "strings" "github.com/spf13/viper" @@ -420,10 +419,6 @@ func (r *componentWorkloadOps) horizontalScale() error { } } - if err := r.updatePodReplicaLabel4Scaling(r.synthesizeComp.Replicas); err != nil { - return err - } - r.reqCtx.Recorder.Eventf(r.cluster, corev1.EventTypeNormal, "HorizontalScale", @@ -533,24 +528,6 @@ func (r *componentWorkloadOps) scaleOut(itsObj *workloads.InstanceSet) error { } } -func (r *componentWorkloadOps) updatePodReplicaLabel4Scaling(replicas int32) error { - graphCli := model.NewGraphClient(r.cli) - pods, err := component.ListPodOwnedByComponent(r.reqCtx.Ctx, r.cli, r.cluster.Namespace, - constant.GetComponentWellKnownLabels(r.cluster.Name, r.synthesizeComp.Name), inDataContext4C()) - if err != nil { - return err - } - for _, pod := range pods { - obj := pod.DeepCopy() - if obj.Annotations == nil { - obj.Annotations = make(map[string]string) - } - obj.Annotations[constant.ComponentReplicasAnnotationKey] = strconv.Itoa(int(replicas)) - graphCli.Update(r.dag, nil, obj, inDataContext4G()) - } - return nil -} - func (r *componentWorkloadOps) leaveMember4ScaleIn() error { pods, err := component.ListPodOwnedByComponent(r.reqCtx.Ctx, r.cli, r.cluster.Namespace, constant.GetComponentWellKnownLabels(r.cluster.Name, r.synthesizeComp.Name), inDataContext4C())