Skip to content

Commit

Permalink
chore: remove legacy cluster DAG execute priority (#8046)
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Rookie authored Aug 29, 2024
1 parent ea82432 commit 81c4a93
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions controllers/apps/cluster_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/go-logr/logr"
snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/client/v3/apis/volumesnapshot/v1beta1"
snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
Expand All @@ -48,12 +47,6 @@ import (
intctrlutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
)

const (
defaultWeight int = iota
workloadWeight
clusterWeight
)

// clusterTransformContext a graph.TransformContext implementation for Cluster reconciliation
type clusterTransformContext struct {
context.Context
Expand Down Expand Up @@ -184,24 +177,7 @@ func (c *clusterPlanBuilder) Build() (graph.Plan, error) {
// Plan implementation

func (p *clusterPlan) Execute() error {
less := func(v1, v2 graph.Vertex) bool {
getWeight := func(v graph.Vertex) int {
lifecycleVertex, ok := v.(*model.ObjectVertex)
if !ok {
return defaultWeight
}
switch lifecycleVertex.Obj.(type) {
case *appsv1alpha1.Cluster:
return clusterWeight
case *appsv1.StatefulSet, *appsv1.Deployment:
return workloadWeight
default:
return defaultWeight
}
}
return getWeight(v1) <= getWeight(v2)
}
err := p.dag.WalkReverseTopoOrder(p.walkFunc, less)
err := p.dag.WalkReverseTopoOrder(p.walkFunc, nil)
if err != nil {
if hErr := p.handlePlanExecutionError(err); hErr != nil {
return hErr
Expand Down

0 comments on commit 81c4a93

Please sign in to comment.