Skip to content

Commit

Permalink
fix:instance rescheduler fail by volumeBindingNodeConflict in one2one…
Browse files Browse the repository at this point in the history
… mode

Signed-off-by: qiuming520 <qiuming_yewu@cmss.chinamobile.com>
  • Loading branch information
qiuming520 committed Aug 11, 2024
1 parent a8c7eae commit 84ee751
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions pkg/clustertree/cluster-manager/utils/leaf_model_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func (h ClassificationHandler) CreateRootNode(ctx context.Context, listenPort in
if h.leafMode == ALL {
nodeNameInRoot := fmt.Sprintf("%s%s", utils.KosmosNodePrefix, cluster.Name)
nodeInRoot, err := createNode(ctx, h.RootClientset, cluster.Name, nodeNameInRoot, gitVersion, listenPort)
nodeInRoot.Annotations[nodeMode] = "one2cluster"
if err != nil {
return nil, nil, err
}
Expand All @@ -265,6 +266,10 @@ func (h ClassificationHandler) CreateRootNode(ctx context.Context, listenPort in
if err != nil {
return nil, nil, err
}
if h.leafMode == Party {
nodeInRoot.Annotations[nodeMode] = "one2party"
}

nodes = append(nodes, nodeInRoot)
leafNodeSelectors[nodeNameInRoot] = leafModel.NodeSelector
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ var (
type LeafMode int

const (
ALL LeafMode = iota
nodeMode = "leafNodeMode"
ALL LeafMode = iota
Node
Party
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (

const (
stateKey framework.StateKey = Name
nodeMode = "leafNodeMode"
)

// the state is initialized in PreFilter phase. because we save the pointer in
Expand Down Expand Up @@ -197,15 +198,22 @@ func (pl *VolumeBinding) Filter(_ context.Context, cs *framework.CycleState, pod
return framework.NewStatus(framework.Error, "node not found")
}

if helpers.HasLeafNodeTaint(node) {
return nil
}

state, err := getStateData(cs)
if err != nil {
return framework.AsStatus(err)
}

if helpers.HasLeafNodeTaint(node) {
if cluster, ok := node.Annotations[nodeMode]; ok && cluster == "one2cluster" {
klog.V(5).InfoS("This is one2cluster ", "pod", klog.KObj(pod), "node", klog.KObj(node))
return nil
} else {
if len(state.boundClaims) <= 0 {
return nil
}
}
}

if state.skip {
return nil
}
Expand Down

0 comments on commit 84ee751

Please sign in to comment.