-
Notifications
You must be signed in to change notification settings - Fork 508
[OCPNODE-852] workerlatency profiles - updating the kubelet configuration based on the nodes.config.openshift.io resource #3015
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ import ( | |
| "context" | ||
| "encoding/json" | ||
| "fmt" | ||
| "reflect" | ||
| "strconv" | ||
|
|
||
| ign3types "github.com/coreos/ignition/v2/config/v3_2/types" | ||
|
|
@@ -131,6 +132,42 @@ func createNewDefaultFeatureGate() *osev1.FeatureGate { | |
| } | ||
| } | ||
|
|
||
| func createNewDefaultNodeconfig() *osev1.Node { | ||
| return &osev1.Node{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: ctrlcommon.ClusterNodeInstanceName, | ||
| }, | ||
| Spec: osev1.NodeSpec{ | ||
| CgroupMode: osev1.CgroupModeDefault, | ||
| WorkerLatencyProfile: osev1.DefaultUpdateDefaultReaction, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| // updateOriginalKubeConfigwithNodeConfig updates the original Kubelet Configuration based on the Nodespecific configuration | ||
| func updateOriginalKubeConfigwithNodeConfig(node *osev1.Node, originalKubeletConfig *kubeletconfigv1beta1.KubeletConfiguration) error { | ||
|
kikisdeliveryservice marked this conversation as resolved.
Outdated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the interesting part is, since you are running this for every sync loop for KubeletConfig and features, what I think will happen is:
so I guess the question then is, is there a difference between having Alternatively, if you covered this somewhere else and I am misunderstanding, please let me know where that happens. If this doesn't otherwise affect the default, you can ignore this question
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default |
||
| if node == nil { | ||
| return fmt.Errorf("node configuration not found, failed to update the original kubelet configuration") | ||
| } | ||
| if reflect.DeepEqual(node.Spec, osev1.NodeSpec{}) { | ||
| return fmt.Errorf("empty node resource spec found") | ||
| } | ||
| // updating the kubelet specific fields based on the Node's workerlatency profile. | ||
| // (TODO): The durations can be replaced with the defined constants in the openshift/api repository once the respective changes are merged. | ||
| switch node.Spec.WorkerLatencyProfile { | ||
| case osev1.MediumUpdateAverageReaction: | ||
| originalKubeletConfig.NodeStatusUpdateFrequency = metav1.Duration{Duration: osev1.MediumNodeStatusUpdateFrequency} | ||
| case osev1.LowUpdateSlowReaction: | ||
| originalKubeletConfig.NodeStatusUpdateFrequency = metav1.Duration{Duration: osev1.LowNodeStatusUpdateFrequency} | ||
| case osev1.DefaultUpdateDefaultReaction: | ||
| originalKubeletConfig.NodeStatusUpdateFrequency = metav1.Duration{Duration: osev1.DefaultNodeStatusUpdateFrequency} | ||
| default: | ||
| return fmt.Errorf("unknown worker latency profile type found %v, failed to update the original kubelet configuration", node.Spec.WorkerLatencyProfile) | ||
| } | ||
| // The kubelet configuration can be updated based on the cgroupmode as well here. | ||
| return nil | ||
| } | ||
|
|
||
| func findKubeletConfig(mc *mcfgv1.MachineConfig) (*ign3types.File, error) { | ||
| ignCfg, err := ctrlcommon.ParseAndConvertConfig(mc.Spec.Config.Raw) | ||
| if err != nil { | ||
|
|
@@ -227,6 +264,10 @@ func getManagedFeaturesKeyDeprecated(pool *mcfgv1.MachineConfigPool) string { | |
| return fmt.Sprintf("98-%s-%s-kubelet", pool.Name, pool.ObjectMeta.UID) | ||
| } | ||
|
|
||
| func getManagedNodeConfigKey(pool *mcfgv1.MachineConfigPool, client mcfgclientset.Interface) (string, error) { | ||
| return ctrlcommon.GetManagedKey(pool, client, "97", "kubelet", fmt.Sprintf("97-%s-%s-kubelet", pool.Name, pool.ObjectMeta.UID)) | ||
| } | ||
|
|
||
| // Deprecated: use getManagedKubeletConfigKey | ||
| func getManagedKubeletConfigKeyDeprecated(pool *mcfgv1.MachineConfigPool) string { | ||
| return fmt.Sprintf("99-%s-%s-kubelet", pool.Name, pool.ObjectMeta.UID) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.