Skip to content

Commit

Permalink
Merge pull request #586 from weilaaa/fix/remove-duplicated-constants
Browse files Browse the repository at this point in the history
remove duplicated constants in binding.go
  • Loading branch information
karmada-bot committed Aug 9, 2021
2 parents 300d37e + 32d051c commit 8088121
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pkg/util/helper/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ import (
"github.com/karmada-io/karmada/pkg/util/restmapper"
)

const (
// SpecField indicates the 'spec' field of a deployment
SpecField = "spec"
// ReplicasField indicates the 'replicas' field of a deployment
ReplicasField = "replicas"
)

// ClusterWeightInfo records the weight of a cluster
type ClusterWeightInfo struct {
ClusterName string
Expand Down Expand Up @@ -396,12 +389,12 @@ func calculateReplicas(c client.Client, policy *v1alpha1.ReplicaSchedulingPolicy
}

func applyReplicaSchedulingPolicy(workload *unstructured.Unstructured, desireReplica int64) error {
_, ok, err := unstructured.NestedInt64(workload.Object, SpecField, ReplicasField)
_, ok, err := unstructured.NestedInt64(workload.Object, util.SpecField, util.ReplicasField)
if err != nil {
return err
}
if ok {
err := unstructured.SetNestedField(workload.Object, desireReplica, SpecField, ReplicasField)
err := unstructured.SetNestedField(workload.Object, desireReplica, util.SpecField, util.ReplicasField)
if err != nil {
return err
}
Expand Down

0 comments on commit 8088121

Please sign in to comment.