From 3b77d118234f5ca40478dcfc9f1d4709d195fad1 Mon Sep 17 00:00:00 2001 From: shaoqiu <516595344@qq.com> Date: Wed, 28 Sep 2022 14:44:24 +0800 Subject: [PATCH] delete qos limit in webhook; Signed-off-by: shaoqiu <516595344@qq.com> --- .../admission/jobs/validate/admit_job.go | 9 ------- .../admission/jobs/validate/admit_job_test.go | 26 ------------------- 2 files changed, 35 deletions(-) diff --git a/pkg/webhooks/admission/jobs/validate/admit_job.go b/pkg/webhooks/admission/jobs/validate/admit_job.go index 1a582957ce..3038c69e4c 100644 --- a/pkg/webhooks/admission/jobs/validate/admit_job.go +++ b/pkg/webhooks/admission/jobs/validate/admit_job.go @@ -31,7 +31,6 @@ import ( "k8s.io/klog" k8score "k8s.io/kubernetes/pkg/apis/core" k8scorev1 "k8s.io/kubernetes/pkg/apis/core/v1" - v1qos "k8s.io/kubernetes/pkg/apis/core/v1/helper/qos" k8scorevalid "k8s.io/kubernetes/pkg/apis/core/validation" "k8s.io/kubernetes/pkg/capabilities" @@ -367,14 +366,6 @@ func validateTaskTopoPolicy(task v1alpha1.TaskSpec, index int) string { } } - pod := &v1.Pod{ - Spec: template.Spec, - } - - if v1qos.GetPodQOS(pod) != v1.PodQOSGuaranteed { - return fmt.Sprintf("spec.task[%d] isn't Guaranteed pod, kind=%v", index, v1qos.GetPodQOS(pod)) - } - for id, container := range append(template.Spec.Containers, template.Spec.InitContainers...) { requestNum := guaranteedCPUs(container) if requestNum == 0 { diff --git a/pkg/webhooks/admission/jobs/validate/admit_job_test.go b/pkg/webhooks/admission/jobs/validate/admit_job_test.go index 6e56bc9fbf..c112267a91 100644 --- a/pkg/webhooks/admission/jobs/validate/admit_job_test.go +++ b/pkg/webhooks/admission/jobs/validate/admit_job_test.go @@ -1477,32 +1477,6 @@ func TestValidateTaskTopoPolicy(t *testing.T) { }, expect: "the cpu request isn't an integer", }, - { - name: "test-3", - taskSpec: v1alpha1.TaskSpec{ - Name: "task-3", - Replicas: 5, - TopologyPolicy: v1alpha1.Restricted, - Template: v1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"name": "test"}, - }, - Spec: v1.PodSpec{ - Containers: []v1.Container{ - { - Resources: v1.ResourceRequirements{ - Requests: v1.ResourceList{ - v1.ResourceCPU: *resource.NewQuantity(1, ""), - v1.ResourceMemory: *resource.NewQuantity(2000, resource.BinarySI), - }, - }, - }, - }, - }, - }, - }, - expect: "isn't Guaranteed pod", - }, } for _, testcase := range testCases {