Skip to content

Commit

Permalink
chore: remove updatePodReplicaLabel4Scaling (#7175)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7126d2e)
  • Loading branch information
free6om committed Apr 25, 2024
1 parent 5bd8105 commit 88f8b81
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions controllers/apps/transformer_component_workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package apps
import (
"fmt"
"reflect"
"strconv"
"strings"

"github.com/spf13/viper"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 88f8b81

Please sign in to comment.