Skip to content

Commit 10651ad

Browse files
committed
adapt to k/k interface changes in 0.26.2
Signed-off-by: pprokop <[email protected]>
1 parent 679a09e commit 10651ad

File tree

11 files changed

+91
-72
lines changed

11 files changed

+91
-72
lines changed

apis/config/scheme/scheme_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ profiles:
7777
weight: 1
7878
- name: TargetLoadPacking
7979
args:
80-
targetUtilization: 60
80+
targetUtilization: 60
8181
defaultRequests:
8282
cpu: "1000m"
8383
defaultRequestsMultiplier: "1.8"
8484
watcherAddress: http://deadbeef:2020
85-
metricProvider:
85+
metricProvider:
8686
type: Prometheus
8787
address: http://prometheus-k8s.monitoring.svc.cluster.local:9090
8888
- name: LoadVariationRiskBalancing
@@ -720,7 +720,6 @@ leaderElection:
720720
retryPeriod: 0s
721721
metricsBindAddress: ""
722722
parallelism: 0
723-
percentageOfNodesToScore: 0
724723
podInitialBackoffSeconds: 0
725724
podMaxBackoffSeconds: 0
726725
profiles:
@@ -861,7 +860,6 @@ leaderElection:
861860
resourceNamespace: ""
862861
retryPeriod: 0s
863862
parallelism: 0
864-
percentageOfNodesToScore: 0
865863
podInitialBackoffSeconds: 0
866864
podMaxBackoffSeconds: 0
867865
profiles:
@@ -1016,7 +1014,6 @@ leaderElection:
10161014
resourceNamespace: ""
10171015
retryPeriod: 0s
10181016
parallelism: 0
1019-
percentageOfNodesToScore: 0
10201017
podInitialBackoffSeconds: 0
10211018
podMaxBackoffSeconds: 0
10221019
profiles:

pkg/capacityscheduling/capacity_scheduling.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ import (
2828
"k8s.io/apimachinery/pkg/labels"
2929
"k8s.io/apimachinery/pkg/runtime"
3030
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
31-
utilfeature "k8s.io/apiserver/pkg/util/feature"
3231
"k8s.io/client-go/informers"
3332
corelisters "k8s.io/client-go/listers/core/v1"
3433
policylisters "k8s.io/client-go/listers/policy/v1"
3534
"k8s.io/client-go/tools/cache"
3635
corev1helpers "k8s.io/component-helpers/scheduling/corev1"
3736
"k8s.io/klog/v2"
3837
extenderv1 "k8s.io/kube-scheduler/extender/v1"
39-
kubefeatures "k8s.io/kubernetes/pkg/features"
4038
"k8s.io/kubernetes/pkg/scheduler/framework"
4139
"k8s.io/kubernetes/pkg/scheduler/framework/preemption"
4240
"k8s.io/kubernetes/pkg/scheduler/metrics"
@@ -833,7 +831,7 @@ func computePodResourceRequest(pod *v1.Pod) *framework.Resource {
833831
}
834832

835833
// If Overhead is being utilized, add to the total requests for the pod
836-
if pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(kubefeatures.PodOverhead) {
834+
if pod.Spec.Overhead != nil {
837835
result.Add(pod.Spec.Overhead)
838836
}
839837

pkg/controller/elasticquota.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
"k8s.io/apimachinery/pkg/util/runtime"
3333
"k8s.io/apimachinery/pkg/util/wait"
3434
quota "k8s.io/apiserver/pkg/quota/v1"
35-
utilfeature "k8s.io/apiserver/pkg/util/feature"
3635
coreinformer "k8s.io/client-go/informers/core/v1"
3736
"k8s.io/client-go/kubernetes"
3837
"k8s.io/client-go/kubernetes/scheme"
@@ -42,7 +41,6 @@ import (
4241
"k8s.io/client-go/tools/record"
4342
"k8s.io/client-go/util/workqueue"
4443
"k8s.io/klog/v2"
45-
kubefeatures "k8s.io/kubernetes/pkg/features"
4644
"sigs.k8s.io/scheduler-plugins/pkg/util"
4745

4846
schedv1alpha1 "sigs.k8s.io/scheduler-plugins/apis/scheduling/v1alpha1"
@@ -324,7 +322,7 @@ func computePodResourceRequest(pod *v1.Pod) v1.ResourceList {
324322
initRes = quota.Max(initRes, container.Resources.Requests)
325323
}
326324
// If Overhead is being utilized, add to the total requests for the pod
327-
if pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(kubefeatures.PodOverhead) {
325+
if pod.Spec.Overhead != nil {
328326
quota.Add(result, pod.Spec.Overhead)
329327
}
330328
// take max_resource for init_containers and containers

pkg/coscheduling/coscheduling_test.go

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"sigs.k8s.io/scheduler-plugins/pkg/coscheduling/core"
3737
fakepgclientset "sigs.k8s.io/scheduler-plugins/pkg/generated/clientset/versioned/fake"
3838
pgformers "sigs.k8s.io/scheduler-plugins/pkg/generated/informers/externalversions"
39+
"sigs.k8s.io/scheduler-plugins/test/util"
3940
testutil "sigs.k8s.io/scheduler-plugins/test/util"
4041
)
4142

@@ -100,87 +101,87 @@ func TestLess(t *testing.T) {
100101
{
101102
name: "p1.priority less than p2.priority",
102103
p1: &framework.QueuedPodInfo{
103-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(lowPriority).Obj()),
104+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(lowPriority).Obj()),
104105
},
105106
p2: &framework.QueuedPodInfo{
106-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
107+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
107108
},
108109
expected: false, // p2 should be ahead of p1 in the queue
109110
},
110111
{
111112
name: "p1.priority greater than p2.priority",
112113
p1: &framework.QueuedPodInfo{
113-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Obj()),
114+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Obj()),
114115
},
115116
p2: &framework.QueuedPodInfo{
116-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(lowPriority).Obj()),
117+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(lowPriority).Obj()),
117118
},
118119
expected: true, // p1 should be ahead of p2 in the queue
119120
},
120121
{
121122
name: "equal priority. p1 is added to schedulingQ earlier than p2",
122123
p1: &framework.QueuedPodInfo{
123-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Obj()),
124+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Obj()),
124125
InitialAttemptTimestamp: times[0],
125126
},
126127
p2: &framework.QueuedPodInfo{
127-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
128+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
128129
InitialAttemptTimestamp: times[1],
129130
},
130131
expected: true, // p1 should be ahead of p2 in the queue
131132
},
132133
{
133134
name: "equal priority. p2 is added to schedulingQ earlier than p1",
134135
p1: &framework.QueuedPodInfo{
135-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Obj()),
136+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Obj()),
136137
InitialAttemptTimestamp: times[1],
137138
},
138139
p2: &framework.QueuedPodInfo{
139-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
140+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
140141
InitialAttemptTimestamp: times[0],
141142
},
142143
expected: false, // p2 should be ahead of p1 in the queue
143144
},
144145
{
145146
name: "p1.priority less than p2.priority, p1 belongs to podGroup1",
146147
p1: &framework.QueuedPodInfo{
147-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(lowPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
148+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(lowPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
148149
},
149150
p2: &framework.QueuedPodInfo{
150-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
151+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
151152
},
152153
expected: false, // p2 should be ahead of p1 in the queue
153154
},
154155
{
155156
name: "p1.priority greater than p2.priority, p1 belongs to podGroup1",
156157
p1: &framework.QueuedPodInfo{
157-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
158+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
158159
},
159160
p2: &framework.QueuedPodInfo{
160-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(lowPriority).Obj()),
161+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(lowPriority).Obj()),
161162
},
162163
expected: true, // p1 should be ahead of p2 in the queue
163164
},
164165
{
165166
name: "equal priority. p1 is added to schedulingQ earlier than p2, p1 belongs to podGroup3",
166167
p1: &framework.QueuedPodInfo{
167-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg3").Obj()),
168+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg3").Obj()),
168169
InitialAttemptTimestamp: times[0],
169170
},
170171
p2: &framework.QueuedPodInfo{
171-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
172+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
172173
InitialAttemptTimestamp: times[1],
173174
},
174175
expected: true, // p1 should be ahead of p2 in the queue
175176
},
176177
{
177178
name: "equal priority. p2 is added to schedulingQ earlier than p1, p1 belongs to podGroup3",
178179
p1: &framework.QueuedPodInfo{
179-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg3").Obj()),
180+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg3").Obj()),
180181
InitialAttemptTimestamp: times[1],
181182
},
182183
p2: &framework.QueuedPodInfo{
183-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
184+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Obj()),
184185
InitialAttemptTimestamp: times[0],
185186
},
186187
expected: false, // p2 should be ahead of p1 in the queue
@@ -189,67 +190,67 @@ func TestLess(t *testing.T) {
189190
{
190191
name: "p1.priority less than p2.priority, p1 belongs to podGroup1 and p2 belongs to podGroup2",
191192
p1: &framework.QueuedPodInfo{
192-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(lowPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
193+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(lowPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
193194
},
194195
p2: &framework.QueuedPodInfo{
195-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
196+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
196197
},
197198
expected: false, // p2 should be ahead of p1 in the queue
198199
},
199200
{
200201
name: "p1.priority greater than p2.priority, p1 belongs to podGroup1 and p2 belongs to podGroup2",
201202
p1: &framework.QueuedPodInfo{
202-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
203+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
203204
},
204205
p2: &framework.QueuedPodInfo{
205-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(lowPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
206+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(lowPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
206207
},
207208
expected: true, // p1 should be ahead of p2 in the queue
208209
},
209210
{
210211
name: "equal priority. p1 is added to schedulingQ earlier than p2, p1 belongs to podGroup1 and p2 belongs to podGroup2",
211212
p1: &framework.QueuedPodInfo{
212-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
213+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
213214
InitialAttemptTimestamp: times[0],
214215
},
215216
p2: &framework.QueuedPodInfo{
216-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
217+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
217218
InitialAttemptTimestamp: times[1],
218219
},
219220
expected: true, // p1 should be ahead of p2 in the queue
220221
},
221222
{
222223
name: "equal priority. p2 is added to schedulingQ earlier than p1, p1 belongs to podGroup4 and p2 belongs to podGroup3",
223224
p1: &framework.QueuedPodInfo{
224-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg4").Obj()),
225+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg4").Obj()),
225226
InitialAttemptTimestamp: times[1],
226227
},
227228
p2: &framework.QueuedPodInfo{
228-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg3").Obj()),
229+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg3").Obj()),
229230
InitialAttemptTimestamp: times[0],
230231
},
231232
expected: false, // p2 should be ahead of p1 in the queue
232233
},
233234
{
234235
name: "equal priority and creation time, p1 belongs to podGroup1 and p2 belongs to podGroup2",
235236
p1: &framework.QueuedPodInfo{
236-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
237+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg1").Obj()),
237238
InitialAttemptTimestamp: times[0],
238239
},
239240
p2: &framework.QueuedPodInfo{
240-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
241+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
241242
InitialAttemptTimestamp: times[0],
242243
},
243244
expected: true, // p1 should be ahead of p2 in the queue
244245
},
245246
{
246247
name: "equal priority and creation time, p2 belong to podGroup2",
247248
p1: &framework.QueuedPodInfo{
248-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Obj()),
249+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns1).Name("pod1").Priority(highPriority).Obj()),
249250
InitialAttemptTimestamp: times[0],
250251
},
251252
p2: &framework.QueuedPodInfo{
252-
PodInfo: framework.NewPodInfo(st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
253+
PodInfo: util.MustNewPodInfo(t, st.MakePod().Namespace(ns2).Name("pod2").Priority(highPriority).Label(v1alpha1.PodGroupLabel, "pg2").Obj()),
253254
InitialAttemptTimestamp: times[0],
254255
},
255256
expected: true, // p1 should be ahead of p2 in the queue

pkg/networkaware/topologicalsort/topologicalsort_test.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"k8s.io/client-go/util/workqueue"
3131
"k8s.io/kubernetes/pkg/scheduler/framework"
3232
st "k8s.io/kubernetes/pkg/scheduler/testing"
33+
testutil "sigs.k8s.io/scheduler-plugins/test/util"
3334

3435
agv1alpha1 "github.com/diktyo-io/appgroup-api/pkg/apis/appgroup/v1alpha1"
3536
agfake "github.com/diktyo-io/appgroup-api/pkg/generated/clientset/versioned/fake"
@@ -193,10 +194,10 @@ func TestTopologicalSortLess(t *testing.T) {
193194
podPhase: v1.PodRunning,
194195
topologySortingAlgorithm: "KahnSort",
195196
pInfo1: &framework.QueuedPodInfo{
196-
PodInfo: framework.NewPodInfo(makePod("p1", "p1-deployment", 0, "basic", nil, nil)),
197+
PodInfo: testutil.MustNewPodInfo(t, makePod("p1", "p1-deployment", 0, "basic", nil, nil)),
197198
},
198199
pInfo2: &framework.QueuedPodInfo{
199-
PodInfo: framework.NewPodInfo(makePod("p2", "p2-deployment", 0, "basic", nil, nil)),
200+
PodInfo: testutil.MustNewPodInfo(t, makePod("p2", "p2-deployment", 0, "basic", nil, nil)),
200201
},
201202
desiredTopologyOrder: basicAppGroup.Status.TopologyOrder,
202203
want: true,
@@ -213,10 +214,10 @@ func TestTopologicalSortLess(t *testing.T) {
213214
podPhase: v1.PodRunning,
214215
topologySortingAlgorithm: "KahnSort",
215216
pInfo1: &framework.QueuedPodInfo{
216-
PodInfo: framework.NewPodInfo(makePod("p5", "p5-deployment", 0, "onlineboutique", nil, nil)),
217+
PodInfo: testutil.MustNewPodInfo(t, makePod("p5", "p5-deployment", 0, "onlineboutique", nil, nil)),
217218
},
218219
pInfo2: &framework.QueuedPodInfo{
219-
PodInfo: framework.NewPodInfo(makePod("p1", "p1-deployment", 0, "onlineboutique", nil, nil)),
220+
PodInfo: testutil.MustNewPodInfo(t, makePod("p1", "p1-deployment", 0, "onlineboutique", nil, nil)),
220221
},
221222
desiredTopologyOrder: onlineBoutiqueAppGroup.Status.TopologyOrder,
222223
want: false,
@@ -233,10 +234,10 @@ func TestTopologicalSortLess(t *testing.T) {
233234
podPhase: v1.PodRunning,
234235
topologySortingAlgorithm: "TarjanSort",
235236
pInfo1: &framework.QueuedPodInfo{
236-
PodInfo: framework.NewPodInfo(makePod("p1", "p1-deployment", 0, "basic", nil, nil)),
237+
PodInfo: testutil.MustNewPodInfo(t, makePod("p1", "p1-deployment", 0, "basic", nil, nil)),
237238
},
238239
pInfo2: &framework.QueuedPodInfo{
239-
PodInfo: framework.NewPodInfo(makePod("p5", "p5-deployment", 0, "other", nil, nil)),
240+
PodInfo: testutil.MustNewPodInfo(t, makePod("p5", "p5-deployment", 0, "other", nil, nil)),
240241
},
241242
desiredTopologyOrder: basicAppGroup.Status.TopologyOrder,
242243
want: false,
@@ -459,8 +460,8 @@ func BenchmarkTopologicalSortPlugin(b *testing.B) {
459460
namespaces: []string{metav1.NamespaceDefault},
460461
}
461462

462-
pInfo1 := getPodInfos(tt.podNum, tt.agName, tt.selectors, tt.deploymentNames)
463-
pInfo2 := getPodInfos(tt.podNum, tt.agName, tt.selectors, tt.deploymentNames)
463+
pInfo1 := getPodInfos(b, tt.podNum, tt.agName, tt.selectors, tt.deploymentNames)
464+
pInfo2 := getPodInfos(b, tt.podNum, tt.agName, tt.selectors, tt.deploymentNames)
464465

465466
//b.Logf("len(pInfo1): %v", len(pInfo1))
466467
//b.Logf("len(pInfo2): %v", len(pInfo2))
@@ -480,12 +481,12 @@ func randomInt(min int, max int) int {
480481
return min + rand.Intn(max-min)
481482
}
482483

483-
func getPodInfos(podsNum int, agName string, selectors []string, podNames []string) (pInfo []*framework.QueuedPodInfo) {
484+
func getPodInfos(b *testing.B, podsNum int, agName string, selectors []string, podNames []string) (pInfo []*framework.QueuedPodInfo) {
484485
pInfo = []*framework.QueuedPodInfo{}
485486

486487
for i := 0; i < podsNum; i++ {
487488
random := randomInt(0, len(podNames))
488-
pInfo = append(pInfo, &framework.QueuedPodInfo{PodInfo: framework.NewPodInfo(makePod(selectors[random], podNames[random], 0, agName, nil, nil))})
489+
pInfo = append(pInfo, &framework.QueuedPodInfo{PodInfo: testutil.MustNewPodInfo(b, makePod(selectors[random], podNames[random], 0, agName, nil, nil))})
489490
}
490491
return pInfo
491492
}

pkg/noderesources/resource_allocation.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ package noderesources
2121

2222
import (
2323
v1 "k8s.io/api/core/v1"
24-
utilfeature "k8s.io/apiserver/pkg/util/feature"
2524
"k8s.io/klog/v2"
26-
"k8s.io/kubernetes/pkg/features"
2725
"k8s.io/kubernetes/pkg/scheduler/framework"
2826
schedutil "k8s.io/kubernetes/pkg/scheduler/util"
2927
)
@@ -120,7 +118,7 @@ func calculatePodResourceRequest(pod *v1.Pod, resource v1.ResourceName) int64 {
120118
}
121119

122120
// If Overhead is being utilized, add to the total requests for the pod
123-
if pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) {
121+
if pod.Spec.Overhead != nil {
124122
if quantity, found := pod.Spec.Overhead[resource]; found {
125123
podRequest += quantity.Value()
126124
}

0 commit comments

Comments
 (0)