mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Add new CPUManager policy option for "distribute-cpus-across-numa"
This commit only adds the option to the policy options framework. A subsequent commit will add the logic to utilize it. The KEP describing this new option can be found here: https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2902-cpumanager-distribute-cpus-policy-option Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
0cef26182c
commit
0e7928edce
@ -26,12 +26,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// FullPCPUsOnlyOption is the name of the CPU Manager policy option
|
|
||||||
FullPCPUsOnlyOption string = "full-pcpus-only"
|
FullPCPUsOnlyOption string = "full-pcpus-only"
|
||||||
|
DistributeCPUsAcrossNUMAOption string = "distribute-cpus-across-numa"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
alphaOptions = sets.NewString()
|
alphaOptions = sets.NewString(
|
||||||
|
DistributeCPUsAcrossNUMAOption,
|
||||||
|
)
|
||||||
betaOptions = sets.NewString(
|
betaOptions = sets.NewString(
|
||||||
FullPCPUsOnlyOption,
|
FullPCPUsOnlyOption,
|
||||||
)
|
)
|
||||||
@ -64,6 +66,9 @@ type StaticPolicyOptions struct {
|
|||||||
// any possible naming scheme will lead to ambiguity to some extent.
|
// any possible naming scheme will lead to ambiguity to some extent.
|
||||||
// We picked "pcpu" because it the established docs hints at vCPU already.
|
// We picked "pcpu" because it the established docs hints at vCPU already.
|
||||||
FullPhysicalCPUsOnly bool
|
FullPhysicalCPUsOnly bool
|
||||||
|
// Flag to evenly distribute CPUs across NUMA nodes in cases where more
|
||||||
|
// than one NUMA node is required to satisfy the allocation.
|
||||||
|
DistributeCPUsAcrossNUMA bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStaticPolicyOptions(policyOptions map[string]string) (StaticPolicyOptions, error) {
|
func NewStaticPolicyOptions(policyOptions map[string]string) (StaticPolicyOptions, error) {
|
||||||
@ -80,6 +85,12 @@ func NewStaticPolicyOptions(policyOptions map[string]string) (StaticPolicyOption
|
|||||||
return opts, fmt.Errorf("bad value for option %q: %w", name, err)
|
return opts, fmt.Errorf("bad value for option %q: %w", name, err)
|
||||||
}
|
}
|
||||||
opts.FullPhysicalCPUsOnly = optValue
|
opts.FullPhysicalCPUsOnly = optValue
|
||||||
|
case DistributeCPUsAcrossNUMAOption:
|
||||||
|
optValue, err := strconv.ParseBool(value)
|
||||||
|
if err != nil {
|
||||||
|
return opts, fmt.Errorf("bad value for option %q: %w", name, err)
|
||||||
|
}
|
||||||
|
opts.DistributeCPUsAcrossNUMA = optValue
|
||||||
default:
|
default:
|
||||||
// this should never be reached, we already detect unknown options,
|
// this should never be reached, we already detect unknown options,
|
||||||
// but we keep it as further safety.
|
// but we keep it as further safety.
|
||||||
|
Loading…
Reference in New Issue
Block a user