Skip to content

Commit ffe93b3

Browse files
committed
Update debian-iptables iptables-wrapper script
The debian-iptables v12.0.0 build didn't work because of another previously-undiscovered iptables 1.8.x bug. Work around it for now and bump the version to v12.0.1; we can revert back to the original version of the script once iptables 1.8.4 is available in buster-backports.
1 parent 8a646d2 commit ffe93b3

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

build/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ readonly KUBE_CONTAINER_RSYNC_PORT=8730
9595
kube::build::get_docker_wrapped_binaries() {
9696
local arch=$1
9797
local debian_base_version=v2.0.0
98-
local debian_iptables_version=v12.0.0
98+
local debian_iptables_version=v12.0.1
9999
### If you change any of these lists, please also update DOCKERIZED_BINARIES
100100
### in build/BUILD. And kube::golang::server_image_targets
101101
local targets=(

build/debian-iptables/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
REGISTRY?="staging-k8s.gcr.io"
1818
IMAGE=$(REGISTRY)/debian-iptables
19-
TAG?=v12.0.0
19+
TAG?=v12.0.1
2020
ARCH?=amd64
2121
ALL_ARCH = amd64 arm arm64 ppc64le s390x
2222
TEMP_DIR:=$(shell mktemp -d)

build/debian-iptables/iptables-wrapper

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,22 @@ set -e
1919
# Detect whether the base system is using iptables-legacy or
2020
# iptables-nft. This assumes that some non-containerized process (eg
2121
# kubelet) has already created some iptables rules.
22+
23+
# Bugs in iptables-nft 1.8.3 may cause it to get stuck in a loop in
24+
# some circumstances, so we have to run the nft check in a timeout. To
25+
# avoid hitting that timeout, we only bother to even check nft if
26+
# legacy iptables was empty / mostly empty.
27+
2228
num_legacy_lines=$( (iptables-legacy-save || true; ip6tables-legacy-save || true) 2>/dev/null | grep '^-' | wc -l)
23-
num_nft_lines=$( (iptables-nft-save || true; ip6tables-nft-save || true) 2>/dev/null | grep '^-' | wc -l)
24-
if [ "${num_legacy_lines}" -ge "${num_nft_lines}" ]; then
29+
if [ "${num_legacy_lines}" -ge 10 ]; then
2530
mode=legacy
2631
else
27-
mode=nft
32+
num_nft_lines=$( (timeout 5 sh -c "iptables-nft-save; ip6tables-nft-save" || true) 2>/dev/null | grep '^-' | wc -l)
33+
if [ "${num_legacy_lines}" -ge "${num_nft_lines}" ]; then
34+
mode=legacy
35+
else
36+
mode=nft
37+
fi
2838
fi
2939

3040
update-alternatives --set iptables "/usr/sbin/iptables-${mode}" > /dev/null

build/workspace.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def debian_image_dependencies():
122122
digest = _digest(_DEBIAN_IPTABLES_DIGEST, arch),
123123
registry = "k8s.gcr.io",
124124
repository = "debian-iptables",
125-
tag = "v12.0.0", # ignored, but kept here for documentation
125+
tag = "v12.0.1", # ignored, but kept here for documentation
126126
)
127127

128128
container_pull(

0 commit comments

Comments
 (0)