Merge pull request #128666 from macsko/fix_scale_down_in_eventhandlingpodupdate_scheduler_perf_test_case

Fix pod scale down failure in EventHandlingPodUpdate scheduler_perf test
This commit is contained in:
Kubernetes Prow Robot 2024-11-12 16:28:47 +00:00 committed by GitHub
commit 8115baca00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -9,5 +9,5 @@ spec:
resources:
requests:
cpu: 0.0001
memory: 1Mi
memory: {{ div 30000 .Count }}Mi
nodeName: scheduler-perf-node

View File

@ -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{}
@ -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)
}
@ -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)
}