diff --git a/pkg/clustertree/cluster-manager/utils/leaf_model_handler.go b/pkg/clustertree/cluster-manager/utils/leaf_model_handler.go index f5133b503..71bb883e4 100644 --- a/pkg/clustertree/cluster-manager/utils/leaf_model_handler.go +++ b/pkg/clustertree/cluster-manager/utils/leaf_model_handler.go @@ -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 } @@ -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 } diff --git a/pkg/clustertree/cluster-manager/utils/leaf_resource_manager.go b/pkg/clustertree/cluster-manager/utils/leaf_resource_manager.go index 781135568..19188f97d 100644 --- a/pkg/clustertree/cluster-manager/utils/leaf_resource_manager.go +++ b/pkg/clustertree/cluster-manager/utils/leaf_resource_manager.go @@ -24,7 +24,8 @@ var ( type LeafMode int const ( - ALL LeafMode = iota + nodeMode = "leafNodeMode" + ALL LeafMode = iota Node Party ) diff --git a/pkg/scheduler/lifted/plugins/leafnodevolumebinding/leafnode_volume_binding.go b/pkg/scheduler/lifted/plugins/leafnodevolumebinding/leafnode_volume_binding.go index 362598294..d4a2e525c 100644 --- a/pkg/scheduler/lifted/plugins/leafnodevolumebinding/leafnode_volume_binding.go +++ b/pkg/scheduler/lifted/plugins/leafnodevolumebinding/leafnode_volume_binding.go @@ -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 @@ -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 }