Skip to content

Commit 379bff8

Browse files
committed
Fix pod scale down failure in EventHandlingPodUpdate scheduler_perf test case
1 parent 530278b commit 379bff8

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

test/integration/scheduler_perf/event_handling/performance-config.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,20 @@
228228
stageRequirement: Attempted
229229
labelSelector:
230230
type: unsched
231-
# Update blocker pods' labels and scale down their resource requests
232-
# to make the unschedulable pods schedulable.
231+
# Update blocker pods' labels to make the unschedulable pods schedulable.
233232
- opcode: updateAny
234233
countParam: $blockerPods
235234
templatePath: templates/podupdate-pod-blocker-update.yaml
236235
updatePerSecond: 100
237236
namespace: blocker
237+
# Scale down blocker pods' resource requests to make the unschedulable pods schedulable.
238+
- opcode: updateAny
239+
countParam: $blockerPods
240+
templatePath: templates/podupdate-pod-blocker-scale-down.yaml
241+
updatePerSecond: 100
242+
namespace: blocker
243+
subresources:
244+
- resize
238245
# Update pods blocked by SchedulingGates by removing the gate from themselves.
239246
- opcode: updateAny
240247
countParam: $measurePods
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: pod-blocker-{{ .Index }}
5+
spec:
6+
containers:
7+
- image: registry.k8s.io/pause:3.10
8+
name: pause
9+
resources:
10+
requests:
11+
cpu: 0.0001
12+
memory: 1Mi
13+
nodeName: scheduler-perf-node

test/integration/scheduler_perf/event_handling/templates/podupdate-pod-blocker-update.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ spec:
99
resources:
1010
requests:
1111
cpu: 0.0001
12-
memory: 1Mi
12+
memory: {{ div 30000 .Count }}Mi
1313
nodeName: scheduler-perf-node

test/integration/scheduler_perf/update.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ type updateAny struct {
4949
UpdatePerSecond int
5050
// Internal field of the struct used for caching the mapping.
5151
cachedMapping *meta.RESTMapping
52+
// List of subresources to update.
53+
// If empty, update operation is performed on the actual resource.
54+
// Optional
55+
Subresources []string
5256
}
5357

5458
var _ runnableOp = &updateAny{}
@@ -145,7 +149,7 @@ func (c *updateAny) update(tCtx ktesting.TContext, env map[string]any) error {
145149
if c.cachedMapping.Scope.Name() != meta.RESTScopeNameNamespace {
146150
return fmt.Errorf("namespace %q set for %q, but %q has scope %q", c.Namespace, c.TemplatePath, c.cachedMapping.GroupVersionKind, c.cachedMapping.Scope.Name())
147151
}
148-
_, err := resourceClient.Namespace(c.Namespace).Update(tCtx, obj, options)
152+
_, err := resourceClient.Namespace(c.Namespace).Update(tCtx, obj, options, c.Subresources...)
149153
if err != nil {
150154
return fmt.Errorf("failed to update object in namespace %q: %w", c.Namespace, err)
151155
}
@@ -158,7 +162,7 @@ func (c *updateAny) update(tCtx ktesting.TContext, env map[string]any) error {
158162
if c.cachedMapping.Scope.Name() != meta.RESTScopeNameRoot {
159163
return fmt.Errorf("namespace not set for %q, but %q has scope %q", c.TemplatePath, c.cachedMapping.GroupVersionKind, c.cachedMapping.Scope.Name())
160164
}
161-
_, err := resourceClient.Update(tCtx, obj, options)
165+
_, err := resourceClient.Update(tCtx, obj, options, c.Subresources...)
162166
if err != nil {
163167
return fmt.Errorf("failed to update object: %w", err)
164168
}

0 commit comments

Comments
 (0)