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

remove dependency on kubectl #938

Merged
merged 1 commit into from
Sep 6, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
k8s.io/component-base v0.25.0
k8s.io/component-helpers v0.25.0
k8s.io/klog/v2 v2.70.1
k8s.io/kubectl v0.25.0
k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73
sigs.k8s.io/mdtoc v1.0.1
)
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,6 @@ k8s.io/klog/v2 v2.70.1 h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ=
k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 h1:MQ8BAZPZlWk3S9K4a9NCkIFQtZShWqoha7snGixVgEA=
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU=
k8s.io/kubectl v0.25.0 h1:/Wn1cFqo8ik3iee1EvpxYre3bkWsGLXzLQI6uCCAkQc=
k8s.io/kubectl v0.25.0/go.mod h1:n16ULWsOl2jmQpzt2o7Dud1t4o0+Y186ICb4O+GwKAU=
k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 h1:H9TCJUUx+2VA0ZiD9lvtaX8fthFsMoD+Izn93E/hm8U=
k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
coreinformers "k8s.io/client-go/informers/core/v1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/events"
v1qos "k8s.io/kubectl/pkg/util/qos"
"k8s.io/utils/pointer"
"sigs.k8s.io/descheduler/cmd/descheduler/app/options"
"sigs.k8s.io/descheduler/pkg/api"
Expand Down Expand Up @@ -1327,6 +1326,11 @@ func computeCPUMemFraction(t *testing.T, cs clientset.Interface, node *v1.Node,
for _, pod := range allpods.Items {
if pod.Spec.NodeName == node.Name {
req, _ := utils.PodRequestsAndLimits(&pod)
// Ignore best effort pods while computing fractions as they won't be taken in account by scheduler.
if utils.GetPodQOS(&pod) == v1.PodQOSBestEffort {
t.Logf("Ignoring best-effort pod %s on node %s", pod.Name, pod.Spec.NodeName)
continue
}
if _, ok := req[v1.ResourceCPU]; !ok {
req[v1.ResourceCPU] = *resource.NewMilliQuantity(0, resource.DecimalSI)
}
Expand All @@ -1337,11 +1341,7 @@ func computeCPUMemFraction(t *testing.T, cs clientset.Interface, node *v1.Node,
cpuRequest := req[v1.ResourceCPU]
memoryRequest := req[v1.ResourceMemory]

t.Logf("Pod for on the node: %v, Cpu: %v, Mem: %v", pod.Name, (&cpuRequest).MilliValue(), (&memoryRequest).Value())
// Ignore best effort pods while computing fractions as they won't be taken in account by scheduler.
if v1qos.GetPodQOS(&pod) == v1.PodQOSBestEffort {
continue
}
t.Logf("Pod %s on node %s, Cpu: %v, Mem: %v", pod.Name, pod.Spec.NodeName, (&cpuRequest).MilliValue(), (&memoryRequest).Value())
totalRequestedCPUResource += (&cpuRequest).MilliValue()
totalRequestedMemResource += (&memoryRequest).Value()
}
Expand Down
201 changes: 0 additions & 201 deletions vendor/k8s.io/kubectl/LICENSE

This file was deleted.

98 changes: 0 additions & 98 deletions vendor/k8s.io/kubectl/pkg/util/qos/qos.go

This file was deleted.

3 changes: 0 additions & 3 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1126,9 +1126,6 @@ k8s.io/kube-openapi/pkg/util
k8s.io/kube-openapi/pkg/util/proto
k8s.io/kube-openapi/pkg/util/sets
k8s.io/kube-openapi/pkg/validation/spec
# k8s.io/kubectl v0.25.0
## explicit; go 1.19
k8s.io/kubectl/pkg/util/qos
# k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73
## explicit; go 1.12
k8s.io/utils/buffer
Expand Down