Merge pull request #81787 from lmdaly/topology-manager-rename-strict-policy

Renaming strict policy to restricted policy
This commit is contained in:
Kubernetes Prow Robot 2019-08-28 01:38:04 -07:00 committed by GitHub
commit de1cfa9bc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 34 additions and 34 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.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', 'best-effort', 'strict'.")
fs.StringVar(&c.TopologyManagerPolicy, "topology-manager-policy", c.TopologyManagerPolicy, "Topology Manager policy to use. Possible values: 'none', 'best-effort', 'restricted'.")
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.")

View File

@ -54,9 +54,9 @@ const (
// WatchChangeDetectionStrategy is a mode in which kubelet uses
// watches to observe changes to objects that are in its interest.
WatchChangeDetectionStrategy ResourceChangeDetectionStrategy = "Watch"
// StrictTopologyManagerPolicy is a mode in which kubelet only allows
// pods with NUMA alignment of CPU and device resources.
StrictTopologyManagerPolicy = "strict"
// RestrictedTopologyManagerPolicy is a mode in which kubelet only allows
// pods with a single NUMA alignment of CPU and device resources.
RestrictedTopologyManagerPolicy = "restricted"
// BestEffortTopologyManagerPolicy is a mode in which kubelet will favour
// pods with NUMA alignment of CPU and device resources.
BestEffortTopologyManagerPolicy = "best-effort"

View File

@ -7,7 +7,7 @@ go_library(
"policy.go",
"policy_best_effort.go",
"policy_none.go",
"policy_strict.go",
"policy_restricted.go",
"topology_manager.go",
],
importpath = "k8s.io/kubernetes/pkg/kubelet/cm/topologymanager",
@ -43,7 +43,7 @@ go_test(
"fake_topology_manager_test.go",
"policy_best_effort_test.go",
"policy_none_test.go",
"policy_strict_test.go",
"policy_restricted_test.go",
"topology_manager_test.go",
],
embed = [":go_default_library"],

View File

@ -20,23 +20,23 @@ import (
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
)
type strictPolicy struct{}
type restrictedPolicy struct{}
var _ Policy = &strictPolicy{}
var _ Policy = &restrictedPolicy{}
// PolicyStrict policy name.
const PolicyStrict string = "strict"
// PolicyRestricted policy name.
const PolicyRestricted string = "restricted"
// NewStrictPolicy returns strict policy.
func NewStrictPolicy() Policy {
return &strictPolicy{}
// NewRestrictedPolicy returns restricted policy.
func NewRestrictedPolicy() Policy {
return &restrictedPolicy{}
}
func (p *strictPolicy) Name() string {
return PolicyStrict
func (p *restrictedPolicy) Name() string {
return PolicyRestricted
}
func (p *strictPolicy) CanAdmitPodResult(admit bool) lifecycle.PodAdmitResult {
func (p *restrictedPolicy) CanAdmitPodResult(admit bool) lifecycle.PodAdmitResult {
if !admit {
return lifecycle.PodAdmitResult{
Admit: false,

View File

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

View File

@ -85,8 +85,8 @@ func NewManager(topologyPolicyName string) (Manager, error) {
case PolicyBestEffort:
policy = NewBestEffortPolicy()
case PolicyStrict:
policy = NewStrictPolicy()
case PolicyRestricted:
policy = NewRestrictedPolicy()
default:
return nil, fmt.Errorf("unknown policy: \"%s\"", topologyPolicyName)

View File

@ -52,9 +52,9 @@ func TestNewManager(t *testing.T) {
expectedPolicy: "best-effort",
},
{
description: "Policy is set to strict",
policyName: "strict",
expectedPolicy: "strict",
description: "Policy is set to restricted",
policyName: "restricted",
expectedPolicy: "restricted",
},
{
description: "Policy is set to unknown",
@ -859,9 +859,9 @@ func TestAdmit(t *testing.T) {
expected: true,
},
{
name: "QOSClass set as Guaranteed. Strict Policy. Preferred Affinity.",
name: "QOSClass set as Guaranteed. Restricted Policy. Preferred Affinity.",
qosClass: v1.PodQOSGuaranteed,
policy: NewStrictPolicy(),
policy: NewRestrictedPolicy(),
hp: []HintProvider{
&mockHintProvider{
map[string][]TopologyHint{
@ -881,9 +881,9 @@ func TestAdmit(t *testing.T) {
expected: true,
},
{
name: "QOSClass set as Guaranteed. Strict Policy. More than one Preferred affinity.",
name: "QOSClass set as Guaranteed. Restricted Policy. More than one Preferred affinity.",
qosClass: v1.PodQOSGuaranteed,
policy: NewStrictPolicy(),
policy: NewRestrictedPolicy(),
hp: []HintProvider{
&mockHintProvider{
map[string][]TopologyHint{
@ -907,9 +907,9 @@ func TestAdmit(t *testing.T) {
expected: true,
},
{
name: "QOSClass set as Guaranteed. Strict Policy. No Preferred affinity.",
name: "QOSClass set as Guaranteed. Restricted Policy. No Preferred affinity.",
qosClass: v1.PodQOSGuaranteed,
policy: NewStrictPolicy(),
policy: NewRestrictedPolicy(),
hp: []HintProvider{
&mockHintProvider{
map[string][]TopologyHint{

View File

@ -54,12 +54,12 @@ const (
// WatchChangeDetectionStrategy is a mode in which kubelet uses
// watches to observe changes to objects that are in its interest.
WatchChangeDetectionStrategy ResourceChangeDetectionStrategy = "Watch"
// StrictTopologyManagerPolicy is a mode in which kubelet only allows
// RestrictedTopologyManagerPolicy is a mode in which kubelet only allows
// pods with a single NUMA alignment of CPU and device resources.
RestrictedTopologyManagerPolicy = "restricted"
// BestEffortTopologyManagerPolicy is a mode in which kubelet will favour
// pods with NUMA alignment of CPU and device resources.
StrictTopologyManagerPolicy = "strict"
// PreferredTopologyManagerPolicy 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"