Skip to content

Commit

Permalink
Add taint toleration plugin to checks
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Nov 7, 2024
1 parent 00d7c99 commit df740b6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/scheduler/fit.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/noderesources"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeunschedulable"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/tainttoleration"

corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -71,11 +72,17 @@ func WillTheyFit(ctx context.Context, cli client.Client, proposedPods []*corev1.
return err
}

tainttolerationPlugin, err := tainttoleration.New(ctx, nil, nil)
if err != nil {
return err
}

plugins := []framework.FilterPlugin{
schedulablePlugin.(framework.FilterPlugin),
noderesourcesPlugin.(framework.FilterPlugin),
nodeaffinityPlugin.(framework.FilterPlugin),
interpodaffinityPlugin.(framework.FilterPlugin),
tainttolerationPlugin.(framework.FilterPlugin),
}

NextPod:
Expand All @@ -95,14 +102,9 @@ NextPod:

node.AddPod(pod)
continue NextPod
// Now we need a way to check if the pod was never added to any node
// TODO Need more checks like affinities, inter-pod affinities, taints, tolerations
}
// Pod was never added to any node
return errors.New(framework.Unschedulable.String())
}

// Check node condition, will it accept something
// Need tolerations, taints, affinities..
return nil
}

0 comments on commit df740b6

Please sign in to comment.