Skip to content

Commit c2dd054

Browse files
authored
Tighten private networking validation (#281)
1 parent 35f266a commit c2dd054

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

cli/internal/install/cloudinstall/validation.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ func (envConfig *CloudEnvironmentConfig) QuickValidateConfig(ctx context.Context
5050
hasCompatibilityMode := false
5151
hasBuiltInDomain := false
5252
for _, org := range envConfig.Organizations {
53+
if _, ok := orgNames[org.Name]; ok {
54+
validationError(ctx, &success, "Organization names must be unique")
55+
continue
56+
}
57+
58+
orgNames[org.Name] = nil
5359
if org.SingleOrganizationCompatibilityMode {
5460
if hasCompatibilityMode {
5561
validationError(ctx, &success, "Only one organization can have `singleOrganizationCompatibilityMode` set to true")
@@ -76,13 +82,7 @@ func (envConfig *CloudEnvironmentConfig) QuickValidateConfig(ctx context.Context
7682
hasBuiltInDomain = true
7783
}
7884

79-
if _, ok := orgNames[org.Name]; ok {
80-
validationError(ctx, &success, "Organization names must be unique")
81-
}
82-
83-
orgNames[org.Name] = nil
84-
85-
if !hasBuiltInDomain && envConfig.Cloud.Compute.DnsLabel == "" {
85+
if !envConfig.Cloud.PrivateNetworking && !hasBuiltInDomain && envConfig.Cloud.Compute.DnsLabel == "" {
8686
validationError(ctx, &success, "`cloud.compute.dnsLabel` must be set")
8787
}
8888

@@ -251,6 +251,15 @@ func quickValidateComputeConfig(ctx context.Context, success *bool, cloudConfig
251251
validationError(ctx, success, "The `objectId` field must be a GUID")
252252
}
253253
}
254+
255+
if cloudConfig.PrivateNetworking {
256+
if cloudConfig.Compute.DnsLabel != "" {
257+
validationError(ctx, success, "`cloud.compute.dnsLabel` must not be set when `cloud.privateNetworking` is enabled")
258+
}
259+
if cloudConfig.DnsZone != nil && cloudConfig.DnsZone.Name != "" {
260+
validationError(ctx, success, "`cloud.dnsZone` must not be set when `cloud.privateNetworking` is enabled")
261+
}
262+
}
254263
}
255264

256265
func quickValidateNodePoolConfig(ctx context.Context, success *bool, np *NodePoolConfig, minNodeCount int) {

deploy/config/microsoft/cloudconfig-private-link.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ cloud:
108108
# This must be set if using a custom DNS zone and needs to be globally unique for the Azure region.
109109
# Each organization's domain name will have a CNAME record pointing to the domain name formed
110110
# by this value, which will be <dnslabel>.<region>.cloudapp.azure.com
111-
dnsLabel: ${TYGER_ENVIRONMENT_NAME}-tyger
111+
# dnsLabel:
112112

113113
# Optional Helm chart overrides
114114
# helm:

0 commit comments

Comments
 (0)