Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
change to zonelength
Browse files Browse the repository at this point in the history
  • Loading branch information
sozercan committed Jul 10, 2018
1 parent d4757f4 commit 79143b1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion parts/k8s/kubernetesagentresourcesvmas.t
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
},
"location": "[variables('location')]",
{{if HaveAvailabilityZones .}}
"zones": "[split(string(add(mod(copyIndex(),{{GetMaxAvailabilityZone .}}),{{GetMinAvailabilityZone .}})), ',')]",
"zones": "[split(string(add(mod(copyIndex(),{{GetAvailabilityZoneLength .}}),{{GetMinAvailabilityZone .}})), ',')]",
{{ end }}
"name": "[concat(variables('{{.Name}}VMNamePrefix'), copyIndex(variables('{{.Name}}Offset')))]",
{{if UseManagedIdentity}}
Expand Down
10 changes: 5 additions & 5 deletions parts/k8s/kubernetesmasterresources.t
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@
"properties": {
"dnsSettings": {
"domainNameLabel": "[variables('masterFqdnPrefix')]"
},
}
{{if HaveMasterAvailabilityZones}}
"publicIPAllocationMethod": "Static"
,"publicIPAllocationMethod": "Static"
{{end}}
},
"type": "Microsoft.Network/publicIPAddresses"
Expand Down Expand Up @@ -768,7 +768,7 @@
},
"location": "[variables('location')]",
{{ if HaveMasterAvailabilityZones}}
"zones": "[split(string(add(mod(copyIndex(),{{GetMasterMaxAvailabilityZone}}),{{GetMasterMinAvailabilityZone}})), ',')]",
"zones": "[split(string(add(mod(copyIndex(),{{GetMasterAvailabilityZoneLength}}),{{GetMasterMinAvailabilityZone}})), ',')]",
{{ end }}
"name": "[concat(variables('masterVMNamePrefix'), copyIndex(variables('masterOffset')))]",
{{if UseManagedIdentity}}
Expand All @@ -784,11 +784,11 @@
},
{{end}}
"properties": {
{{if not HaveMasterAvailabilityZones}}
{{if not HaveMasterAvailabilityZones}}
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets',variables('masterAvailabilitySet'))]"
},
{{end}}
{{end}}
"hardwareProfile": {
"vmSize": "[variables('masterVMSize')]"
},
Expand Down
22 changes: 4 additions & 18 deletions pkg/acsengine/template_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,15 +686,8 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat
}
return min
},
"GetMaxAvailabilityZone": func(profile *api.AgentPoolProfile) int {
max, _ := strconv.Atoi(profile.AvailabilityZones[0])
for _, z := range profile.AvailabilityZones {
i, _ := strconv.Atoi(z)
if max < i {
max = i
}
}
return max
"GetAvailabilityZoneLength": func(profile *api.AgentPoolProfile) int {
return len(profile.AvailabilityZones)
},
"HaveMasterAvailabilityZones": func() bool {
return len(cs.Properties.MasterProfile.AvailabilityZones) > 0
Expand All @@ -709,15 +702,8 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat
}
return min
},
"GetMasterMaxAvailabilityZone": func() int {
max, _ := strconv.Atoi(cs.Properties.MasterProfile.AvailabilityZones[0])
for _, z := range cs.Properties.MasterProfile.AvailabilityZones {
i, _ := strconv.Atoi(z)
if max < i {
max = i
}
}
return max
"GetMasterAvailabilityZoneLength": func() int {
return len(cs.Properties.MasterProfile.AvailabilityZones)
},
"HasLinuxSecrets": func() bool {
return cs.Properties.LinuxProfile.HasSecrets()
Expand Down

0 comments on commit 79143b1

Please sign in to comment.