Skip to content

Commit a552812

Browse files
committed
Azure UserProvisionedDNS: Set PrivateDNSZone in CAPZ's NetworkSpec
Set the newly introduced field within CAPZ NetworkSpec that controls creation of the Private DNS zone. During regular cluster installs, set `PrivateDNSZone` to "System" that represents the default. When UserProvisionedDNS is enabled, we do not want the the Private DNS zone to be created so set its value to "None".
1 parent b3b9c53 commit a552812

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/asset/manifests/azure/cluster.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/openshift/installer/pkg/ipnet"
2525
"github.com/openshift/installer/pkg/types"
2626
"github.com/openshift/installer/pkg/types/azure"
27+
"github.com/openshift/installer/pkg/types/dns"
2728
)
2829

2930
// GenerateClusterAssets generates the manifests for the cluster-api.
@@ -197,6 +198,14 @@ func GenerateClusterAssets(installConfig *installconfig.InstallConfig, clusterID
197198
}
198199
}
199200

201+
privateDNSZoneMode := capz.PrivateDNSZoneModeSystem
202+
// When UserProvisionedDNS is enabled, prevent automatic creation of private DNS zone
203+
// because the cloud DNS will not be used. Instead, an in-cluster DNS will be configured
204+
// to resolve api, api-int and *apps URLs.
205+
if installConfig.Config.Azure.UserProvisionedDNS == dns.UserProvisionedDNSEnabled {
206+
privateDNSZoneMode = capz.PrivateDNSZoneModeNone
207+
}
208+
200209
azureCluster := &capz.AzureCluster{
201210
ObjectMeta: metav1.ObjectMeta{
202211
Name: clusterID.InfraID,
@@ -249,6 +258,7 @@ func GenerateClusterAssets(installConfig *installconfig.InstallConfig, clusterID
249258
},
250259
computeSubnetSpec,
251260
},
261+
PrivateDNSZone: &privateDNSZoneMode,
252262
},
253263
},
254264
}

0 commit comments

Comments
 (0)