Skip to content

Commit 81cabc4

Browse files
authored
Merge pull request kosmos-io#75 from qiuming520/release-1.21
fix knodevolumebinding plugins hasKnodeTaint for Reserve and Unreserve function
2 parents 8eaddc3 + ca30302 commit 81cabc4

File tree

4 files changed

+7
-22
lines changed

4 files changed

+7
-22
lines changed

deploy/scheduler/deployment.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ data:
7676
filter:
7777
disabled:
7878
- name: "VolumeBinding"
79+
- name: "TaintToleration"
7980
enabled:
8081
- name: "KNodeTaintToleration"
8182
- name: "KnodeVolumeBinding"

pkg/scheduler/lifted/helpers/tainttoleration.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2017 The Kubernetes Authors.
2+
Copyright 2019 The Kubernetes Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@ limitations under the License.
1616

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

2121
package helpers
2222

pkg/scheduler/lifted/plugins/knodetainttoleration/knode_tainttoleration.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2017 The Kubernetes Authors.
2+
Copyright 2019 The Kubernetes Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@ limitations under the License.
1616

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

2121
package knodetainttoleration
2222

pkg/scheduler/lifted/plugins/knodevolumebinding/knode_volume_binding.go

+2-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2017 The Kubernetes Authors.
2+
Copyright 2019 The Kubernetes Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@ limitations under the License.
1616

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

2121
package knodevolumebinding
2222

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

116116
// Reserve reserves volumes of pod and saves binding status in cycle state.
117117
func (pl *VolumeBinding) Reserve(_ context.Context, cs *framework.CycleState, p *corev1.Pod, nodeName string) *framework.Status {
118-
nodeInfo, err := pl.frameworkHandler.SnapshotSharedLister().NodeInfos().Get(nodeName)
119-
if err != nil {
120-
return framework.NewStatus(framework.Error, "node not found")
121-
}
122-
if helpers.HasKnodeTaint(nodeInfo.Node()) {
123-
return nil
124-
}
125-
126118
state, err := getStateData(cs)
127119
if err != nil {
128120
return framework.AsStatus(err)
@@ -145,14 +137,6 @@ func (pl *VolumeBinding) Reserve(_ context.Context, cs *framework.CycleState, p
145137
// Unreserve clears assumed PV and PVC cache.
146138
// It's idempotent, and does nothing if no cache found for the given pod.
147139
func (pl *VolumeBinding) Unreserve(_ context.Context, cs *framework.CycleState, _ *corev1.Pod, nodeName string) {
148-
nodeInfo, err := pl.frameworkHandler.SnapshotSharedLister().NodeInfos().Get(nodeName)
149-
if err != nil {
150-
return
151-
}
152-
if helpers.HasKnodeTaint(nodeInfo.Node()) {
153-
return
154-
}
155-
156140
s, err := getStateData(cs)
157141
if err != nil {
158142
return

0 commit comments

Comments
 (0)