Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dba0508

Browse filesBrowse files
committed
Address comments on Scheduler_perf updates
1 parent 4529b47 commit dba0508
Copy full SHA for dba0508

File tree

Expand file treeCollapse file tree

1 file changed

+46
-15
lines changed
Filter options
  • test/integration/scheduler_perf
Expand file treeCollapse file tree

1 file changed

+46
-15
lines changed

‎test/integration/scheduler_perf/dra.go

Copy file name to clipboardExpand all lines: test/integration/scheduler_perf/dra.go
+46-15Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ func resourceSlice(driverName, nodeName string, capacity int) *resourceapi.Resou
238238
Capacity: map[resourceapi.QualifiedName]resourceapi.DeviceCapacity{
239239
"memory": {Value: resource.MustParse("1Gi")},
240240
},
241+
// These fields are only used when the "BindingConditions" feature gate is enabled.
242+
// When the feature gate is off, these fields are stripped to ensure backward compatibility.
241243
UsageRestrictedToNode: ptr.To(true),
242244
BindingConditions: []string{"DeviceAttached"},
243245
BindingFailureConditions: []string{"AttachmentFailed"},
@@ -372,14 +374,28 @@ claims:
372374
}
373375
}
374376

377+
// updateDeviceConditionsOp defines an op where device conditions are updated.
378+
// This is used to test the device binding conditions.
379+
// The conditions are set on the device status of the resource claim.
375380
type updateDeviceConditionsOp struct {
376-
Opcode operationCode
377-
Namespace string
378-
ConditionTypeParam string
381+
// Must be updateDeviceConditionsOpcode.
382+
Opcode operationCode
383+
// Namespace where the claims are located.
384+
Namespace string
385+
// Conditions to set on the devices.
386+
ConditionTypeParam string
387+
// ConditionStatusParam is the parameter for the condition status.
388+
// The condition status must be one of "True", "False", or "Unknown".
379389
ConditionStatusParam string
380-
Conditions []metav1.Condition
381-
Duration metav1.Duration
382-
DurationParam string
390+
// Conditions to set on the devices. This is parameterized through
391+
// ConditionTypeParam and ConditionStatusParam.
392+
Conditions []metav1.Condition
393+
// Duration for the test.
394+
Duration metav1.Duration
395+
// DurationParam is the parameter for the duration.
396+
// If set, the duration is parameterized through this parameter.
397+
// The duration is used to wait for the conditions to be set.
398+
DurationParam string
383399
}
384400

385401
func (op *updateDeviceConditionsOp) isValid(allowParameterization bool) error {
@@ -389,12 +405,13 @@ func (op *updateDeviceConditionsOp) isValid(allowParameterization bool) error {
389405
if op.Conditions == nil && (op.ConditionTypeParam == "" || op.ConditionStatusParam == "") {
390406
return fmt.Errorf("conditions must be set")
391407
}
392-
if op.Namespace == "" || op.ConditionTypeParam == "" {
393-
return fmt.Errorf("namespace and conditions must be set")
408+
if op.ConditionStatusParam != "" && op.ConditionTypeParam == "" {
409+
return fmt.Errorf("ConditionStatusParam must be set together with ConditionTypeParam")
394410
}
395-
if op.Namespace == "" || op.ConditionTypeParam == "" {
396-
return fmt.Errorf("namespace and conditions must be set")
411+
if op.ConditionTypeParam != "" && op.ConditionStatusParam == "" {
412+
return fmt.Errorf("ConditionTypeParam must be set together with ConditionStatusParam")
397413
}
414+
398415
return nil
399416
}
400417

@@ -532,12 +549,26 @@ func makeBindingConditions(driver, pool, device, condition string, status metav1
532549
}
533550
}
534551

552+
// checkPodScheduledOp defines an op that checks if all pods in a namespace are scheduled
553+
// or unscheduled. This is used to test the device binding conditions.
554+
// The check is done by listing all pods in the namespace and checking their status.
535555
type checkPodScheduledOp struct {
536-
Opcode operationCode
537-
Namespace string
538-
Duration metav1.Duration
539-
DurationParam string
540-
ScheduledParam string
556+
// Must be checkPodScheduledOpcode.
557+
Opcode operationCode
558+
// Namespace where the pods are located.
559+
Namespace string
560+
// Duration for the test.
561+
Duration metav1.Duration
562+
// DurationParam is the parameter for the duration.
563+
// If set, the duration is parameterized through this parameter.
564+
DurationParam string
565+
// ScheduledParam is the parameter for the expected scheduled state.
566+
// If set, the expected scheduled state is parameterized through this parameter.
567+
ScheduledParam string
568+
// ExpectedScheduled is the expected scheduled state.
569+
// If true, the op checks if all pods are scheduled.
570+
// If false, the op checks if all pods are unscheduled.
571+
// This is used to test the device binding conditions.
541572
ExpectedScheduled bool
542573
}
543574

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.