-
Notifications
You must be signed in to change notification settings - Fork 510
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
kubelet: add image GC threshold settings #2219
kubelet: add image GC threshold settings #2219
Conversation
962b267
to
6afa956
Compare
Latest force push: consolidate branch history. Summary of changes below. apiserver and schnauzer: Add validation for new kubelet settings
|
d7286b0
to
ec2699a
Compare
ec2699a
to
671cb43
Compare
Latest force push: remove setting validation from template rendering layer. Remove helper function in template rendering layer. Remove interdependent validation entirely, but keep independent validation. Clarify kubelet config template (leave setting names and defaults in the template, instead of in Rust code). |
671cb43
to
ad277a7
Compare
Latest force push: remove remaining unused constants. |
ad277a7
to
fce4d67
Compare
Latest force push: clean up overkill tests (remove unnecessary |
fce4d67
to
112dc75
Compare
Latest force push: fix commit message |
Code change LGTM. For writing commit messages, I tend to roughly follow this guide with some minor changes: Minor changes:
So for this commit I would say:
And combine your current subject and body into a new body wrapped at 70 characters. |
112dc75
to
f9a31af
Compare
Thank you @bcressey ! I've clarified the commit message and PR title. |
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.
Can you please update the PR description to reflect the latest state of the PR? Some parts of it is out of date.
6525d31
to
d398b10
Compare
Last 3 git force-pushes: added |
28b839a
to
0af4fa5
Compare
Latest force push: remove linter formatting-on-save unrelated changes |
0787a72
to
1c5f9d5
Compare
Latest force push: Fixed |
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.
🍨
1c5f9d5
to
985adcb
Compare
Latest force push: had to rebase my branch/PR due to merge conflicts with develop/HEAD |
README.md
Outdated
@@ -411,6 +411,8 @@ The following settings are optional and allow you to further configure your clus | |||
* `settings.kubernetes.topology-manager-policy`: Specifies the topology manager policy. Possible values are `none`, `restricted`, `best-effort`, and `single-numa-node`. Defaults to `none`. | |||
* `settings.kubernetes.topology-manager-scope`: Specifies the topology manager scope. Possible values are `container` and `pod`. Defaults to `container`. If you want to group all containers in a pod to a common set of NUMA nodes, you can set this setting to `pod`. | |||
* `settings.kubernetes.pod-pids-limit`: The maximum number of processes per pod. | |||
* `settings.kubernetes.image-gc-high-threshold-percent`: The disk utilization percentage where `kubelet` begins garbage collection over the stored container images. In short, this is the "disk is too full" mark. |
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.
This doesn't sound correct; my reading of the documentation is that the garbage collector will run less frequently - not always, but not never - if disk usage percentage falls between high and low.
I would also avoid phrases like "In short". Maybe just strike the second sentence from each since you're introducing an abstract concept - whether or not the disk is too full or empty enough - to what would otherwise be a precise description of how the setting controls the kubelet garbage collector.
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.
You are correct.
EDIT: Will use the following, as per the kubelet config documentation:
settings.kubernetes.image-gc-high-threshold-percent: the percent of disk usage after which image garbage collection is always run.
settings.kubernetes.image-gc-low-threshold-percent: the percent of disk usage before which image garbage collection is never run.
985adcb
to
37ee773
Compare
Latest force push: make README documentation accurate to |
Add kubelet config options: `imageGCHighThresholdPercent`, `imageGCLowThresholdPercent` and validation for both settings to both the apiserver and template rendering code.
37ee773
to
30e6f6c
Compare
Latest force push: merge in the latest from |
Issue number:
Closes #2216
Closes #2217
Closes #2065
Description of changes:
Adds two kubelet settings:
imageGCHighThresholdPercent
andimageGCLowThresholdPercent
.Also adds validation for those two settings.
From the kubernetes repo (https://pkg.go.dev/k8s.io/kubernetes/pkg/kubelet/apis/config#KubeletConfiguration):
Some Q&A:1. Why validate twice: at the apiserver level, and the template rendering level?1. There are two kinds of invalidity for the settings this PR adds: independent invalidity and interdependent invalidity. Independent invalidity would be a value outside of the defined 0-100 threshold. Interdependent invalidity is when theHigh
threshold percent is lower than theLow
threshold percent, and is only calculable by comparing (or knowing) both settings at the same time.1. The independent invalidity can and should be checked as soon as possible and stop the user from entering invalid values. That kind of validation can and is done at the apiserver level.1. The interdependent invalidity is only able to be checked when the template is about to be rendered -- when both setting values are known (since the user can provide only one of the two new settings in an apiserver request, and these settings also have default kubelet values to initially compare against).1. Why does your template code contain~
characters at each end of the helper function call?1. That is a handlebars feature that removes whitespace (including newlines) before or after that~
character.1. In the case of this PR, the helper functionimage_gc_threshold_percent
actually handles the rendering of necessary whitespace after writing out the setting values (specifically: the newlines after each setting), so the template rendering engine/handlebars should remove the existing newline it sees at the end of the helper function call (after the}}
at the end of the line). Therefore, the~
feature of handlebars was used.Testing done:
[ ] Upgrade/downgrade for variant: metal 1.22Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.