mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
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:
commit
8115baca00
@ -228,13 +228,20 @@
|
|||||||
stageRequirement: Attempted
|
stageRequirement: Attempted
|
||||||
labelSelector:
|
labelSelector:
|
||||||
type: unsched
|
type: unsched
|
||||||
# Update blocker pods' labels and scale down their resource requests
|
# Update blocker pods' labels to make the unschedulable pods schedulable.
|
||||||
# to make the unschedulable pods schedulable.
|
|
||||||
- opcode: updateAny
|
- opcode: updateAny
|
||||||
countParam: $blockerPods
|
countParam: $blockerPods
|
||||||
templatePath: templates/podupdate-pod-blocker-update.yaml
|
templatePath: templates/podupdate-pod-blocker-update.yaml
|
||||||
updatePerSecond: 100
|
updatePerSecond: 100
|
||||||
namespace: blocker
|
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.
|
# Update pods blocked by SchedulingGates by removing the gate from themselves.
|
||||||
- opcode: updateAny
|
- opcode: updateAny
|
||||||
countParam: $measurePods
|
countParam: $measurePods
|
||||||
|
@ -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
|
@ -9,5 +9,5 @@ spec:
|
|||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 0.0001
|
cpu: 0.0001
|
||||||
memory: 1Mi
|
memory: {{ div 30000 .Count }}Mi
|
||||||
nodeName: scheduler-perf-node
|
nodeName: scheduler-perf-node
|
||||||
|
@ -49,6 +49,10 @@ type updateAny struct {
|
|||||||
UpdatePerSecond int
|
UpdatePerSecond int
|
||||||
// Internal field of the struct used for caching the mapping.
|
// Internal field of the struct used for caching the mapping.
|
||||||
cachedMapping *meta.RESTMapping
|
cachedMapping *meta.RESTMapping
|
||||||
|
// List of subresources to update.
|
||||||
|
// If empty, update operation is performed on the actual resource.
|
||||||
|
// Optional
|
||||||
|
Subresources []string
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ runnableOp = &updateAny{}
|
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 {
|
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())
|
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 {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to update object in namespace %q: %w", c.Namespace, err)
|
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 {
|
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())
|
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 {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to update object: %w", err)
|
return fmt.Errorf("failed to update object: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user