Repository navigation
fix(k8s): fall back to legacy iptables - #2130
stephenlclarke wants to merge 2 commits into
Conversation
f963e3e to
7ab8caf
Compare
|
Rebased onto current Post-rebase validation:
The PR is mergeable again. GitHub currently reports the workflow as |
7ab8caf to
b2d773b
Compare
b2d773b to
ea3c5f5
Compare
|
Rebased cleanly onto current Apple Exact-head focused verification: @codex review |
ea3c5f5 to
a496a3a
Compare
|
Refresh 2026-09-05: rebased the single signed fix onto current Apple |
a496a3a to
1c47025
Compare
a4e5e66 to
e988163
Compare
3410b90 to
8cd7cc7
Compare
| iptablesPath: String = "/usr/sbin/iptables" | ||
| ) -> String { | ||
| """ | ||
| if ! \(nftPath) -t mangle -S >/dev/null 2>&1; then |
There was a problem hiding this comment.
Could you add a helper like the following, and replace the direct interpolations here with one that expressly prohibits injection. I know we're injecting constants that we control here but better to be able to look at the code and know we're doing safe shell interpolation.
/// Quotes `value` as a single shell word: wrapped in single quotes, with each
/// embedded single quote written as '\''.
private static func shellQuote(_ value: String) -> String {
"'" + value.replacingOccurrences(of: "'", with: "'\\''") + "'"
}There was a problem hiding this comment.
Thanks Jon. I added shellQuote and use it for every path in the helper. The tests cover spaces, quotes and shell characters in those paths. All five node-preparation tests pass on macOS.
| \(updateAlternativesPath) --set iptables \(legacyPath) | ||
| \(updateAlternativesPath) --set ip6tables \(ip6LegacyPath) | ||
| fi | ||
| \(iptablesPath) -t mangle -A OUTPUT -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1220 |
There was a problem hiding this comment.
We could make these idempotent by trying -C … || -A …
There was a problem hiding this comment.
Done. Each rule uses -C before -A. The test runs setup twice and checks that each rule is added once. A failed insertion still stops setup.
|
@stephenlclarke Looks good, made a couple suggestions. |
Probe the nftables backend during node preparation and select the legacy iptables alternatives when the node kernel cannot use nftables. Apply the MSS rules through the selected system backend. Fixes apple#2120
8cd7cc7 to
b1fd7f4
Compare
Type of Change
Motivation and Context
Closes #2120.
Probe the nftables backend during node preparation. When the node kernel cannot use it, select the available legacy iptables and ip6tables alternatives before applying the MSS rules. This also keeps subsequent Kubernetes components on the working backend.
Node preparation now runs through
LinuxNodeProvisioner. All interpolated paths are shell-quoted. Each MSS rule is added only if it is absent.Testing
All five node-preparation tests passed on macOS. They cover nftables selection, quoted paths, repeated setup and failed rule insertion. Swift format and whitespace checks passed. Both commits are signed.
Earlier validation passed 758 non-integration tests. Without the fallback, the failure fixture applied neither the fallback nor the MSS rules. The broader suite was not rerun for the upstream module rename.