Skip to content

Commit

Permalink
Include all APIserver addresses for nodeup config
Browse files Browse the repository at this point in the history
  • Loading branch information
rifelpet committed Sep 6, 2024
1 parent 5443451 commit b1861b8
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions pkg/nodemodel/nodeupconfigbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,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)
for _, additionalIP := range wellKnownAddresses[wellknownservices.KubeAPIServer] {
for _, networkCIDR := range append(cluster.Spec.Networking.AdditionalNetworkCIDRs, cluster.Spec.Networking.NetworkCIDR) {
_, cidr, err := net.ParseCIDR(networkCIDR)
if err != nil {
return nil, nil, fmt.Errorf("failed to parse network CIDR %q: %w", networkCIDR, err)
}
if cidr.Contains(net.ParseIP(additionalIP)) {
controlPlaneIPs = append(controlPlaneIPs, additionalIP)
}
}
}
controlPlaneIPs = append(controlPlaneIPs, wellKnownAddresses[wellknownservices.KubeAPIServer]...)

case kops.CloudProviderGCE:
// Use the IP address of the internal load balancer (forwarding-rule)
Expand Down

0 comments on commit b1861b8

Please sign in to comment.