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

Commit

Permalink
Update apiversion to make it consistent in k8s templates (#3909)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecile Robert-Michon authored and jackfrancis committed Oct 12, 2018
1 parent 4f09c2c commit 94d7cf6
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 170 deletions.
2 changes: 1 addition & 1 deletion docs/custom-vnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The Azure Resource Manager template used to deploy this virtual network is:
"variables": { },
"resources": [
{
"apiVersion": "2016-03-30",
"apiVersion": "2018-06-01",
"location": "[resourceGroup().location]",
"name": "ExampleCustomVNET",
"properties": {
Expand Down
13 changes: 5 additions & 8 deletions docs/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ The following is an example of the template.json file.
"description": "Storage API Version"
}
},
"apiVersionDefault": {
"apiVersionCompute": {
"type": "string",
"minLength": 1,
"metadata": {
Expand Down Expand Up @@ -183,7 +183,7 @@ The following is an example of the template.json file.
},
"type": "Microsoft.Storage/storageAccounts"
}, {
"apiVersion": "[parameters('apiVersionDefault')]",
"apiVersion": "[parameters('apiVersionCompute')]",
"dependsOn": [],
"location": "[resourceGroup().location]",
"type": "Microsoft.Compute/virtualMachines/extensions",
Expand Down Expand Up @@ -222,7 +222,7 @@ Replace "**EXTENSION-NAME**" with the name of the extension.
{
"name": "EXTENSION-NAME",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('apiVersionLinkDefault')]",
"apiVersion": "[variables('apiVersionCompute')]",
"dependsOn": [
"vmLoopNode"
],
Expand All @@ -233,11 +233,8 @@ Replace "**EXTENSION-NAME**" with the name of the extension.
"contentVersion": "1.0.0.0"
},
"parameters": {
"apiVersionStorage": {
"value": "[variables('apiVersionStorage')]"
},
"apiVersionDefault": {
"value": "[variables('apiVersionDefault')]"
"apiVersionCompute": {
"value": "[variables('apiVersionCompute')]"
},
"username": {
"value": "[parameters('linuxAdminUsername')]"
Expand Down
4 changes: 2 additions & 2 deletions extensions/choco/v1/template-link.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), 'Choco')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('apiVersionLinkDefault')]",
"apiVersion": "[variables('apiVersionCompute')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), '/extensions/cse', '-EXTENSION_TARGET_VM_TYPE-', copyIndex(EXTENSION_LOOP_OFFSET))]"
],
Expand All @@ -20,7 +20,7 @@
"value": "EXTENSION_URL_REPLACE"
},
"apiVersionCompute": {
"value": "[variables('apiVersionDefault')]"
"value": "[variables('apiVersionCompute')]"
},
"targetVMName": {
"value": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET))]"
Expand Down
4 changes: 2 additions & 2 deletions extensions/hello-world-k8s/v1/template-link.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), 'HelloWorldK8s')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('apiVersionLinkDefault')]",
"apiVersion": "[variables('apiVersionCompute')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), '/extensions/cse', '-EXTENSION_TARGET_VM_TYPE-', copyIndex(EXTENSION_LOOP_OFFSET))]"
],
Expand All @@ -20,7 +20,7 @@
"value": "EXTENSION_URL_REPLACE"
},
"apiVersionCompute": {
"value": "[variables('apiVersionDefault')]"
"value": "[variables('apiVersionCompute')]"
},
"targetVMName": {
"value": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET))]"
Expand Down
6 changes: 3 additions & 3 deletions extensions/microsoft-oms-agent-k8s/v1/template-link.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), 'MicrosoftOMSAgentk8s')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('apiVersionLinkDefault')]",
"apiVersion": "[variables('apiVersionCompute')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), '/extensions/cse', '-EXTENSION_TARGET_VM_TYPE-', copyIndex(EXTENSION_LOOP_OFFSET))]"
],
Expand All @@ -19,8 +19,8 @@
"artifactsLocation": {
"value": "EXTENSION_URL_REPLACE"
},
"apiVersionDefault": {
"value": "[variables('apiVersionDefault')]"
"apiVersionCompute": {
"value": "[variables('apiVersionCompute')]"
},
"targetVMName": {
"value": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET))]"
Expand Down
4 changes: 2 additions & 2 deletions extensions/microsoft-oms-agent-k8s/v1/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"description": "Artifacts Location - URL"
}
},
"apiVersionDefault": {
"apiVersionCompute": {
"type": "string",
"minLength": 1,
"metadata": {
Expand Down Expand Up @@ -50,7 +50,7 @@
},
"resources": [
{
"apiVersion": "[parameters('apiVersionDefault')]",
"apiVersion": "[parameters('apiVersionCompute')]",
"dependsOn": [],
"location": "[resourceGroup().location]",
"type": "Microsoft.Compute/virtualMachines/extensions",
Expand Down
4 changes: 2 additions & 2 deletions extensions/prometheus-grafana-k8s/v1/template-link.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), 'PrometheusGrafanaK8s')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('apiVersionLinkDefault')]",
"apiVersion": "[variables('apiVersionComput')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), '/extensions/cse', '-EXTENSION_TARGET_VM_TYPE-', copyIndex(EXTENSION_LOOP_OFFSET))]"
],
Expand All @@ -20,7 +20,7 @@
"value": "EXTENSION_URL_REPLACE"
},
"apiVersionCompute": {
"value": "[variables('apiVersionDefault')]"
"value": "[variables('apiVersionCompute')]"
},
"targetVMName": {
"value": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET))]"
Expand Down
4 changes: 2 additions & 2 deletions extensions/windows-patches/v1/template-link.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), 'windows-patches')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('apiVersionLinkDefault')]",
"apiVersion": "[variables('apiVersionCompute')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), '/extensions/cse', '-EXTENSION_TARGET_VM_TYPE-', copyIndex(EXTENSION_LOOP_OFFSET))]"
],
Expand All @@ -20,7 +20,7 @@
"value": "EXTENSION_URL_REPLACE"
},
"apiVersionCompute": {
"value": "[variables('apiVersionDefault')]"
"value": "[variables('apiVersionCompute')]"
},
"targetVMName": {
"value": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET))]"
Expand Down
4 changes: 2 additions & 2 deletions extensions/winrm/v1/template-link.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), 'winrm')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('apiVersionLinkDefault')]",
"apiVersion": "[variables('apiVersionCompute')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET), '/extensions/cse', '-EXTENSION_TARGET_VM_TYPE-', copyIndex(EXTENSION_LOOP_OFFSET))]"
],
Expand All @@ -20,7 +20,7 @@
"value": "EXTENSION_URL_REPLACE"
},
"apiVersionCompute": {
"value": "[variables('apiVersionDefault')]"
"value": "[variables('apiVersionCompute')]"
},
"targetVMName": {
"value": "[concat(EXTENSION_TARGET_VM_NAME_PREFIX, copyIndex(EXTENSION_LOOP_OFFSET))]"
Expand Down
43 changes: 16 additions & 27 deletions parts/k8s/kubernetesagentresourcesvmas.t
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
{{if .AcceleratedNetworkingEnabled}}
"apiVersion": "2018-04-01",
{{else}}
"apiVersion": "[variables('apiVersionDefault')]",
{{end}}
"apiVersion": "[variables('apiVersionNetwork')]",
"copy": {
"count": "[sub(variables('{{.Name}}Count'), variables('{{.Name}}Offset'))]",
"name": "loop"
Expand Down Expand Up @@ -84,14 +80,15 @@
{
"location": "[variables('location')]",
"name": "[variables('{{.Name}}AvailabilitySet')]",
"apiVersion": "[variables('apiVersionStorageManagedDisks')]",
"apiVersion": "[variables('apiVersionCompute')]",
"properties":
{
"platformFaultDomainCount": 2,
"platformUpdateDomainCount": 3,
"managed" : "true"
"platformUpdateDomainCount": 3
},

"sku": {
"name": "Aligned"
},
"type": "Microsoft.Compute/availabilitySets"
},
{{else if .IsStorageAccount}}
Expand All @@ -110,8 +107,8 @@
{{end}}
"location": "[variables('location')]",
"name": "[concat(variables('storageAccountPrefixes')[mod(add(copyIndex(),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(copyIndex(),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName'))]",
"properties": {
"accountType": "[variables('vmSizesMap')[variables('{{.Name}}VMSize')].storageAccountType]"
"sku": {
"name": "[variables('vmSizesMap')[variables('{{.Name}}VMSize')].storageAccountType]"
},
"type": "Microsoft.Storage/storageAccounts"
},
Expand All @@ -131,30 +128,22 @@
{{end}}
"location": "[variables('location')]",
"name": "[concat(variables('storageAccountPrefixes')[mod(add(copyIndex(variables('dataStorageAccountPrefixSeed')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(copyIndex(variables('dataStorageAccountPrefixSeed')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}DataAccountName'))]",
"properties": {
"accountType": "[variables('vmSizesMap')[variables('{{.Name}}VMSize')].storageAccountType]"
"sku": {
"name": "[variables('vmSizesMap')[variables('{{.Name}}VMSize')].storageAccountType]"
},
"type": "Microsoft.Storage/storageAccounts"
},
{{end}}
{
"location": "[variables('location')]",
"name": "[variables('{{.Name}}AvailabilitySet')]",
"apiVersion": "[variables('apiVersionDefault')]",
"apiVersion": "[variables('apiVersionCompute')]",
"properties": {},
"type": "Microsoft.Compute/availabilitySets"
},
{{end}}
{
{{if UserAssignedIDEnabled}}
"apiVersion": "[variables('apiVersionUserMSI')]",
{{else}}
{{if .IsManagedDisks}}
"apiVersion": "[variables('apiVersionStorageManagedDisks')]",
{{else}}
"apiVersion": "[variables('apiVersionDefault')]",
{{end}}
{{end}}
"apiVersion": "[variables('apiVersionCompute')]",
"copy": {
"count": "[sub(variables('{{.Name}}Count'), variables('{{.Name}}Offset'))]",
"name": "vmLoopNode"
Expand Down Expand Up @@ -271,7 +260,7 @@
{{if UseManagedIdentity}}
{{if (not UserAssignedIDEnabled)}}
{
"apiVersion": "2014-10-01-preview",
"apiVersion": "[variables('apiVersionCompute')]",
"copy": {
"count": "[sub(variables('{{.Name}}Count'), variables('{{.Name}}Offset'))]",
"name": "vmLoopNode"
Expand All @@ -291,7 +280,7 @@
"count": "[sub(variables('{{.Name}}Count'), variables('{{.Name}}Offset'))]",
"name": "vmLoopNode"
},
"apiVersion": "2015-05-01-preview",
"apiVersion": "[variables('apiVersionCompute')]",
"location": "[resourceGroup().location]",
{{if UserAssignedIDEnabled}}
"dependsOn": [
Expand All @@ -316,7 +305,7 @@
},
{{end}}
{
"apiVersion": "[variables('apiVersionDefault')]",
"apiVersion": "[variables('apiVersionCompute')]",
"copy": {
"count": "[sub(variables('{{.Name}}Count'), variables('{{.Name}}Offset'))]",
"name": "vmLoopNode"
Expand Down Expand Up @@ -350,7 +339,7 @@
,{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('{{.Name}}VMNamePrefix'), copyIndex(variables('{{.Name}}Offset')), '/computeAksLinuxBilling')]",
"apiVersion": "[variables('apiVersionDefault')]",
"apiVersion": "[variables('apiVersionCompute')]",
"copy": {
"count": "[sub(variables('{{.Name}}Count'), variables('{{.Name}}Offset'))]",
"name": "vmLoopNode"
Expand Down
4 changes: 2 additions & 2 deletions parts/k8s/kubernetesagentresourcesvmss.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{if and UseManagedIdentity (not UserAssignedIDEnabled)}}
{
"apiVersion": "2014-10-01-preview",
"apiVersion": "[variables('apiVersionCompute')]",
"name": "[guid(concat('Microsoft.Compute/virtualMachineScaleSets/', variables('{{.Name}}VMNamePrefix'), 'vmidentity'))]",
"type": "Microsoft.Authorization/roleAssignments",
"properties": {
Expand All @@ -10,7 +10,7 @@
},
{{end}}
{
"apiVersion": "[variables('apiVersionVirtualMachineScaleSets')]",
"apiVersion": "[variables('apiVersionCompute')]",
"dependsOn": [
{{if .IsCustomVNET}}
"[variables('nsgID')]"
Expand Down
8 changes: 4 additions & 4 deletions parts/k8s/kubernetesbase.t
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
{
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"name": "[variables('userAssignedID')]",
"apiVersion": "2015-08-31-PREVIEW",
"apiVersion": "[variables('apiVersionCompute')]",
"location": "[variables('location')]"
},
{{end}}
Expand All @@ -86,7 +86,7 @@
{{if IsHostedMaster}}
{{if not IsCustomVNET}}
,{
"apiVersion": "[variables('apiVersionDefault')]",
"apiVersion": "[variables('apiVersionNetwork')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]"
{{if not IsAzureCNI}}
Expand Down Expand Up @@ -125,14 +125,14 @@
{{end}}
{{if not IsAzureCNI}}
,{
"apiVersion": "[variables('apiVersionDefault')]",
"apiVersion": "[variables('apiVersionNetwork')]",
"location": "[variables('location')]",
"name": "[variables('routeTableName')]",
"type": "Microsoft.Network/routeTables"
}
{{end}}
,{
"apiVersion": "[variables('apiVersionDefault')]",
"apiVersion": "[variables('apiVersionNetwork')]",
"location": "[variables('location')]",
"name": "[variables('nsgName')]",
"properties": {
Expand Down
Loading

0 comments on commit 94d7cf6

Please sign in to comment.