-
Notifications
You must be signed in to change notification settings - Fork 40.4k
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
Automatically load ipvs required kernel modules in kubeadm #59566
Conversation
/assign @m1093782566 @Lion-Wei |
/ok-to-test |
In this PR, I would not delete the code in the ipvs proxier that loads the modules. I suggest you leave that as the final step once we know the module loading logic is propagated everywhere |
@@ -0,0 +1,51 @@ | |||
package util |
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.
Why are we doing this in code? I thought the whole point was to move the kernel module loading logic into startup scripts. Doesn't kubeadm have startup scripts as well?
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.
just WIP. Will fix for moment, thanks
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.
Actuall, kubeadm itself don't have startup scripts. You can do this work in kubernetes-anywhere, but that's just one use case of kubeadm.
pkg/proxy/ipvs/proxier.go
Outdated
loadModules := sets.NewString() | ||
wantModules.Insert(ipvsModules...) | ||
loadModules.Insert(mods...) | ||
modules := wantModules.Difference(loadModules).UnsortedList() |
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 think we still need check whether kernel modules are loaded in kube-proxy, 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.
i keep it now, will deleting it once all function well in kubeadm
.
0c6c28c
to
032f620
Compare
/test pull-kubernetes-bazel-test |
7a2233c
to
cb4785c
Compare
/area kubeadm |
cb4785c
to
be3860b
Compare
/uncc @fabriziopandini Might be a silly question, but what about nodes? Afaik this piece of code will be executed only on masters... |
Kindly ping @luxas @xiangpengzhao for review,PTAL |
@fabriziopandini That's true, I think this pr still WIP. Need figure out a good way to identify ipvs mode in nodes. @stewart-yu |
/assign @luxas |
9bed6ae
to
adef916
Compare
cmd/kubeadm/app/preflight/checks.go
Outdated
@@ -926,6 +934,11 @@ func RunJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.NodeConfigura | |||
checks = addCommonChecks(execer, cfg, checks) | |||
|
|||
addIPv6Checks := false | |||
|
|||
checks = append(checks, | |||
ipvsutil.RequiredIPVSKernelModulesAvailableCheck{}, |
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.
please move this to the []Checker
slice above
} | ||
|
||
// Name returns label for RequiredIPVSKernelModulesAvailableCheck | ||
func (r RequiredIPVSKernelModulesAvailableCheck) Name() string { |
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 you pass this as a reference here in both funcs? I think that's standard practice at least
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.
In general, that's right. But if add reference
, will generate incompatible types
errors. Also follow others checkers's format.
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.
ok
loadModules.Insert(mods...) | ||
modules := wantModules.Difference(loadModules).UnsortedList() | ||
|
||
//TODO: add more testcase about builtin kernel ipvs support |
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 add more now or do you strictly want to do that later?
|
||
// Check try to validates IPVS required kernel modules exists or not. | ||
func (r RequiredIPVSKernelModulesAvailableCheck) Check() (warnings, errors []error) { | ||
errors = append(errors, fmt.Errorf("IPVS not supported for this platform")) |
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 don't think you should return an error here, as ipvs isn't required for kubeadm to run. This will work just fine on windows for example, even though those kernel modules aren't there
/cc @m1093782566 @luxas all comments updated, PTAL |
|
||
// Check try to validates IPVS required kernel modules exists or not. | ||
func (r RequiredIPVSKernelModulesAvailableCheck) Check() (warnings, errors []error) { | ||
warnings = []error{} |
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 this line and return nil, nil directly.
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.
fix
Looks good to me for IPVS part. @luxas for kubeadm part opinions and final approval. |
/test pull-kubernetes-e2e-kops-aws |
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.
/approve
/lgtm
Thanks @stewart-yu 🎉!
@m1093782566 please approve the ipvs parts |
Okay, let's merge this PR. /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: luxas, m1093782566, stewart-yu, timothysc 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 |
/test all [submit-queue is verifying that this PR is safe to merge] |
/retest |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
This PR is part of #59402, aiming to load kernel modules in kubeadm
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes ##59402
Special notes for your reviewer:
Release note: