Skip to content

Commit

Permalink
Azure: Fix DNS prefix issue when creating the cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
ish-hcc committed Oct 5, 2024
1 parent 4b87171 commit 2f06639
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,9 @@ func getNodeInfoStatus(agentPool armcontainerservice.AgentPool, virtualMachineSc
return irs.NodeGroupInactive
}

func getclusterDNSPrefix(clusterName string) string {
return fmt.Sprintf("%s-dns", clusterName)
func getclusterDNSPrefix() string {
prefix := "dns-"
return fmt.Sprintf("%s%d", prefix, time.Now().UnixNano())
}

func getclusterNodeResourceGroup(clusterName string, resourceGroup string, regionString string) string {
Expand Down Expand Up @@ -1135,7 +1136,7 @@ func createCluster(clusterReqInfo irs.ClusterInfo, ac *AzureClusterHandler) erro
Properties: &armcontainerservice.ManagedClusterProperties{
KubernetesVersion: toStrPtr(clusterReqInfo.Version),
EnableRBAC: toBoolPtr(true),
DNSPrefix: toStrPtr(getclusterDNSPrefix(clusterReqInfo.IId.NameId)),
DNSPrefix: toStrPtr(getclusterDNSPrefix()),
NodeResourceGroup: toStrPtr(getclusterNodeResourceGroup(clusterReqInfo.IId.NameId, ac.Region.Region, ac.Region.Region)),
AgentPoolProfiles: agentPoolProfiles,
NetworkProfile: &networkProfile,
Expand Down

0 comments on commit 2f06639

Please sign in to comment.