Skip to content

Commit

Permalink
fix knodevolumebinding plugins hasKnodeTaint for Reserve and Unreserv…
Browse files Browse the repository at this point in the history
…e function

Signed-off-by: qiuming520 <[email protected]>
  • Loading branch information
qiuming520 committed Sep 26, 2023
1 parent 8eaddc3 commit ca30302
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
1 change: 1 addition & 0 deletions deploy/scheduler/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ data:
filter:
disabled:
- name: "VolumeBinding"
- name: "TaintToleration"
enabled:
- name: "KNodeTaintToleration"
- name: "KnodeVolumeBinding"
Expand Down
4 changes: 2 additions & 2 deletions pkg/scheduler/lifted/helpers/tainttoleration.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017 The Kubernetes Authors.
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@ limitations under the License.

// This code is lifted from the Kubernetes codebase and make some slight modifications in order to avoid relying on the k8s.io/kubernetes package.
// For reference:
//https://github.com/kubernetes/component-helpers/blob/master/scheduling/corev1/helpers.go
//https://github.com/kubernetes/component-helpers/blob/release-1.21/scheduling/corev1/helpers.go

package helpers

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017 The Kubernetes Authors.
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@ limitations under the License.

// This code is lifted from the Kubernetes codebase and make some slight modifications in order to avoid relying on the k8s.io/kubernetes package.
// For reference:
// https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go
// https://github.com/kubernetes/kubernetes/blob/release-1.21/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go

package knodetainttoleration

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017 The Kubernetes Authors.
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@ limitations under the License.

// This code is lifted from the Kubernetes codebase and make some slight modifications in order to avoid relying on the k8s.io/kubernetes package.
// For reference:
// https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/framework/plugins/volumebinding/volume_binding.go
// https://github.com/kubernetes/kubernetes/blob/release-1.21/pkg/scheduler/framework/plugins/volumebinding/volume_binding.go

package knodevolumebinding

Expand Down Expand Up @@ -115,14 +115,6 @@ func (pl *VolumeBinding) PreBind(ctx context.Context, cs *framework.CycleState,

// Reserve reserves volumes of pod and saves binding status in cycle state.
func (pl *VolumeBinding) Reserve(_ context.Context, cs *framework.CycleState, p *corev1.Pod, nodeName string) *framework.Status {
nodeInfo, err := pl.frameworkHandler.SnapshotSharedLister().NodeInfos().Get(nodeName)
if err != nil {
return framework.NewStatus(framework.Error, "node not found")
}
if helpers.HasKnodeTaint(nodeInfo.Node()) {
return nil
}

state, err := getStateData(cs)
if err != nil {
return framework.AsStatus(err)
Expand All @@ -145,14 +137,6 @@ func (pl *VolumeBinding) Reserve(_ context.Context, cs *framework.CycleState, p
// Unreserve clears assumed PV and PVC cache.
// It's idempotent, and does nothing if no cache found for the given pod.
func (pl *VolumeBinding) Unreserve(_ context.Context, cs *framework.CycleState, _ *corev1.Pod, nodeName string) {
nodeInfo, err := pl.frameworkHandler.SnapshotSharedLister().NodeInfos().Get(nodeName)
if err != nil {
return
}
if helpers.HasKnodeTaint(nodeInfo.Node()) {
return
}

s, err := getStateData(cs)
if err != nil {
return
Expand Down

0 comments on commit ca30302

Please sign in to comment.