This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 558
VirtualMachineScaleSets support for Kubernetes #2620
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
526b476
initial commit
sozercan 990bb89
master resource
sozercan af9544a
vmss name and vnet dependency
sozercan 8341d4c
revert master change
sozercan cca6bf4
added parameters for vmType and primaryScaleSetName
sozercan 6e32592
instanceMetadata
sozercan 11f9b9a
update vmss upgrade policy
sozercan 94f724b
update vmss agent
sozercan 020496d
add osdisk and datadisk storage accounts
sozercan 7e6c44e
add validation
sozercan 9a6806f
update example
sozercan d1d59ad
add managed identity
sozercan 1cb4272
windows vmss node
sozercan 192bec7
update example
sozercan d842327
windows update
sozercan 15d7c8a
agent custom image
sozercan af35c81
update windows setup script
sozercan b6fb8f7
disable overprovision
sozercan a5cfe5a
update validation
sozercan 82a56cb
setting hostname dynamically on windows nodes
sozercan a141b74
add tests
sozercan 993a67e
add validation for instanceMetadata
sozercan b2fa47b
update docs
sozercan 8aaac32
update tests
sozercan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"apiVersion": "vlabs", | ||
"properties": { | ||
"orchestratorProfile": { | ||
"orchestratorType": "Kubernetes", | ||
"orchestratorRelease": "1.10", | ||
"kubernetesConfig": { | ||
"useManagedIdentity": true | ||
} | ||
}, | ||
"masterProfile": { | ||
"count": 1, | ||
"dnsPrefix": "", | ||
"vmSize": "Standard_D2_v2" | ||
}, | ||
"agentPoolProfiles": [ | ||
{ | ||
"name": "agentpool1", | ||
"count": 3, | ||
"vmSize": "Standard_D2_v2", | ||
"availabilityProfile": "VirtualMachineScaleSets" | ||
} | ||
], | ||
"linuxProfile": { | ||
"adminUsername": "azureuser", | ||
"ssh": { | ||
"publicKeys": [ | ||
{ | ||
"keyData": "" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
{{if .IsStorageAccount}} | ||
{ | ||
"apiVersion": "[variables('apiVersionStorage')]", | ||
"copy": { | ||
"count": "[variables('{{.Name}}StorageAccountsCount')]", | ||
"name": "loop" | ||
}, | ||
{{if not IsHostedMaster}} | ||
{{if not IsPrivateCluster}} | ||
"dependsOn": [ | ||
"[concat('Microsoft.Network/publicIPAddresses/', variables('masterPublicIPAddressName'))]" | ||
], | ||
{{end}} | ||
{{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]" | ||
}, | ||
"type": "Microsoft.Storage/storageAccounts" | ||
}, | ||
{{if .HasDisks}} | ||
{ | ||
"apiVersion": "[variables('apiVersionStorage')]", | ||
"copy": { | ||
"count": "[variables('{{.Name}}StorageAccountsCount')]", | ||
"name": "datadiskLoop" | ||
}, | ||
{{if not IsHostedMaster}} | ||
{{if not IsPrivateCluster}} | ||
"dependsOn": [ | ||
"[concat('Microsoft.Network/publicIPAddresses/', variables('masterPublicIPAddressName'))]" | ||
], | ||
{{end}} | ||
{{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]" | ||
}, | ||
"type": "Microsoft.Storage/storageAccounts" | ||
}, | ||
{{end}} | ||
{{end}} | ||
{{if UseManagedIdentity}} | ||
{ | ||
"apiVersion": "2014-10-01-preview", | ||
"name": "[guid(concat('Microsoft.Compute/virtualMachineScaleSets/', variables('{{.Name}}VMNamePrefix'), 'vmidentity'))]", | ||
"type": "Microsoft.Authorization/roleAssignments", | ||
"properties": { | ||
"roleDefinitionId": "[variables('readerRoleDefinitionId')]", | ||
"principalId": "[reference(concat('Microsoft.Compute/virtualMachineScaleSets/', variables('{{.Name}}VMNamePrefix')), '2017-03-30', 'Full').identity.principalId]" | ||
} | ||
}, | ||
{{end}} | ||
{ | ||
"apiVersion": "[variables('apiVersionVirtualMachineScaleSets')]", | ||
"dependsOn": [ | ||
{{if .IsCustomVNET}} | ||
"[variables('nsgID')]" | ||
{{else}} | ||
"[variables('vnetID')]" | ||
{{end}} | ||
{{if .IsStorageAccount}} | ||
,"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName'))]" | ||
{{if .HasDisks}} | ||
,"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('dataStorageAccountPrefixSeed')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('dataStorageAccountPrefixSeed')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}DataAccountName'))]" | ||
{{end}} | ||
{{end}} | ||
], | ||
"tags": | ||
{ | ||
"creationSource" : "[concat(variables('generatorCode'), '-', variables('{{.Name}}VMNamePrefix'))]", | ||
"resourceNameSuffix" : "[variables('nameSuffix')]", | ||
"orchestrator" : "[variables('orchestratorNameVersionTag')]", | ||
"poolName" : "{{.Name}}" | ||
}, | ||
"location": "[variables('location')]", | ||
"name": "[variables('{{.Name}}VMNamePrefix')]", | ||
{{if UseManagedIdentity}} | ||
"identity": { | ||
"type": "systemAssigned" | ||
}, | ||
{{end}} | ||
"sku": { | ||
"tier": "Standard", | ||
"capacity": "[variables('{{.Name}}Count')]", | ||
"name": "[variables('{{.Name}}VMSize')]" | ||
}, | ||
"properties": { | ||
"overprovision": false, | ||
"upgradePolicy": { | ||
"mode": "Manual" | ||
}, | ||
"virtualMachineProfile": { | ||
"networkProfile": { | ||
"networkInterfaceConfigurations": [ | ||
{ | ||
"name": "[variables('{{.Name}}VMNamePrefix')]", | ||
"properties": { | ||
"primary": true, | ||
{{if .IsCustomVNET}} | ||
"networkSecurityGroup": { | ||
"id": "[variables('nsgID')]" | ||
}, | ||
{{end}} | ||
"ipConfigurations": [ | ||
{{range $seq := loop 1 .IPAddressCount}} | ||
{ | ||
"name": "ipconfig{{$seq}}", | ||
"properties": { | ||
{{if eq $seq 1}} | ||
"primary": true, | ||
{{end}} | ||
"subnet": { | ||
"id": "[variables('{{$.Name}}VnetSubnetID')]" | ||
} | ||
} | ||
} | ||
{{if lt $seq $.IPAddressCount}},{{end}} | ||
{{end}} | ||
] | ||
{{if not IsAzureCNI}} | ||
,"enableIPForwarding": true | ||
{{end}} | ||
} | ||
} | ||
] | ||
}, | ||
"osProfile": { | ||
"adminUsername": "[variables('username')]", | ||
"computerNamePrefix": "[variables('{{.Name}}VMNamePrefix')]", | ||
{{GetKubernetesAgentCustomData .}} | ||
"linuxConfiguration": { | ||
"disablePasswordAuthentication": "true", | ||
"ssh": { | ||
"publicKeys": [ | ||
{ | ||
"keyData": "[parameters('sshRSAPublicKey')]", | ||
"path": "[variables('sshKeyPath')]" | ||
} | ||
] | ||
} | ||
} | ||
{{if HasLinuxSecrets}} | ||
, | ||
"secrets": "[variables('linuxProfileSecrets')]" | ||
{{end}} | ||
}, | ||
"storageProfile": { | ||
{{if not (UseAgentCustomImage .)}} | ||
{{GetDataDisks .}} | ||
{{end}} | ||
"imageReference": { | ||
{{if UseAgentCustomImage .}} | ||
"id": "[resourceId(variables('{{.Name}}osImageResourceGroup'), 'Microsoft.Compute/images', variables('{{.Name}}osImageName'))]" | ||
{{else}} | ||
"offer": "[variables('{{.Name}}osImageOffer')]", | ||
"publisher": "[variables('{{.Name}}osImagePublisher')]", | ||
"sku": "[variables('{{.Name}}osImageSKU')]", | ||
"version": "[variables('{{.Name}}osImageVersion')]" | ||
{{end}} | ||
}, | ||
"osDisk": { | ||
"createOption": "FromImage", | ||
"caching": "ReadWrite" | ||
{{if .IsStorageAccount}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jackfrancis I think we should validate against storage accounts for new clusters while allowing them for scale ops. Is this possible? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @khenidak I'm not sure what you mean. @JackQuincy can you confirm that there's no special validation/template processing context for deployment vs scale? |
||
,"name": "[concat(variables('{{.Name}}VMNamePrefix'),'-osdisk')]" | ||
,"vhdContainers": [ | ||
"[concat(reference(concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(0,variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(0,variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName')),variables('apiVersionStorage')).primaryEndpoints.blob,'osdisk')]" | ||
] | ||
{{end}} | ||
{{if ne .OSDiskSizeGB 0}} | ||
,"diskSizeGB": {{.OSDiskSizeGB}} | ||
{{end}} | ||
} | ||
}, | ||
"extensionProfile": { | ||
"extensions": [ | ||
{ | ||
"name": "vmssCSE", | ||
"properties": { | ||
"publisher": "Microsoft.Azure.Extensions", | ||
"type": "CustomScript", | ||
"typeHandlerVersion": "2.0", | ||
"autoUpgradeMinorVersion": true, | ||
"settings": {}, | ||
"protectedSettings": { | ||
"commandToExecute": "[concat(variables('provisionScriptParametersCommon'),' /usr/bin/nohup /bin/bash -c \"/bin/bash /opt/azure/containers/provision.sh >> /var/log/azure/cluster-provision.log 2>&1\"')]" | ||
} | ||
} | ||
} | ||
{{if UseManagedIdentity}} | ||
,{ | ||
"name": "managedIdentityExtension", | ||
"properties": { | ||
"publisher": "Microsoft.ManagedIdentity", | ||
"type": "ManagedIdentityExtensionForLinux", | ||
"typeHandlerVersion": "1.0", | ||
"autoUpgradeMinorVersion": true, | ||
"settings": { | ||
"port": 50343 | ||
}, | ||
"protectedSettings": {} | ||
} | ||
} | ||
{{end}} | ||
] | ||
} | ||
} | ||
}, | ||
"type": "Microsoft.Compute/virtualMachineScaleSets" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1006,4 +1006,4 @@ | |
{{end}} | ||
} | ||
} | ||
}{{WriteLinkedTemplatesForExtensions}} | ||
}{{WriteLinkedTemplatesForExtensions}} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a PR recently enabling users to provision using their own images. is this included? Used currently by openshift on acs-engine @jim-minter FYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, seems to be included, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
custom images should be included now