mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
NodeConditionPredicates should return NodeOutOfDisk error.
This commit is contained in:
parent
b32639f9e7
commit
abee0ce8a3
@ -1351,7 +1351,7 @@ func NodeConditionPredicates(nodeInfo *schedulercache.NodeInfo) (bool, []algorit
|
||||
// TODO: There are other node status that the DaemonSet should ideally respect too,
|
||||
// e.g. MemoryPressure, and DiskPressure
|
||||
if c.Type == v1.NodeOutOfDisk && c.Status == v1.ConditionTrue {
|
||||
reasons = append(reasons, predicates.ErrNodeSelectorNotMatch)
|
||||
reasons = append(reasons, predicates.ErrNodeOutOfDisk)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -1394,6 +1394,7 @@ func setDaemonSetCritical(ds *extensions.DaemonSet) {
|
||||
func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
cases := []struct {
|
||||
podsOnNode []*v1.Pod
|
||||
nodeCondition []v1.NodeCondition
|
||||
ds *extensions.DaemonSet
|
||||
wantToRun, shouldSchedule, shouldContinueRunning bool
|
||||
err error
|
||||
@ -1414,6 +1415,23 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
shouldSchedule: true,
|
||||
shouldContinueRunning: true,
|
||||
},
|
||||
{
|
||||
ds: &extensions.DaemonSet{
|
||||
Spec: extensions.DaemonSetSpec{
|
||||
Selector: &metav1.LabelSelector{MatchLabels: simpleDaemonSetLabel},
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: simpleDaemonSetLabel,
|
||||
},
|
||||
Spec: resourcePodSpec("", "50M", "0.5"),
|
||||
},
|
||||
},
|
||||
},
|
||||
nodeCondition: []v1.NodeCondition{{Type: v1.NodeOutOfDisk, Status: v1.ConditionTrue}},
|
||||
wantToRun: true,
|
||||
shouldSchedule: false,
|
||||
shouldContinueRunning: true,
|
||||
},
|
||||
{
|
||||
ds: &extensions.DaemonSet{
|
||||
Spec: extensions.DaemonSetSpec{
|
||||
@ -1484,6 +1502,7 @@ func TestNodeShouldRunDaemonPod(t *testing.T) {
|
||||
for i, c := range cases {
|
||||
for _, strategy := range updateStrategies() {
|
||||
node := newNode("test-node", nil)
|
||||
node.Status.Conditions = append(node.Status.Conditions, c.nodeCondition...)
|
||||
node.Status.Allocatable = allocatableResources("100M", "1")
|
||||
manager, _, _ := newTestController()
|
||||
manager.nodeStore.Add(node)
|
||||
|
Loading…
Reference in New Issue
Block a user