Skip to content

Commit

Permalink
Merge pull request kubernetes#128666 from macsko/fix_scale_down_in_ev…
Browse files Browse the repository at this point in the history
…enthandlingpodupdate_scheduler_perf_test_case

Fix pod scale down failure in EventHandlingPodUpdate scheduler_perf test
  • Loading branch information
k8s-ci-robot authored Nov 12, 2024
2 parents 6b031e5 + 379bff8 commit 8115bac
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,20 @@
stageRequirement: Attempted
labelSelector:
type: unsched
# Update blocker pods' labels and scale down their resource requests
# to make the unschedulable pods schedulable.
# Update blocker pods' labels to make the unschedulable pods schedulable.
- opcode: updateAny
countParam: $blockerPods
templatePath: templates/podupdate-pod-blocker-update.yaml
updatePerSecond: 100
namespace: blocker
# Scale down blocker pods' resource requests to make the unschedulable pods schedulable.
- opcode: updateAny
countParam: $blockerPods
templatePath: templates/podupdate-pod-blocker-scale-down.yaml
updatePerSecond: 100
namespace: blocker
subresources:
- resize
# Update pods blocked by SchedulingGates by removing the gate from themselves.
- opcode: updateAny
countParam: $measurePods
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Pod
metadata:
name: pod-blocker-{{ .Index }}
spec:
containers:
- image: registry.k8s.io/pause:3.10
name: pause
resources:
requests:
cpu: 0.0001
memory: 1Mi
nodeName: scheduler-perf-node
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ spec:
resources:
requests:
cpu: 0.0001
memory: 1Mi
memory: {{ div 30000 .Count }}Mi
nodeName: scheduler-perf-node
8 changes: 6 additions & 2 deletions test/integration/scheduler_perf/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ type updateAny struct {
UpdatePerSecond int
// Internal field of the struct used for caching the mapping.
cachedMapping *meta.RESTMapping
// List of subresources to update.
// If empty, update operation is performed on the actual resource.
// Optional
Subresources []string
}

var _ runnableOp = &updateAny{}
Expand Down Expand Up @@ -145,7 +149,7 @@ func (c *updateAny) update(tCtx ktesting.TContext, env map[string]any) error {
if c.cachedMapping.Scope.Name() != meta.RESTScopeNameNamespace {
return fmt.Errorf("namespace %q set for %q, but %q has scope %q", c.Namespace, c.TemplatePath, c.cachedMapping.GroupVersionKind, c.cachedMapping.Scope.Name())
}
_, err := resourceClient.Namespace(c.Namespace).Update(tCtx, obj, options)
_, err := resourceClient.Namespace(c.Namespace).Update(tCtx, obj, options, c.Subresources...)
if err != nil {
return fmt.Errorf("failed to update object in namespace %q: %w", c.Namespace, err)
}
Expand All @@ -158,7 +162,7 @@ func (c *updateAny) update(tCtx ktesting.TContext, env map[string]any) error {
if c.cachedMapping.Scope.Name() != meta.RESTScopeNameRoot {
return fmt.Errorf("namespace not set for %q, but %q has scope %q", c.TemplatePath, c.cachedMapping.GroupVersionKind, c.cachedMapping.Scope.Name())
}
_, err := resourceClient.Update(tCtx, obj, options)
_, err := resourceClient.Update(tCtx, obj, options, c.Subresources...)
if err != nil {
return fmt.Errorf("failed to update object: %w", err)
}
Expand Down

0 comments on commit 8115bac

Please sign in to comment.