mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Disabled CheckNodeMemoryPressure and CheckNodeDiskPressure predicates if TaintNodesByCondition enabled.
Signed-off-by: Da K. Ma <klaus1982.cn@gmail.com>
This commit is contained in:
		@@ -22,6 +22,12 @@ limitations under the License.
 | 
			
		||||
package nodelifecycle
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/golang/glog"
 | 
			
		||||
 | 
			
		||||
	"k8s.io/api/core/v1"
 | 
			
		||||
	apiequality "k8s.io/apimachinery/pkg/api/equality"
 | 
			
		||||
	apierrors "k8s.io/apimachinery/pkg/api/errors"
 | 
			
		||||
@@ -50,12 +56,6 @@ import (
 | 
			
		||||
	"k8s.io/kubernetes/pkg/util/system"
 | 
			
		||||
	taintutils "k8s.io/kubernetes/pkg/util/taints"
 | 
			
		||||
	utilversion "k8s.io/kubernetes/pkg/util/version"
 | 
			
		||||
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/golang/glog"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
@@ -179,12 +179,17 @@ func defaultPredicates() sets.String {
 | 
			
		||||
// ApplyFeatureGates applies algorithm by feature gates.
 | 
			
		||||
func ApplyFeatureGates() {
 | 
			
		||||
	if utilfeature.DefaultFeatureGate.Enabled(features.TaintNodesByCondition) {
 | 
			
		||||
		// Remove "CheckNodeCondition" predicate
 | 
			
		||||
		// Remove "CheckNodeCondition", "CheckNodeMemoryPressure" and "CheckNodeDiskPressure" predicates
 | 
			
		||||
		factory.RemoveFitPredicate(predicates.CheckNodeConditionPred)
 | 
			
		||||
		// Remove Key "CheckNodeCondition" From All Algorithm Provider
 | 
			
		||||
		factory.RemoveFitPredicate(predicates.CheckNodeMemoryPressurePred)
 | 
			
		||||
		factory.RemoveFitPredicate(predicates.CheckNodeDiskPressurePred)
 | 
			
		||||
		// Remove key "CheckNodeCondition", "CheckNodeMemoryPressure" and "CheckNodeDiskPressure"
 | 
			
		||||
		// from ALL algorithm provider
 | 
			
		||||
		// The key will be removed from all providers which in algorithmProviderMap[]
 | 
			
		||||
		// if you just want remove specific provider, call func RemovePredicateKeyFromAlgoProvider()
 | 
			
		||||
		factory.RemovePredicateKeyFromAlgorithmProviderMap(predicates.CheckNodeConditionPred)
 | 
			
		||||
		factory.RemovePredicateKeyFromAlgorithmProviderMap(predicates.CheckNodeMemoryPressurePred)
 | 
			
		||||
		factory.RemovePredicateKeyFromAlgorithmProviderMap(predicates.CheckNodeDiskPressurePred)
 | 
			
		||||
 | 
			
		||||
		// Fit is determined based on whether a pod can tolerate all of the node's taints
 | 
			
		||||
		factory.RegisterMandatoryFitPredicate(predicates.PodToleratesNodeTaintsPred, predicates.PodToleratesNodeTaints)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user