-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature gate and kubelet flags for Topology Manager #74411
Add feature gate and kubelet flags for Topology Manager #74411
Conversation
Hi @nolancon. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
pkg/features/kube_features.go
Outdated
@@ -167,6 +167,12 @@ const ( | |||
// | |||
// Enable pods to consume pre-allocated huge pages of varying page sizes | |||
HugePages utilfeature.Feature = "HugePages" | |||
|
|||
// owner: @lmdaly | |||
// alpha: v1.13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are just adding this now, this should be 1.14/1.15, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to 1.15
pkg/kubelet/kubelet.go
Outdated
|
||
if utilfeature.DefaultFeatureGate.Enabled(features.NodeLease) { | ||
klet.nodeLeaseController = nodelease.NewController(klet.clock, klet.heartbeatClient, string(klet.nodeName), kubeCfg.NodeLeaseDurationSeconds, klet.onRepeatedHeartbeatFailure) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove whitespace changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@dashpole could you ok-to-test this pr? |
pkg/kubelet/kubelet.go
Outdated
@@ -852,7 +852,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration, | |||
} | |||
klet.AddPodSyncLoopHandler(activeDeadlineHandler) | |||
klet.AddPodSyncHandler(activeDeadlineHandler) | |||
|
|||
klet.admitHandlers.AddPodAdmitHandler(klet.containerManager.GetTopologyPodAdmitHandler()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably add this line as part of #74357 so that this current PR can be merged independent of all other PRs in this chain.
@@ -149,6 +149,9 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura | |||
// Keep the same as default NodeStatusUpdateFrequency | |||
obj.CPUManagerReconcilePeriod = metav1.Duration{Duration: 10 * time.Second} | |||
} | |||
if obj.TopologyManagerPolicy == "" { | |||
obj.TopologyManagerPolicy = "Preferred" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it OK that "Preferred" is capitalized here, but is lower-case in the TopologyManager itself? Does it get normalized to lower-case somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to make a difference, but changed anyway for consistency.
/ok-to-test |
@liggitt the policy is passed into the New Topology Manager func where it gets checked. Is there additional check we should be doing before this? |
does the default |
if the TopologyManager feature is disabled, should that prevent someone from setting a policy or from setting a particular policy like kubernetes/pkg/kubelet/apis/config/validation/validation.go Lines 108 to 113 in 990695c
|
@liggitt Will add the check for the policy and feature gate setting. The policies are a new concept and give additional functionality to resource allocation for cpu and devices |
@@ -149,6 +149,9 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura | |||
// Keep the same as default NodeStatusUpdateFrequency | |||
obj.CPUManagerReconcilePeriod = metav1.Duration{Duration: 10 * time.Second} | |||
} | |||
if obj.TopologyManagerPolicy == "" { | |||
obj.TopologyManagerPolicy = "preferred" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we have default policy 'none' - meaning, "do not do anything, work as older version of kubelet, even if the feature gate is enabled" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -149,6 +149,9 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura | |||
// Keep the same as default NodeStatusUpdateFrequency | |||
obj.CPUManagerReconcilePeriod = metav1.Duration{Duration: 10 * time.Second} | |||
} | |||
if obj.TopologyManagerPolicy == "" { | |||
obj.TopologyManagerPolicy = "none" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, define constants for the allowed values (in the same file as the config type) and use them here, in validation, and in fuzzing
@@ -409,6 +409,13 @@ type KubeletConfiguration struct { | |||
// Default: "10s" | |||
// +optional | |||
CPUManagerReconcilePeriod metav1.Duration `json:"cpuManagerReconcilePeriod,omitempty"` | |||
// TopologyManagerPolicy is the name of the policy to use. | |||
// Requires the TopologyManager feature gate to be enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Policies other than none
require the TopologyManager feature gate to be enabled."
thanks, one nit on constants, one on doc, lgtm otherwise. please squash before merge |
Nit: remove capitalization of preferred Remove line from kubelet and add to separate PR for easier merge nit: dependency added to separate PR Add check to ensure strict policy cannot be set without feature gate enabled Topology Manager runs "none" policy by default. Added constants for policies and updated documentation.
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: derekwaynecarr, liggitt, nolancon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Review the full test history for this PR. Silence the bot with an |
What this PR does / why we need it:
Create feature gate for Topology Manager and add Kubelet flags.
Topology Manager based merged design proposal here: kubernetes/community#1680
Issue for tracking PRs: #72828
What type of PR is this?
Does this PR introduce a user-facing change?: