mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
Merge pull request #81787 from lmdaly/topology-manager-rename-strict-policy
Renaming strict policy to restricted policy
This commit is contained in:
commit
de1cfa9bc1
@ -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', '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.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.")
|
||||||
|
@ -54,9 +54,9 @@ const (
|
|||||||
// WatchChangeDetectionStrategy is a mode in which kubelet uses
|
// WatchChangeDetectionStrategy is a mode in which kubelet uses
|
||||||
// watches to observe changes to objects that are in its interest.
|
// watches to observe changes to objects that are in its interest.
|
||||||
WatchChangeDetectionStrategy ResourceChangeDetectionStrategy = "Watch"
|
WatchChangeDetectionStrategy ResourceChangeDetectionStrategy = "Watch"
|
||||||
// StrictTopologyManagerPolicy is a mode in which kubelet only allows
|
// RestrictedTopologyManagerPolicy is a mode in which kubelet only allows
|
||||||
// pods with NUMA alignment of CPU and device resources.
|
// pods with a single NUMA alignment of CPU and device resources.
|
||||||
StrictTopologyManagerPolicy = "strict"
|
RestrictedTopologyManagerPolicy = "restricted"
|
||||||
// BestEffortTopologyManagerPolicy 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.
|
||||||
BestEffortTopologyManagerPolicy = "best-effort"
|
BestEffortTopologyManagerPolicy = "best-effort"
|
||||||
|
@ -7,7 +7,7 @@ go_library(
|
|||||||
"policy.go",
|
"policy.go",
|
||||||
"policy_best_effort.go",
|
"policy_best_effort.go",
|
||||||
"policy_none.go",
|
"policy_none.go",
|
||||||
"policy_strict.go",
|
"policy_restricted.go",
|
||||||
"topology_manager.go",
|
"topology_manager.go",
|
||||||
],
|
],
|
||||||
importpath = "k8s.io/kubernetes/pkg/kubelet/cm/topologymanager",
|
importpath = "k8s.io/kubernetes/pkg/kubelet/cm/topologymanager",
|
||||||
@ -43,7 +43,7 @@ go_test(
|
|||||||
"fake_topology_manager_test.go",
|
"fake_topology_manager_test.go",
|
||||||
"policy_best_effort_test.go",
|
"policy_best_effort_test.go",
|
||||||
"policy_none_test.go",
|
"policy_none_test.go",
|
||||||
"policy_strict_test.go",
|
"policy_restricted_test.go",
|
||||||
"topology_manager_test.go",
|
"topology_manager_test.go",
|
||||||
],
|
],
|
||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
|
@ -20,23 +20,23 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
|
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
|
||||||
)
|
)
|
||||||
|
|
||||||
type strictPolicy struct{}
|
type restrictedPolicy struct{}
|
||||||
|
|
||||||
var _ Policy = &strictPolicy{}
|
var _ Policy = &restrictedPolicy{}
|
||||||
|
|
||||||
// PolicyStrict policy name.
|
// PolicyRestricted policy name.
|
||||||
const PolicyStrict string = "strict"
|
const PolicyRestricted string = "restricted"
|
||||||
|
|
||||||
// NewStrictPolicy returns strict policy.
|
// NewRestrictedPolicy returns restricted policy.
|
||||||
func NewStrictPolicy() Policy {
|
func NewRestrictedPolicy() Policy {
|
||||||
return &strictPolicy{}
|
return &restrictedPolicy{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *strictPolicy) Name() string {
|
func (p *restrictedPolicy) Name() string {
|
||||||
return PolicyStrict
|
return PolicyRestricted
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *strictPolicy) CanAdmitPodResult(admit bool) lifecycle.PodAdmitResult {
|
func (p *restrictedPolicy) CanAdmitPodResult(admit bool) lifecycle.PodAdmitResult {
|
||||||
if !admit {
|
if !admit {
|
||||||
return lifecycle.PodAdmitResult{
|
return lifecycle.PodAdmitResult{
|
||||||
Admit: false,
|
Admit: false,
|
@ -20,7 +20,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPolicyStrictCanAdmitPodResult(t *testing.T) {
|
func TestPolicyRestrictedCanAdmitPodResult(t *testing.T) {
|
||||||
tcases := []struct {
|
tcases := []struct {
|
||||||
name string
|
name string
|
||||||
admit bool
|
admit bool
|
||||||
@ -39,7 +39,7 @@ func TestPolicyStrictCanAdmitPodResult(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range tcases {
|
for _, tc := range tcases {
|
||||||
policy := NewStrictPolicy()
|
policy := NewRestrictedPolicy()
|
||||||
admit := tc.admit
|
admit := tc.admit
|
||||||
result := policy.CanAdmitPodResult(admit)
|
result := policy.CanAdmitPodResult(admit)
|
||||||
|
|
@ -85,8 +85,8 @@ func NewManager(topologyPolicyName string) (Manager, error) {
|
|||||||
case PolicyBestEffort:
|
case PolicyBestEffort:
|
||||||
policy = NewBestEffortPolicy()
|
policy = NewBestEffortPolicy()
|
||||||
|
|
||||||
case PolicyStrict:
|
case PolicyRestricted:
|
||||||
policy = NewStrictPolicy()
|
policy = NewRestrictedPolicy()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unknown policy: \"%s\"", topologyPolicyName)
|
return nil, fmt.Errorf("unknown policy: \"%s\"", topologyPolicyName)
|
||||||
|
@ -52,9 +52,9 @@ func TestNewManager(t *testing.T) {
|
|||||||
expectedPolicy: "best-effort",
|
expectedPolicy: "best-effort",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Policy is set to strict",
|
description: "Policy is set to restricted",
|
||||||
policyName: "strict",
|
policyName: "restricted",
|
||||||
expectedPolicy: "strict",
|
expectedPolicy: "restricted",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Policy is set to unknown",
|
description: "Policy is set to unknown",
|
||||||
@ -859,9 +859,9 @@ func TestAdmit(t *testing.T) {
|
|||||||
expected: true,
|
expected: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "QOSClass set as Guaranteed. Strict Policy. Preferred Affinity.",
|
name: "QOSClass set as Guaranteed. Restricted Policy. Preferred Affinity.",
|
||||||
qosClass: v1.PodQOSGuaranteed,
|
qosClass: v1.PodQOSGuaranteed,
|
||||||
policy: NewStrictPolicy(),
|
policy: NewRestrictedPolicy(),
|
||||||
hp: []HintProvider{
|
hp: []HintProvider{
|
||||||
&mockHintProvider{
|
&mockHintProvider{
|
||||||
map[string][]TopologyHint{
|
map[string][]TopologyHint{
|
||||||
@ -881,9 +881,9 @@ func TestAdmit(t *testing.T) {
|
|||||||
expected: true,
|
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,
|
qosClass: v1.PodQOSGuaranteed,
|
||||||
policy: NewStrictPolicy(),
|
policy: NewRestrictedPolicy(),
|
||||||
hp: []HintProvider{
|
hp: []HintProvider{
|
||||||
&mockHintProvider{
|
&mockHintProvider{
|
||||||
map[string][]TopologyHint{
|
map[string][]TopologyHint{
|
||||||
@ -907,9 +907,9 @@ func TestAdmit(t *testing.T) {
|
|||||||
expected: true,
|
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,
|
qosClass: v1.PodQOSGuaranteed,
|
||||||
policy: NewStrictPolicy(),
|
policy: NewRestrictedPolicy(),
|
||||||
hp: []HintProvider{
|
hp: []HintProvider{
|
||||||
&mockHintProvider{
|
&mockHintProvider{
|
||||||
map[string][]TopologyHint{
|
map[string][]TopologyHint{
|
||||||
|
@ -54,12 +54,12 @@ const (
|
|||||||
// WatchChangeDetectionStrategy is a mode in which kubelet uses
|
// WatchChangeDetectionStrategy is a mode in which kubelet uses
|
||||||
// watches to observe changes to objects that are in its interest.
|
// watches to observe changes to objects that are in its interest.
|
||||||
WatchChangeDetectionStrategy ResourceChangeDetectionStrategy = "Watch"
|
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.
|
// pods with NUMA alignment of CPU and device resources.
|
||||||
StrictTopologyManagerPolicy = "strict"
|
BestEffortTopologyManagerPolicy = "best-effort"
|
||||||
// PreferredTopologyManagerPolicy is a mode in which kubelet will favour
|
|
||||||
// pods with NUMA alignment of CPU and device resources.
|
|
||||||
PreferredTopologyManagerPolicy = "preferred"
|
|
||||||
// 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"
|
||||||
|
Loading…
Reference in New Issue
Block a user