Rename 'preferred' TopologyManager policy to 'best-effort'

This commit is contained in:
Kevin Klues 2019-07-18 14:30:17 +02:00
parent 10005d2e1e
commit 7eccc71c9e
6 changed files with 26 additions and 26 deletions

View File

@ -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.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.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.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.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.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.") fs.Int32Var(&c.MaxPods, "max-pods", c.MaxPods, "Number of Pods that can run on this Kubelet.")

View File

@ -57,9 +57,9 @@ const (
// StrictTopologyManagerPolicy is a mode in which kubelet only allows // StrictTopologyManagerPolicy is a mode in which kubelet only allows
// pods with NUMA alignment of CPU and device resources. // pods with NUMA alignment of CPU and device resources.
StrictTopologyManagerPolicy = "strict" 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. // 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 // NoneTopologyManager Policy is a mode in which kubelet has no knowledge
// of NUMA alignment of a pod's CPU and device resources. // of NUMA alignment of a pod's CPU and device resources.
NoneTopologyManagerPolicy = "none" NoneTopologyManagerPolicy = "none"

View File

@ -20,23 +20,23 @@ import (
"k8s.io/kubernetes/pkg/kubelet/lifecycle" "k8s.io/kubernetes/pkg/kubelet/lifecycle"
) )
type preferredPolicy struct{} type bestEffortPolicy struct{}
var _ Policy = &preferredPolicy{} var _ Policy = &bestEffortPolicy{}
// PolicyPreferred policy name. // PolicyBestEffort policy name.
const PolicyPreferred string = "preferred" const PolicyBestEffort string = "best-effort"
// NewPreferredPolicy returns preferred policy. // NewBestEffortPolicy returns best-effort policy.
func NewPreferredPolicy() Policy { func NewBestEffortPolicy() Policy {
return &preferredPolicy{} return &bestEffortPolicy{}
} }
func (p *preferredPolicy) Name() string { func (p *bestEffortPolicy) Name() string {
return PolicyPreferred return PolicyBestEffort
} }
func (p *preferredPolicy) CanAdmitPodResult(admit bool) lifecycle.PodAdmitResult { func (p *bestEffortPolicy) CanAdmitPodResult(admit bool) lifecycle.PodAdmitResult {
return lifecycle.PodAdmitResult{ return lifecycle.PodAdmitResult{
Admit: true, Admit: true,
} }

View File

@ -20,7 +20,7 @@ import (
"testing" "testing"
) )
func TestPolicyPreferredCanAdmitPodResult(t *testing.T) { func TestPolicyBestEffortCanAdmitPodResult(t *testing.T) {
tcases := []struct { tcases := []struct {
name string name string
admit bool admit bool
@ -39,7 +39,7 @@ func TestPolicyPreferredCanAdmitPodResult(t *testing.T) {
} }
for _, tc := range tcases { for _, tc := range tcases {
policy := NewPreferredPolicy() policy := NewBestEffortPolicy()
admit := tc.admit admit := tc.admit
result := policy.CanAdmitPodResult(admit) result := policy.CanAdmitPodResult(admit)

View File

@ -82,8 +82,8 @@ func NewManager(topologyPolicyName string) (Manager, error) {
case PolicyNone: case PolicyNone:
policy = NewNonePolicy() policy = NewNonePolicy()
case PolicyPreferred: case PolicyBestEffort:
policy = NewPreferredPolicy() policy = NewBestEffortPolicy()
case PolicyStrict: case PolicyStrict:
policy = NewStrictPolicy() policy = NewStrictPolicy()

View File

@ -47,9 +47,9 @@ func TestNewManager(t *testing.T) {
expectedError error expectedError error
}{ }{
{ {
description: "Policy is set preferred", description: "Policy is set to best-effort",
policyName: "preferred", policyName: "best-effort",
expectedPolicy: "preferred", expectedPolicy: "best-effort",
}, },
{ {
description: "Policy is set to strict", description: "Policy is set to strict",
@ -673,9 +673,9 @@ func TestAdmit(t *testing.T) {
expected: true, expected: true,
}, },
{ {
name: "QOSClass set as Guaranteed. Preferred Policy. Preferred Affinity.", name: "QOSClass set as Guaranteed. BestEffort Policy. Preferred Affinity.",
qosClass: v1.PodQOSGuaranteed, qosClass: v1.PodQOSGuaranteed,
policy: NewPreferredPolicy(), policy: NewBestEffortPolicy(),
hp: []HintProvider{ hp: []HintProvider{
&mockHintProvider{ &mockHintProvider{
[]TopologyHint{ []TopologyHint{
@ -693,9 +693,9 @@ func TestAdmit(t *testing.T) {
expected: true, 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, qosClass: v1.PodQOSGuaranteed,
policy: NewPreferredPolicy(), policy: NewBestEffortPolicy(),
hp: []HintProvider{ hp: []HintProvider{
&mockHintProvider{ &mockHintProvider{
[]TopologyHint{ []TopologyHint{
@ -717,9 +717,9 @@ func TestAdmit(t *testing.T) {
expected: true, 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, qosClass: v1.PodQOSGuaranteed,
policy: NewPreferredPolicy(), policy: NewBestEffortPolicy(),
hp: []HintProvider{ hp: []HintProvider{
&mockHintProvider{ &mockHintProvider{
[]TopologyHint{ []TopologyHint{