GCE: enable NAT64 for IPv6-only clusters#18520
Conversation
On GCE, IPv6-only clusters use dual-stack (IPV4_IPV6) subnets because GCE does not support IPV6_ONLY subnets yet; pods are still IPv6-only. Without NAT64 those pods cannot reach IPv4-only destinations. Set SourceSubnetworkIpRangesToNat64 = ALL_IPV6_SUBNETWORKS on the CloudNAT router whenever IsIPv6Only() is true. GCE then translates outbound IPv6 packets addressed to the NAT64 well-known prefix (64:ff9b::/96) into IPv4, mirroring the explicit 64:ff9b::/96 route that AWS adds to private route tables for IPv6-only clusters. Add a unit test that builds the NetworkModelBuilder for both an IPv6-only cluster (NonMasqueradeCIDR = fd00::/56) and a normal cluster (NonMasqueradeCIDR = 100.64.0.0/10), and asserts the Router task carries the expected SourceSubnetworkIPRangesToNAT64 value in each case. Signed-off-by: shreyaabaranwal <shreyabaranwal229@gmail.com>
|
Welcome @shreyaabaranwal! |
|
Hi @shreyaabaranwal. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Opened a first PR for this: #18520 Scope: enables NAT64 on the GCE Cloud NAT router when the cluster |
What this does
GCE pods on an IPv6-only cluster currently have no way to reach
IPv4-only destinations — there's just no NAT64 path for them. AWS
already solved this with a 64:ff9b::/96 route (see
pkg/model/awsmodel/network.go), so this PR brings GCE up to speed by
enabling NAT64 on the Cloud NAT router whenever the cluster is
IPv6-only (
spec.IsIPv6Only()).Scope
Good news: this turned out smaller than I expected, because GCE's
Cloud NAT already has built-in NAT64 support — it was just never
wired up in kOps.
Per the discussion on #17840, this PR sticks to the part apeabody
flagged as the priority: pod/service networking goes IPv6-only,
while the VMs and subnets stay comfortably dual-stack
(
stackType=IPV4_IPV6) for now. Making the VMs/subnets themselvesIPv6-only is a bigger lift and is left for a follow-up PR.
Changes
upup/pkg/fi/cloudup/gcetasks/router.go— adds aSourceSubnetworkIPRangesToNAT64field to the Router task, wiredthrough
Find,RenderGCE, andRenderTerraform. (Also added asmall nil-guard here so non-IPv6 clusters don't end up with a
permanent phantom diff on every
kops update cluster— found thatone the hard way during testing.)
pkg/model/gcemodel/network.go— sets NAT64 toALL_IPV6_SUBNETWORKSon the Cloud NAT router whenb.IsIPv6Only()is true. Five lines, does its job.pkg/model/gcemodel/network_test.go— new table-driven testcovering both the IPv6-only and non-IPv6-only paths, since there
wasn't an existing unit test file for
network.goto extend.Testing
go build ./upup/pkg/fi/cloudup/gcetasks/... ./pkg/model/gcemodel/...✅go test ./upup/pkg/fi/cloudup/gcetasks/... ./pkg/model/gcemodel/...✅This is my first contribution to kOps, so very open to feedback on
approach, naming, or anything I might've missed!
/kind feature
Part of #17840