-
Notifications
You must be signed in to change notification settings - Fork 367
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
Extract iptables binary staging to iptablesutils #5095
base: main
Are you sure you want to change the base?
Conversation
// ExtractIPTablesBinaries extracts the iptables binaries from the k0s binary and makes the symlinks | ||
// to the backend detected by DetectHostIPTablesMode. | ||
// ExtractIPTablesBinaries only works on linux, if called in another OS it will return an error. | ||
func ExtractIPTablesBinaries(k0sBinDir string, iptablesMode string) (error, 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.
I'd rather add it as a separate "IPTablesSetup" (or sth. like that) component, than having it as a free-standing function.
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.
Do you mean adding it the same way we do with pkg/component/status
and pkg/component/prober
?
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.
@twz123 friendly bump, I still need clarification on this
83cd0eb
to
be3872c
Compare
Hi Tom, I came back to this and I started doing but I realized kubelet needs both the iptables binaries (which isn't a problem) and an iptables mode (which is either If we move the iptables binary staging, to a new component we need to gather this information from the iptables component to the kubelet component. We can set this field in the 1- Add some code between the calls of Option 1 is probably the cleanest so I implemented it.. Do you have any preference? |
9557c99
to
9f2ed63
Compare
After looking at the kubelet component, I think the only reason the component needs to know the iptables mode is because it currently extracts the iptables binaries. So if we put that in its own component, I don't see any reason why the kubelet component would need to know about the iptables mode anymore. I'd do something along those lines: type IPTablesSetup struct {
IPTablesMode string
// ...
}
func (i *IPTablesSetup) Init(context.Context) error { /* Gather iptables mode, extract binaries */ }
func (i *IPTablesSetup) Start(context.Context) error { /* No-op, probably? */ }
func (i *IPTablesSetup) Stop() error { /* No-op, probably? */ } The
Fortunately, as far as I can see, we won't need any of the above here. However, there's already precedence for the second approach in k0s. |
CPLB potentially will need to create some iptables rules for its userspace proxy, hence this code should be in iptablesutils rather than pkg/worker/kubelet. Signed-off-by: Juan-Luis de Sousa-Valadas Castaño <[email protected]>
9f2ed63
to
6b106f2
Compare
Signed-off-by: Juan-Luis de Sousa-Valadas Castaño <[email protected]>
6b106f2
to
126d771
Compare
You're right, fixed. |
Description
CPLB potentially will need to create some iptables rules for its userspace proxy, hence this code should be in iptablesutils rather than pkg/worker/kubelet.
Fixes # (issue)
Type of change
How Has This Been Tested?
Checklist: