Skip to content

Commit

Permalink
Include IPv6 addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
rifelpet committed Sep 6, 2024
1 parent dbabd7b commit 6261b0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/nodemodel/nodeupconfigbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func (n *nodeUpConfigBuilder) BuildConfig(ig *kops.InstanceGroup, wellKnownAddre
var controlPlaneIPs []string
switch cluster.GetCloudProvider() {
case kops.CloudProviderAWS, kops.CloudProviderHetzner, kops.CloudProviderOpenstack:
// Use a private IP address that belongs to the cluster network CIDR (some additional addresses may be FQDNs or public IPs)
// Use a private IP address that belongs to the cluster network CIDR, or any IPv6 addresses (some additional addresses may be FQDNs or public IPs)
for _, additionalIP := range wellKnownAddresses[wellknownservices.KubeAPIServer] {
for _, networkCIDR := range append(cluster.Spec.Networking.AdditionalNetworkCIDRs, cluster.Spec.Networking.NetworkCIDR) {
cidr, err := netip.ParsePrefix(networkCIDR)
Expand All @@ -330,7 +330,7 @@ func (n *nodeUpConfigBuilder) BuildConfig(ig *kops.InstanceGroup, wellKnownAddre
if err != nil {
continue
}
if cidr.Contains(ip) {
if cidr.Contains(ip) || ip.Is6() {
controlPlaneIPs = append(controlPlaneIPs, additionalIP)
}
}
Expand Down

0 comments on commit 6261b0f

Please sign in to comment.