fix(iptables): emit one DNS rule per address - #12
Closed
mxhob1 wants to merge 1 commit into
Closed
Conversation
…oke iptables-restore, wedging forwarding)
Member
Author
|
Superseded by the PR against noden/main — main has diverged and doesn't carry the liveness feature, so a fix merged here would never reach production. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Wireguard.status.dnscan hold more than one resolver (an anycast pair, e.g."172.31.255.253, 172.31.255.254").GenerateIptableRulesFromNetworkPoliciesinterpolated that string straight into a single rule:iptables-restoretakes one address per-dand tokenises on whitespace, so it aborts:Impact:
iptables-restoreis all-or-nothing. Every agent state sync fails, leaving the ruleset half-applied and forwarding throughwg0broken for ~10s — while the pod itself stays pingable. In production this fired on every operator state push (each triggered by routine peer liveness transitions from road-warrior peers), causing synchronised ~100-device monitoring outages several times a day, chronically. Observed on 2 of 7 tenants in a 30-minute window.Fix
Split
kubeDnsIpon commas, trim, skip empties, and emit one UDP + one TCP rule per address. Safe for IPv6 (addresses use:not,) and a no-op for the single-address case.Verification
Multiple DNS servers emit one rule per addressreproduced the exact prod output (-d 172.31.255.253, 172.31.255.254 ...) before the fix.TestIptableRulessubtests pass;internal/ipam+internal/iptablespass;go build ./...,go vet,gofmtclean. (internal/controllerneeds envtest assets, not run.)iptables-restore --test(dry-run):Bad argument `172.31.255.254'🤖 Generated with Claude Code