Import `utiliptables`, update to do mode detection #23
Does this mean we'll have to go patch this image for every go CVE? k/k just exited that, and I think they've been more frequent than glibc etc.
https://docs.google.com/document/d/10HujH6PL0ez3vviA03I01_mbJWs9Xp99gIDWnnNXyco/edit?tab=t.0
cc @liggitt
Does this mean we'll have to go patch this image for every go CVE?
There's no image. This is just creating a new vendored dependency, which will then let us remove stuff from distroless-iptables:
distroless-iptables includes the old bash-based version of iptables-wrapper, which requires us to install a bunch of other debian binaries into distroless-iptables as well for support.
distroless-iptables to use the new golang-based iptables-wrapper (https://github.com/kubernetes/release/issues/2992) so we could drop all of the other binaries and have _just_ iptables-wrapper, iptables, ipset, and nft in the distroless-iptables image. But you (Ben) pointed out that this would mean having to rebuild iptables-wrapper any time there was a golang CVE, which would probably end up being more work than having to rebuild any time there was a bash, etc, CVE. This eventually led to the:
iptables-wrapper in distroless-iptables.
(The golang-based iptables-wrapper binary in this module still exists for anyone else who was using it, but kubernetes itself won't use it any more.)
(Ah, I guess I didn't actually explain this entirely in the initial PR description, but we had discussed the idea in another PR a few months ago...)
Thanks.
Yeah, I'm having a hard time keeping up at the moment, apologies. Big pre-kubecon push for a new CNCF project.
There are currently some release threads where the project is again doing a TON of work for what should be one-line .go-version patch and trigger a release soon. Can't wait for 1.35 to EOL and then cleanup the vestigial go-runner base. I got worried we're going the other way again. I recall that thread now.
I think the semantics of pollImmediate here will be if done || err != nil is when it stop polling
I don't know how much we care about this function but for completeness this should be cancellable
timer := time.NewTimer(d)
defer timer.Stop()
select {
case <-mon.stopCh:
return false
case <-timer.C:
return true
}
LGTM the only question is about how much we care about the apimachinery replacement for the Monitor method
I was trying to keep it simple...
We know the timeout will eventually time out, and then the very next line checks the context. So worst case is just that the goroutine lingers longer than it should before exiting. And there's no API that lets you know when the Monitor exited, so it's not like we'll be forcing anyone else to wait that extra time along with us. So it seemed harmless to just have the simpler one-liner rather than your more-correct 8-liner.
ah, none of the cases in the unit test ever return an error... ~I should just remove that arg~. but I'll leave it, for consistency with the real PollImmediate, and in case we need it later.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/kubernetes-sigs/iptables-wrappers/pull/23#issuecomment-6372585076" title="Approved">aojea</a>, <a href="https://github.com/kubernetes-sigs/iptables-wrappers/pull/23#" title="Author self-approved">danwinship</a>
The full list of commands accepted by this bot can be found here.
The pull request process is described here
<details >
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
</details>
<!-- META={"approvers":[]} -->
aojea
danwinship
Imports
utiliptablesfrom k/k, fixes up the API some, and adds mode autodetection. With this, we'll be able to make kube-proxy just autodetect the mode itself (https://github.com/kubernetes/kubernetes/pull/143065), without needing an installediptables-wrapperbinary, which will make our lives simpler. (cc @BenTheElder )(Built on top of #21 and #22; this PR starts from "Import utiliptables from k/k".)