Skip to content

Commit

Permalink
Change GeneratePrivateFQDN to use zone name instead of cluster name
Browse files Browse the repository at this point in the history
  • Loading branch information
dlipovetsky committed Nov 29, 2021
1 parent 1ebc3a6 commit 4c2d709
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions azure/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func GeneratePrivateDNSZoneName(clusterName string) string {
return fmt.Sprintf("%s.capz.io", clusterName)
}

// GeneratePrivateFQDN generates the FQDN for a private API Server based on the private DNS zone name.
func GeneratePrivateFQDN(zoneName string) string {
return fmt.Sprintf("%s.%s", PrivateAPIServerHostname, zoneName)
}

// GenerateVNetLinkName generates the name of a virtual network link name based on the vnet name.
func GenerateVNetLinkName(vnetName string) string {
return fmt.Sprintf("%s-link", vnetName)
Expand Down
2 changes: 1 addition & 1 deletion azure/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ func (s *ClusterScope) APIServerPort() int32 {
// APIServerHost returns the hostname used to reach the API server.
func (s *ClusterScope) APIServerHost() string {
if s.IsAPIServerPrivate() {
return fmt.Sprintf("%s.%s", azure.PrivateAPIServerHostname, s.GetPrivateDNSZoneName())
return azure.GeneratePrivateFQDN(s.GetPrivateDNSZoneName())
}
return s.APIServerPublicIP().DNSName
}
Expand Down

0 comments on commit 4c2d709

Please sign in to comment.