Skip to content

Commit d09d567

Browse files
authored
Merge pull request #1270 from sykim-etri/fix-to-create-cluster-for-non-az-region-in-azure
Fix to create cluster for non AZ region in azure
2 parents 3dc7229 + 0c310a4 commit d09d567

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cloud-control-manager/cloud-driver/drivers/azure/resources/ClusterHandler.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,6 @@ func generateAgentPoolProfileProperties(nodeGroupInfo irs.NodeGroupInfo, subnet
13151315
nodeOSDiskSize = to.Int32Ptr(int32(osDiskSize))
13161316
}
13171317

1318-
targetZones := &[]string{ac.Region.Zone}
1319-
13201318
agentPoolProfileProperties := containerservice.ManagedClusterAgentPoolProfileProperties{
13211319
// Name: to.StringPtr(nodeGroupInfo.IId.NameId),
13221320
Count: to.Int32Ptr(int32(nodeGroupInfo.DesiredNodeSize)),
@@ -1328,12 +1326,16 @@ func generateAgentPoolProfileProperties(nodeGroupInfo irs.NodeGroupInfo, subnet
13281326
Type: containerservice.AgentPoolTypeVirtualMachineScaleSets,
13291327
MaxPods: to.Int32Ptr(maxPodCount),
13301328
Mode: containerservice.AgentPoolModeSystem, // User? System?
1331-
AvailabilityZones: targetZones,
13321329
EnableNodePublicIP: to.BoolPtr(true),
13331330
EnableAutoScaling: to.BoolPtr(nodeGroupInfo.OnAutoScaling),
13341331
// MinCount가 있으려면 true 여야함
13351332
VnetSubnetID: subnet.ID,
13361333
}
1334+
1335+
if !strings.EqualFold(ac.Region.Zone, "") {
1336+
agentPoolProfileProperties.AvailabilityZones = &[]string{ac.Region.Zone}
1337+
}
1338+
13371339
return agentPoolProfileProperties, nil
13381340
}
13391341

@@ -1350,8 +1352,6 @@ func generateAgentPoolProfile(nodeGroupInfo irs.NodeGroupInfo, subnet network.Su
13501352
nodeOSDiskSize = to.Int32Ptr(int32(osDiskSize))
13511353
}
13521354

1353-
targetZones := &[]string{ac.Region.Zone}
1354-
13551355
agentPoolProfile := containerservice.ManagedClusterAgentPoolProfile{
13561356
Name: to.StringPtr(nodeGroupInfo.IId.NameId),
13571357
Count: to.Int32Ptr(int32(nodeGroupInfo.DesiredNodeSize)),
@@ -1363,7 +1363,6 @@ func generateAgentPoolProfile(nodeGroupInfo irs.NodeGroupInfo, subnet network.Su
13631363
Type: containerservice.AgentPoolTypeVirtualMachineScaleSets,
13641364
MaxPods: to.Int32Ptr(maxPodCount),
13651365
Mode: containerservice.AgentPoolModeSystem, // User? System?
1366-
AvailabilityZones: targetZones,
13671366
EnableNodePublicIP: to.BoolPtr(true),
13681367
EnableAutoScaling: to.BoolPtr(nodeGroupInfo.OnAutoScaling),
13691368
// MinCount가 있으려면 true 여야함
@@ -1373,6 +1372,11 @@ func generateAgentPoolProfile(nodeGroupInfo irs.NodeGroupInfo, subnet network.Su
13731372
agentPoolProfile.MinCount = nil
13741373
agentPoolProfile.MaxCount = nil
13751374
}
1375+
1376+
if !strings.EqualFold(ac.Region.Zone, "") {
1377+
agentPoolProfile.AvailabilityZones = &[]string{ac.Region.Zone}
1378+
}
1379+
13761380
return agentPoolProfile, nil
13771381
}
13781382

0 commit comments

Comments
 (0)