Merge pull request #144 from khenidak/master

Kubernetes managed disks support with examples
This commit is contained in:
Cole Mickens 2017-03-10 14:28:26 -08:00 коммит произвёл GitHub
Родитель 21c391b49a 9ce4b73742
Коммит aebadf93a5
8 изменённых файлов: 1962 добавлений и 6 удалений

Просмотреть файл

@ -0,0 +1,37 @@
{
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes"
},
"masterProfile": {
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2"
},
"agentPoolProfiles": [
{
"name": "agent",
"count": 3,
"vmSize": "Standard_D2_v2",
"storageProfile" : "ManagedDisks",
"diskSizesGB": [128, 128, 128, 128],
"availabilityProfile": "AvailabilitySet"
}
],
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": ""
}
]
}
},
"servicePrincipalProfile": {
"servicePrincipalClientID": "",
"servicePrincipalClientSecret": ""
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
{
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes"
},
"masterProfile": {
"count": 1,
"dnsPrefix": "",
"vmSize": "Standard_D2_v2"
},
"agentPoolProfiles": [
{
"name": "agent",
"count": 3,
"vmSize": "Standard_D2_v2",
"storageProfile" : "ManagedDisks",
"availabilityProfile": "AvailabilitySet"
}
],
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": ""
}
]
}
},
"servicePrincipalProfile": {
"servicePrincipalClientID": "",
"servicePrincipalClientSecret": ""
}
}
}

Просмотреть файл

@ -34,6 +34,21 @@
},
"type": "Microsoft.Network/networkInterfaces"
},
{{if .IsManagedDisks}}
{
"location": "[variables('location')]",
"name": "[variables('{{.Name}}AvailabilitySet')]",
"apiVersion": "[variables('apiVersionStorageManagedDisks')]",
"properties":
{
"platformFaultDomainCount": "3",
"platformUpdateDomainCount": "3",
"managed" : "true"
},
"type": "Microsoft.Compute/availabilitySets"
},
{{else if .IsStorageAccount}}
{
"apiVersion": "[variables('apiVersionStorage')]",
"copy": {
@ -50,7 +65,7 @@
},
"type": "Microsoft.Storage/storageAccounts"
},
{{if .HasDisks}}
{{if .HasDisks}}
{
"apiVersion": "[variables('apiVersionStorage')]",
"copy": {
@ -67,24 +82,32 @@
},
"type": "Microsoft.Storage/storageAccounts"
},
{{end}}
{{end}}
{
"apiVersion": "[variables('apiVersionDefault')]",
"location": "[variables('location')]",
"name": "[variables('{{.Name}}AvailabilitySet')]",
"apiVersion": "[variables('apiVersionDefault')]",
"properties": {},
"type": "Microsoft.Compute/availabilitySets"
},
{
{{end}}
{
{{if .IsManagedDisks}}
"apiVersion": "[variables('apiVersionStorageManagedDisks')]",
{{else}}
"apiVersion": "[variables('apiVersionDefault')]",
{{end}}
"copy": {
"count": "[variables('{{.Name}}Count')]",
"name": "vmLoopNode"
},
"dependsOn": [
{{if .IsStorageAccount}}
"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(div(copyIndex(),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(div(copyIndex(),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName'))]",
{{if .HasDisks}}
{{if .HasDisks}}
"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(add(div(copyIndex(),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('dataStorageAccountPrefixSeed')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(add(div(copyIndex(),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('dataStorageAccountPrefixSeed')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}DataAccountName'))]",
{{end}}
{{end}}
"[concat('Microsoft.Network/networkInterfaces/', variables('{{.Name}}VMNamePrefix'), 'nic-', copyIndex())]",
"[concat('Microsoft.Compute/availabilitySets/', variables('{{.Name}}AvailabilitySet'))]"
@ -136,7 +159,9 @@
"publisher": "[variables('osImagePublisher')]",
"sku": "[variables('osImageSKU')]",
"version": "[variables('osImageVersion')]"
},
}
{{if .IsStorageAccount}}
,
"osDisk": {
"caching": "ReadWrite",
"createOption": "FromImage",
@ -145,6 +170,7 @@
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(div(copyIndex(),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(div(copyIndex(),variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName')),variables('apiVersionStorage')).primaryEndpoints.blob,'osdisk/', variables('{{.Name}}VMNamePrefix'), copyIndex(), '-osdisk.vhd')]"
}
}
{{end}}
}
},
"type": "Microsoft.Compute/virtualMachines"

Просмотреть файл

@ -31,6 +31,9 @@
{{end}}
"apiVersionDefault": "2016-03-30",
"apiVersionStorage": "2015-06-15",
{{if .HasManagedDisks}}
"apiVersionStorageManagedDisks": "2016-04-30-preview",
{{end}}
"location": "[resourceGroup().location]",
"masterAvailabilitySet": "[concat('master-availabilityset-', variables('nameSuffix'))]",
"storageAccountBaseName": "[uniqueString(concat(variables('masterFqdnPrefix'),resourceGroup().location, variables('orchestratorName')))]",

68
pkg/acsengine/testdata/disks-managed/kubernetes-vmas.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,68 @@
{
"apiVersion": "vlabs",
"plan": {},
"properties": {
"provisioningState": "",
"orchestratorProfile": {
"orchestratorType": "Kubernetes"
},
"masterProfile": {
"count": 1,
"dnsPrefix": "masterdns1",
"vmSize": "Standard_D2_v2",
"firstConsecutiveStaticIP": "10.240.255.5"
},
"agentPoolProfiles": [
{
"name": "agentpool1",
"count": 3,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet",
"storageProfile": "ManagedDisks",
"diskSizesGB": [
128,
128,
128,
128
]
},
{
"name": "agentpool2",
"count": 3,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "AvailabilitySet",
"storageProfile": "ManagedDisks",
"diskSizesGB": [
10,
10,
10,
10
]
}
],
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa PUBLICKEY azureuser@linuxvm"
}
]
}
},
"windowsProfile": {},
"servicePrincipalProfile": {
"servicePrincipalClientID": "ServicePrincipalClientID",
"servicePrincipalClientSecret": "myServicePrincipalClientSecret"
},
"certificateProfile": {
"caCertificate": "caCertificate",
"apiServerCertificate": "apiServerCertificate",
"apiServerPrivateKey": "apiServerPrivateKey",
"clientCertificate": "clientCertificate",
"clientPrivateKey": "clientPrivateKey",
"kubeConfigCertificate": "kubeConfigCertificate",
"kubeConfigPrivateKey": "kubeConfigPrivateKey"
}
}
}

1703
pkg/acsengine/testdata/disks-managed/kubernetes-vmas_expected.json поставляемый Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -0,0 +1,71 @@
{
"agentpool1Count": {
"value": 3
},
"agentpool1Subnet": {
"value": "10.240.0.0/16"
},
"agentpool1VMSize": {
"value": "Standard_D2_v2"
},
"agentpool2Count": {
"value": 3
},
"agentpool2Subnet": {
"value": "10.240.0.0/16"
},
"agentpool2VMSize": {
"value": "Standard_D2_v2"
},
"apiServerCertificate": {
"value": "YXBpU2VydmVyQ2VydGlmaWNhdGU="
},
"apiServerPrivateKey": {
"value": "YXBpU2VydmVyUHJpdmF0ZUtleQ=="
},
"caCertificate": {
"value": "Y2FDZXJ0aWZpY2F0ZQ=="
},
"clientCertificate": {
"value": "Y2xpZW50Q2VydGlmaWNhdGU="
},
"clientPrivateKey": {
"value": "Y2xpZW50UHJpdmF0ZUtleQ=="
},
"firstConsecutiveStaticIP": {
"value": "10.240.255.5"
},
"kubeConfigCertificate": {
"value": "a3ViZUNvbmZpZ0NlcnRpZmljYXRl"
},
"kubeConfigPrivateKey": {
"value": "a3ViZUNvbmZpZ1ByaXZhdGVLZXk="
},
"kubectlVersion": {
"value": "v1.4.6"
},
"kubernetesHyperkubeSpec": {
"value": "gcr.io/google_containers/hyperkube-amd64:v1.4.6"
},
"linuxAdminUsername": {
"value": "azureuser"
},
"masterEndpointDNSNamePrefix": {
"value": "masterdns1"
},
"masterSubnet": {
"value": "10.240.0.0/16"
},
"masterVMSize": {
"value": "Standard_D2_v2"
},
"servicePrincipalClientId": {
"value": "ServicePrincipalClientID"
},
"servicePrincipalClientSecret": {
"value": "myServicePrincipalClientSecret"
},
"sshRSAPublicKey": {
"value": "ssh-rsa PUBLICKEY azureuser@linuxvm"
}
}

Просмотреть файл

@ -186,6 +186,17 @@ func (a *Properties) Validate() error {
return fmt.Errorf("unknown availability profile type '%s' for agent pool '%s'. Specify either %s, or %s", agentPoolProfile.AvailabilityProfile, agentPoolProfile.Name, AvailabilitySet, VirtualMachineScaleSets)
}
}
switch agentPoolProfile.StorageProfile {
case StorageAccount:
case ManagedDisks:
case "":
default:
{
return fmt.Errorf("unknown storage type '%s' for agent pool '%s'. Specify either %s, or %s", agentPoolProfile.StorageProfile, agentPoolProfile.Name, StorageAccount, ManagedDisks)
}
}
/* this switch statement is left to protect newly added orchestrators until they support Managed Disks*/
if agentPoolProfile.StorageProfile == ManagedDisks {
switch a.OrchestratorProfile.OrchestratorType {
case DCOS:
@ -194,6 +205,7 @@ func (a *Properties) Validate() error {
case DCOS187:
case DCOS188:
case Swarm:
case Kubernetes:
case SwarmMode:
default:
return fmt.Errorf("HA volumes are currently unsupported for Orchestrator %s", a.OrchestratorProfile.OrchestratorType)