Rename 'preferred' TopologyManager policy to 'best-effort'
This commit is contained in:
parent
10005d2e1e
commit
7eccc71c9e
@ -518,7 +518,7 @@ func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfig
|
||||
fs.StringVar(&c.CPUManagerPolicy, "cpu-manager-policy", c.CPUManagerPolicy, "CPU Manager policy to use. Possible values: 'none', 'static'. Default: 'none'")
|
||||
fs.DurationVar(&c.CPUManagerReconcilePeriod.Duration, "cpu-manager-reconcile-period", c.CPUManagerReconcilePeriod.Duration, "<Warning: Alpha feature> CPU Manager reconciliation period. Examples: '10s', or '1m'. If not supplied, defaults to `NodeStatusUpdateFrequency`")
|
||||
fs.Var(cliflag.NewMapStringString(&c.QOSReserved), "qos-reserved", "<Warning: Alpha feature> A set of ResourceName=Percentage (e.g. memory=50%) pairs that describe how pod resource requests are reserved at the QoS level. Currently only memory is supported. Requires the QOSReserved feature gate to be enabled.")
|
||||
fs.StringVar(&c.TopologyManagerPolicy, "topology-manager-policy", c.TopologyManagerPolicy, "Topology Manager policy to use. Possible values: 'none', 'preferred', 'strict'.")
|
||||
fs.StringVar(&c.TopologyManagerPolicy, "topology-manager-policy", c.TopologyManagerPolicy, "Topology Manager policy to use. Possible values: 'none', 'best-effort', 'strict'.")
|
||||
fs.DurationVar(&c.RuntimeRequestTimeout.Duration, "runtime-request-timeout", c.RuntimeRequestTimeout.Duration, "Timeout of all runtime requests except long running request - pull, logs, exec and attach. When timeout exceeded, kubelet will cancel the request, throw out an error and retry later.")
|
||||
fs.StringVar(&c.HairpinMode, "hairpin-mode", c.HairpinMode, "How should the kubelet setup hairpin NAT. This allows endpoints of a Service to loadbalance back to themselves if they should try to access their own Service. Valid values are \"promiscuous-bridge\", \"hairpin-veth\" and \"none\".")
|
||||
fs.Int32Var(&c.MaxPods, "max-pods", c.MaxPods, "Number of Pods that can run on this Kubelet.")
|
||||
|
@ -57,9 +57,9 @@ const (
|
||||
// StrictTopologyManagerPolicy is a mode in which kubelet only allows
|
||||
// pods with NUMA alignment of CPU and device resources.
|
||||
StrictTopologyManagerPolicy = "strict"
|
||||
// PreferredTopologyManagerPolicy is a mode in which kubelet will favour
|
||||
// BestEffortTopologyManagerPolicy is a mode in which kubelet will favour
|
||||
// pods with NUMA alignment of CPU and device resources.
|
||||
PreferredTopologyManagerPolicy = "preferred"
|
||||
BestEffortTopologyManagerPolicy = "best-effort"
|
||||
// NoneTopologyManager Policy is a mode in which kubelet has no knowledge
|
||||
// of NUMA alignment of a pod's CPU and device resources.
|
||||
NoneTopologyManagerPolicy = "none"
|
||||
|
@ -20,23 +20,23 @@ import (
|
||||
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
|
||||
)
|
||||
|
||||
type preferredPolicy struct{}
|
||||
type bestEffortPolicy struct{}
|
||||
|
||||
var _ Policy = &preferredPolicy{}
|
||||
var _ Policy = &bestEffortPolicy{}
|
||||
|
||||
// PolicyPreferred policy name.
|
||||
const PolicyPreferred string = "preferred"
|
||||
// PolicyBestEffort policy name.
|
||||
const PolicyBestEffort string = "best-effort"
|
||||
|
||||
// NewPreferredPolicy returns preferred policy.
|
||||
func NewPreferredPolicy() Policy {
|
||||
return &preferredPolicy{}
|
||||
// NewBestEffortPolicy returns best-effort policy.
|
||||
func NewBestEffortPolicy() Policy {
|
||||
return &bestEffortPolicy{}
|
||||
}
|
||||
|
||||
func (p *preferredPolicy) Name() string {
|
||||
return PolicyPreferred
|
||||
func (p *bestEffortPolicy) Name() string {
|
||||
return PolicyBestEffort
|
||||
}
|
||||
|
||||
func (p *preferredPolicy) CanAdmitPodResult(admit bool) lifecycle.PodAdmitResult {
|
||||
func (p *bestEffortPolicy) CanAdmitPodResult(admit bool) lifecycle.PodAdmitResult {
|
||||
return lifecycle.PodAdmitResult{
|
||||
Admit: true,
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPolicyPreferredCanAdmitPodResult(t *testing.T) {
|
||||
func TestPolicyBestEffortCanAdmitPodResult(t *testing.T) {
|
||||
tcases := []struct {
|
||||
name string
|
||||
admit bool
|
||||
@ -39,7 +39,7 @@ func TestPolicyPreferredCanAdmitPodResult(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tcases {
|
||||
policy := NewPreferredPolicy()
|
||||
policy := NewBestEffortPolicy()
|
||||
admit := tc.admit
|
||||
result := policy.CanAdmitPodResult(admit)
|
||||
|
||||
|
@ -82,8 +82,8 @@ func NewManager(topologyPolicyName string) (Manager, error) {
|
||||
case PolicyNone:
|
||||
policy = NewNonePolicy()
|
||||
|
||||
case PolicyPreferred:
|
||||
policy = NewPreferredPolicy()
|
||||
case PolicyBestEffort:
|
||||
policy = NewBestEffortPolicy()
|
||||
|
||||
case PolicyStrict:
|
||||
policy = NewStrictPolicy()
|
||||
|
@ -47,9 +47,9 @@ func TestNewManager(t *testing.T) {
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
description: "Policy is set preferred",
|
||||
policyName: "preferred",
|
||||
expectedPolicy: "preferred",
|
||||
description: "Policy is set to best-effort",
|
||||
policyName: "best-effort",
|
||||
expectedPolicy: "best-effort",
|
||||
},
|
||||
{
|
||||
description: "Policy is set to strict",
|
||||
@ -673,9 +673,9 @@ func TestAdmit(t *testing.T) {
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "QOSClass set as Guaranteed. Preferred Policy. Preferred Affinity.",
|
||||
name: "QOSClass set as Guaranteed. BestEffort Policy. Preferred Affinity.",
|
||||
qosClass: v1.PodQOSGuaranteed,
|
||||
policy: NewPreferredPolicy(),
|
||||
policy: NewBestEffortPolicy(),
|
||||
hp: []HintProvider{
|
||||
&mockHintProvider{
|
||||
[]TopologyHint{
|
||||
@ -693,9 +693,9 @@ func TestAdmit(t *testing.T) {
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "QOSClass set as Guaranteed. Preferred Policy. More than one Preferred Affinity.",
|
||||
name: "QOSClass set as Guaranteed. BestEffort Policy. More than one Preferred Affinity.",
|
||||
qosClass: v1.PodQOSGuaranteed,
|
||||
policy: NewPreferredPolicy(),
|
||||
policy: NewBestEffortPolicy(),
|
||||
hp: []HintProvider{
|
||||
&mockHintProvider{
|
||||
[]TopologyHint{
|
||||
@ -717,9 +717,9 @@ func TestAdmit(t *testing.T) {
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "QOSClass set as Guaranteed. Preferred Policy. No Preferred Affinity.",
|
||||
name: "QOSClass set as Guaranteed. BestEffort Policy. No Preferred Affinity.",
|
||||
qosClass: v1.PodQOSGuaranteed,
|
||||
policy: NewPreferredPolicy(),
|
||||
policy: NewBestEffortPolicy(),
|
||||
hp: []HintProvider{
|
||||
&mockHintProvider{
|
||||
[]TopologyHint{
|
||||
|
Loading…
Reference in New Issue
Block a user