зеркало из https://github.com/Azure/aks-engine.git
added a classic mode where it will put in the classic parameters and outputs
This commit is contained in:
Родитель
f92715ba96
Коммит
2ed08e281f
|
@ -183,6 +183,7 @@ func usage(errs ...error) {
|
|||
var templateDirectory = flag.String("templateDirectory", "./parts", "directory containing base template files")
|
||||
var noPrettyPrint = flag.Bool("noPrettyPrint", false, "do not pretty print output")
|
||||
var artifactsDir = flag.String("artifacts", "", "directory where artifacts will be written")
|
||||
var classicMode = flag.Bool("classicMode", false, "enable classic parameters and outputs")
|
||||
|
||||
func main() {
|
||||
var acsCluster *vlabs.AcsCluster
|
||||
|
@ -224,6 +225,10 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
if *classicMode {
|
||||
acsCluster.SetClassicMode(true)
|
||||
}
|
||||
|
||||
if template, parameters, err = tgen.GenerateTemplate(acsCluster, *templateDirectory); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error generating template %s: %s", jsonFile, err.Error())
|
||||
os.Exit(1)
|
||||
|
|
|
@ -9,6 +9,8 @@ type AcsCluster struct {
|
|||
LinuxProfile LinuxProfile `json:"linuxProfile"`
|
||||
ServicePrincipalProfile ServicePrincipalProfile `json:"servicePrincipalProfile"`
|
||||
CertificateProfile CertificateProfile `json:"certificateProfile"`
|
||||
// classic mode is used to output parameters and outputs
|
||||
classicMode bool
|
||||
}
|
||||
|
||||
// OrchestratorProfile represents the type of orchestrator
|
||||
|
@ -89,6 +91,16 @@ type APIObject interface {
|
|||
Validate() error
|
||||
}
|
||||
|
||||
// GetClassicMode gets the classic mode for deciding to output classic parameters
|
||||
func (a *AcsCluster) GetClassicMode() bool {
|
||||
return a.classicMode
|
||||
}
|
||||
|
||||
// SetClassicMode toggles classic parameters and outputs
|
||||
func (a *AcsCluster) SetClassicMode(isClassicMode bool) {
|
||||
a.classicMode = isClassicMode
|
||||
}
|
||||
|
||||
// HasWindows returns true if the cluster contains windows
|
||||
func (a *AcsCluster) HasWindows() bool {
|
||||
for _, agentPoolProfile := range a.AgentPoolProfiles {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
}
|
||||
{{else}}
|
||||
"{{.Name}}Subnet": {
|
||||
"defaultValue": "{{.GetSubnet}}",
|
||||
"metadata": {
|
||||
"description": "Sets the subnet of agent pool '{{.Name}}'."
|
||||
},
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
"agentEndpointDNSNamePrefix": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "Sets the Domain name label for the agent pool IP Address. The concatenation of the domain name label and the regional DNS zone make up the fully qualified domain name associated with the public IP address."
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"disablePasswordAuthentication": {
|
||||
"defaultValue": true,
|
||||
"metadata": {
|
||||
"description": "This setting controls whether password auth is disabled for Linux VMs provisioned by this template. Default is true which disables password and makes SSH key required."
|
||||
},
|
||||
"type": "bool"
|
||||
},
|
||||
"enableNewStorageAccountNaming": {
|
||||
"defaultValue": true,
|
||||
"metadata": {
|
||||
"description": "If true: uses DNS name prefix + Orchestrator name + Region to create storage account name to reduce name collision probability. If false: uses DNS name prefix + Orchestrator name to create storage account name to maintain template idempotency."
|
||||
},
|
||||
"type": "bool"
|
||||
},
|
||||
"enableVMDiagnostics": {
|
||||
"defaultValue": true,
|
||||
"metadata": {
|
||||
"description": "Allows user to enable/disable boot & vm diagnostics."
|
||||
},
|
||||
"type": "bool"
|
||||
},
|
||||
"isValidation": {
|
||||
"allowedValues": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"defaultValue": 0,
|
||||
"metadata": {
|
||||
"description": "This is testing in the validation region"
|
||||
},
|
||||
"type": "int"
|
||||
},
|
||||
"jumpboxEndpointDNSNamePrefix": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "Sets the Domain name label for the jumpbox. The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address."
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"linuxAdminPassword": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "Password for the Linux Virtual Machine. Not Required. If not set, you must provide a SSH key."
|
||||
},
|
||||
"type": "securestring"
|
||||
},
|
||||
"linuxOffer": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "This is the offer of the image used by the linux cluster"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"linuxPublisher": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "This is the publisher of the image used by the linux cluster"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"linuxSku": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "This is the linux sku used by the linux cluster"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"linuxVersion": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "This is the linux version used by the linux cluster"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"masterCount": {
|
||||
"allowedValues": [
|
||||
1,
|
||||
3,
|
||||
5
|
||||
],
|
||||
"defaultValue": 1,
|
||||
"metadata": {
|
||||
"description": "The number of Mesos masters for the cluster."
|
||||
},
|
||||
"type": "int"
|
||||
},
|
||||
"oauthEnabled": {
|
||||
"allowedValues": [
|
||||
"true",
|
||||
"false"
|
||||
],
|
||||
"defaultValue": "false",
|
||||
"metadata": {
|
||||
"description": "Enable OAuth authentication"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"postInstallScriptURI": {
|
||||
"defaultValue": "disabled",
|
||||
"metadata": {
|
||||
"description": "After installation, this specifies a script to download and install. To disabled, set value to 'disabled'."
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"setLinuxConfigurationForVMCreate": {
|
||||
"allowedValues": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"defaultValue": 1,
|
||||
"metadata": {
|
||||
"description": "This setting controls whether Linux configuration with SSH Key is passed in VM PUT Payload. Defaults to 1. If SSH Key is blank, this must be set to 0."
|
||||
},
|
||||
"type": "int"
|
||||
},
|
||||
"vmsPerStorageAccount": {
|
||||
"defaultValue": 5,
|
||||
"metadata": {
|
||||
"description": "This specifies the number of VMs per storage accounts"
|
||||
},
|
||||
"type": "int"
|
||||
},
|
||||
{{if not .HasWindows}}
|
||||
"windowsAdminPassword": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "Password for the Windows Virtual Machine."
|
||||
},
|
||||
"type": "securestring"
|
||||
},
|
||||
"windowsAdminUsername": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "User name for the Windows Virtual Machine (Password Only Supported)."
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
{{end}}
|
||||
"windowsJumpboxOffer": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "This is the windows offer used by the windows"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"windowsJumpboxPublisher": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "This is the windows publisher used by the windows"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"windowsJumpboxSku": {
|
||||
"defaultValue": "UNUSED",
|
||||
"metadata": {
|
||||
"description": "This is the windows sku used by the windows"
|
||||
},
|
||||
"type": "string"
|
||||
}
|
|
@ -41,7 +41,7 @@
|
|||
"[concat(variables('masterVMNamePrefix'), 'nic-6')]"
|
||||
],
|
||||
"masterVMSize": "[parameters('masterVMSize')]",
|
||||
"nameSuffix": "{{GetUniqueNameSuffix}}",
|
||||
"nameSuffix": "[parameters('nameSuffix')]",
|
||||
"oauthEnabled": "false",
|
||||
"orchestratorName": "dcos",
|
||||
"osImageOffer": "UbuntuServer",
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"masterAvailabilitySet": "master-availabilityset",
|
||||
"storageAccountBaseName": "[uniqueString(concat(variables('masterFqdnPrefix'),resourceGroup().location, variables('orchestratorName')))]",
|
||||
"masterStorageAccountName": "[concat(variables('storageAccountBaseName'), 'mstr0')]",
|
||||
"nameSuffix": "{{GetUniqueNameSuffix}}",
|
||||
"nameSuffix": "[parameters('nameSuffix')]",
|
||||
"orchestratorName": "k8s",
|
||||
"osImageOffer": "UbuntuServer",
|
||||
"osImagePublisher": "Canonical",
|
||||
|
|
|
@ -2,3 +2,19 @@
|
|||
"type": "string",
|
||||
"value": "[reference(concat('Microsoft.Network/publicIPAddresses/', variables('masterPublicIPAddressName'))).dnsSettings.fqdn]"
|
||||
}
|
||||
{{if .GetClassicMode}}
|
||||
{{if RequiresFakeAgentOutput}}
|
||||
,"agentFQDN": {
|
||||
"type": "string",
|
||||
"value": ""
|
||||
},
|
||||
{{end}}
|
||||
"diagnosticsStorageAccountUri": {
|
||||
"type": "string",
|
||||
"value": ""
|
||||
},
|
||||
"jumpboxFQDN": {
|
||||
"type": "string",
|
||||
"value": ""
|
||||
}
|
||||
{{end}}
|
|
@ -19,6 +19,7 @@
|
|||
},
|
||||
{{else}}
|
||||
"masterSubnet": {
|
||||
"defaultValue": "{{.MasterProfile.GetSubnet}}",
|
||||
"metadata": {
|
||||
"description": "Sets the subnet of the master node(s)."
|
||||
},
|
||||
|
@ -26,6 +27,7 @@
|
|||
},
|
||||
{{end}}
|
||||
"firstConsecutiveStaticIP": {
|
||||
"defaultValue": "{{.MasterProfile.FirstConsecutiveStaticIP}}",
|
||||
"metadata": {
|
||||
"description": "Sets the static IP of the first master"
|
||||
},
|
||||
|
@ -43,4 +45,14 @@
|
|||
"description": "SSH public key used for auth to all Linux machines. Not Required. If not set, you must provide a password key."
|
||||
},
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"nameSuffix": {
|
||||
"defaultValue": "{{GetUniqueNameSuffix}}",
|
||||
"metadata": {
|
||||
"description": "A string hash of the master DNS name to uniquely identify the cluster."
|
||||
},
|
||||
"type": "string"
|
||||
}
|
||||
{{if .GetClassicMode}}
|
||||
,{{template "classicparams.t" .}}
|
||||
{{end}}
|
|
@ -35,7 +35,7 @@
|
|||
"masterFirstAddrPrefix": "[concat(variables('masterFirstAddrOctets')[0],'.',variables('masterFirstAddrOctets')[1],'.',variables('masterFirstAddrOctets')[2],'.')]",
|
||||
"masterVMNamePrefix": "[concat(variables('orchestratorName'), '-master-', variables('nameSuffix'), '-')]",
|
||||
"masterVMSize": "[parameters('masterVMSize')]",
|
||||
"nameSuffix": "{{GetUniqueNameSuffix}}",
|
||||
"nameSuffix": "[parameters('nameSuffix')]",
|
||||
"orchestratorName": "swarm",
|
||||
"osImageOffer": "UbuntuServer",
|
||||
"osImagePublisher": "Canonical",
|
||||
|
|
|
@ -30,6 +30,7 @@ const (
|
|||
const (
|
||||
agentOutputs = "agentoutputs.t"
|
||||
agentParams = "agentparams.t"
|
||||
classicParams = "classicparams.t"
|
||||
dcosAgentResources = "dcosagentresources.t"
|
||||
dcosAgentResourcesDisks = "dcosagentresourcesdisks.t"
|
||||
dcosAgentVars = "dcosagentvars.t"
|
||||
|
@ -59,7 +60,7 @@ const (
|
|||
windowsParams = "windowsparams.t"
|
||||
)
|
||||
|
||||
var commonTemplateFiles = []string{agentOutputs, agentParams, masterOutputs, masterParams}
|
||||
var commonTemplateFiles = []string{agentOutputs, agentParams, classicParams, masterOutputs, masterParams}
|
||||
var dcosTemplateFiles = []string{dcosAgentResources, dcosAgentResourcesDisks, dcosAgentVars, dcosBaseFile, dcosCustomData173, dcosCustomData184, dcosMasterResources, dcosMasterVars}
|
||||
var kubernetesTemplateFiles = []string{kubernetesBaseFile, kubernetesAgentResources, kubernetesAgentVars, kubernetesMasterResources, kubernetesMasterVars, kubernetesParams}
|
||||
var swarmTemplateFiles = []string{swarmBaseFile, swarmAgentCustomData, swarmAgentResources, swarmAgentVars, swarmAgentResourcesDisks, swarmBaseFile, swarmMasterCustomData, swarmMasterResources, swarmMasterVars, swarmWinAgentResources, swarmWinAgentResourcesDisks, windowsParams}
|
||||
|
@ -228,6 +229,9 @@ func getTemplateFuncMap(acsCluster *vlabs.AcsCluster, partsDirectory string) map
|
|||
return acsCluster.OrchestratorProfile.OrchestratorType == vlabs.DCOS184 ||
|
||||
acsCluster.OrchestratorProfile.OrchestratorType == vlabs.DCOS
|
||||
},
|
||||
"RequiresFakeAgentOutput": func() bool {
|
||||
return acsCluster.OrchestratorProfile.OrchestratorType == vlabs.Kubernetes
|
||||
},
|
||||
"IsPublic": func(ports []int) bool {
|
||||
return len(ports) > 0
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче