Repository: kubernetes/kubernetes
File: test/integration/scheduler_perf/scheduler_perf.go (Go)

Code before:
		cmo.Count, err = w.Params.get(cmo.CountParam[1:])
		if err != nil {
			return nil, err
		}
	}
	return &cmo, (&cmo).isValid(false)
}

// createPodsOp defines an op where pods are scheduled as a part of a workload.
// The test can block on the completion of this op before moving forward or
// continue asynchronously.
type createPodsOp struct {
	// Must be "createPods".
	Opcode operationCode
	// Number of pods to schedule. Parameterizable through CountParam.
	Count int
	// Template parameter for Count.
	CountParam string
	// If false, Count pods get created rapidly. This can be used to
	// measure how quickly the scheduler can fill up a cluster.
	//
	// If true, Count pods get created, the operation waits for
	// a pod to get scheduled, deletes it and then creates another.
	// This continues until the configured Duration is over.
	// Metrics collection, if enabled, runs in parallel.
	//
	// This mode can be used to measure how the scheduler behaves
	// in a steady state where the cluster is always at roughly the
	// same level of utilization. Pods can be created in a separate,
	// earlier operation to simulate non-empty clusters.
	//
	// Note that the operation will delete any scheduled pod in
	// the namespace, so use different namespaces for pods that
	// are supposed to be kept running.
	SteadyState bool
	// Template parameter for SteadyState.
	SteadyStateParam string
	// How long to keep the cluster in a steady state.
	Duration metav1.Duration
	// Template parameter for Duration.
	DurationParam string
	// Whether to enable metrics collection for this createPodsOp.
	// Optional. Both CollectMetrics and SkipWaitToCompletion cannot be true at
	// the same time for a particular createPodsOp.
	CollectMetrics bool
	// Namespace the pods should be created in. Defaults to a unique
	// namespace of the format "namespace-<number>".
	// Optional
	Namespace *string
	// Path to spec file describing the pods to schedule.
	// If nil, DefaultPodTemplatePath will be used.

Review comment (suggestion):
I know you filed https://github.com/kubernetes/kubernetes/issues/137007.

I need to look closer, but my gut reaction is that this is not the right place for this. If we have test cases which only have the stable allocator enabled, then those test cases should explicitly disable the `DRAConsumableCapacity` feature gate.


Code after:
	// Ensure that there are no leaked
	// goroutines.  They could influence
	// performance of the next benchmark.
	// This must *after* RedirectKlog
	// because then during cleanup, the
	// test will wait for goroutines to
	// quit *before* restoring klog settings.
	framework.GoleakCheck(t)

	// We need to set emulation version for QueueingHints feature gate, which is locked at 1.34.
	// Only emulate v1.33 when QueueingHints is explicitly disabled.
	if qhEnabled, exists := featureGates[features.SchedulerQueueingHints]; exists && !qhEnabled {
		featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.33"))
	} else if _, found := featureGates[features.OpportunisticBatching]; !found {
		if featureGates == nil {
			featureGates = map[featuregate.Feature]bool{}
		}
		featureGates[features.OpportunisticBatching] = false
	}
	featuregatetesting.SetFeatureGatesDuringTest(t, utilfeature.DefaultFeatureGate, featureGates)

	if opts.preRunFn != nil {
		if err := opts.preRunFn(tCtx); err != nil {
			t.Fatalf("pre-run: %v", err)
		}
	}

	// Now that we are ready to run, start
	// a brand new etcd.
	logger := tCtx.Logger()
	if !UseTestingLog {
		// Associate output going to the global log with the current test.
		logger = logger.WithName(tCtx.Name())
	}
	framework.StartEtcd(logger, t, true)

	// 30 minutes should be plenty enough even for the 5000-node tests.
	timeout := 30 * time.Minute
	tCtx = tCtx.WithTimeout(timeout, fmt.Sprintf("timed out after the %s per-test timeout", timeout))

	if utilfeature.DefaultFeatureGate.Enabled(features.SchedulerQueueingHints) {
		registerQHintMetrics()
		t.Cleanup(func() {
			unregisterQHintMetrics()
		})
	}

	return setupClusterForWorkload(tCtx, tc.SchedulerConfigPath, featureGates, opts)
}

func featureGatesMerge(src map[featuregate.Feature]bool, overrides map[featuregate.Feature]bool) map[featuregate.Feature]bool {