Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

koord-scheduler: skip daemonset usageThreshold check #1243

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/scheduler/plugins/loadaware/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,13 @@ func sumPodUsages(podMetrics map[string]corev1.ResourceList, estimatedPods sets.
}
return podUsages, estimatedPodsUsages
}

// isDaemonSetPod returns true if the pod is a IsDaemonSetPod.
func isDaemonSetPod(ownerRefList []metav1.OwnerReference) bool {
for _, ownerRef := range ownerRefList {
if ownerRef.Kind == "DaemonSet" {
return true
}
}
return false
}
4 changes: 4 additions & 0 deletions pkg/scheduler/plugins/loadaware/load_aware.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func (p *Plugin) Filter(ctx context.Context, state *framework.CycleState, pod *c
return framework.NewStatus(framework.Error, "node not found")
}

if isDaemonSetPod(pod.OwnerReferences) {
return nil
}

nodeMetric, err := p.nodeMetricLister.Get(node.Name)
if err != nil {
// For nodes that lack load information, fall back to the situation where there is no load-aware scheduling.
Expand Down
30 changes: 30 additions & 0 deletions pkg/scheduler/plugins/loadaware/load_aware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/client-go/informers"
Expand Down Expand Up @@ -770,6 +771,35 @@ func TestFilterUsage(t *testing.T) {
testPod: schedulertesting.MakePod().Namespace("default").Name("prod-pod-3").Priority(extension.PriorityProdValueMax).Obj(),
wantStatus: framework.NewStatus(framework.Unschedulable, fmt.Sprintf(ErrReasonUsageExceedThreshold, corev1.ResourceMemory)),
},
{
name: "filter daemonset pod exceed cpu usage",
nodeName: "test-node-1",
nodeMetric: &slov1alpha1.NodeMetric{
ObjectMeta: metav1.ObjectMeta{
Name: "test-node-1",
},
Spec: slov1alpha1.NodeMetricSpec{
CollectPolicy: &slov1alpha1.NodeMetricCollectPolicy{
ReportIntervalSeconds: pointer.Int64(60),
},
},
Status: slov1alpha1.NodeMetricStatus{
UpdateTime: &metav1.Time{
Time: time.Now(),
},
NodeMetric: &slov1alpha1.NodeMetricInfo{
NodeUsage: slov1alpha1.ResourceMap{
ResourceList: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("70"),
corev1.ResourceMemory: resource.MustParse("256Gi"),
},
},
},
},
},
testPod: schedulertesting.MakePod().Namespace("default").Name("test-pod").Priority(extension.PriorityProdValueMax).OwnerReference("test-daemonset", schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "DaemonSet"}).Obj(),
wantStatus: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down