This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
/
armoutputs.go
114 lines (101 loc) · 3.37 KB
/
armoutputs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
package engine
import (
"fmt"
"github.com/Azure/aks-engine/pkg/api"
"github.com/Azure/aks-engine/pkg/api/common"
)
func GetKubernetesOutputs(cs *api.ContainerService) map[string]interface{} {
outputs := map[string]interface{}{
"resourceGroup": map[string]interface{}{
"type": "string",
"value": "[variables('resourceGroup')]",
},
"vnetResourceGroup": map[string]interface{}{
"type": "string",
"value": "[variables('virtualNetworkResourceGroupName')]",
},
"subnetName": map[string]interface{}{
"type": "string",
"value": "[variables('subnetName')]",
},
"securityGroupName": map[string]interface{}{
"type": "string",
"value": "[variables('nsgName')]",
},
"virtualNetworkName": map[string]interface{}{
"type": "string",
"value": "[variables('virtualNetworkName')]",
},
"routeTableName": map[string]interface{}{
"type": "string",
"value": "[variables('routeTableName')]",
},
"primaryAvailabilitySetName": map[string]interface{}{
"type": "string",
"value": "[variables('primaryAvailabilitySetName')]",
},
"primaryScaleSetName": map[string]interface{}{
"type": "string",
"value": "[variables('primaryScaleSetName')]",
},
}
for k, v := range getMasterOutputs(cs) {
outputs[k] = v
}
for _, profile := range cs.Properties.AgentPoolProfiles {
if profile.IsAvailabilitySets() && profile.IsStorageAccount() {
agentName := profile.Name
outputs[fmt.Sprintf("%sStorageAccountOffset", agentName)] = map[string]interface{}{
"type": "int",
"value": fmt.Sprintf("[variables('%sStorageAccountOffset')]", agentName),
}
outputs[fmt.Sprintf("%sStorageAccountCount", agentName)] = map[string]interface{}{
"type": "int",
"value": fmt.Sprintf("[variables('%sStorageAccountsCount')]", agentName),
}
outputs[fmt.Sprintf("%sSubnetName", agentName)] = map[string]interface{}{
"type": "string",
"value": fmt.Sprintf("[variables('%sSubnetName')]", agentName),
}
}
}
if cs.Properties.OrchestratorProfile.KubernetesConfig.IsAddonEnabled(common.AppGwIngressAddonName) {
outputs["applicationGatewayName"] = map[string]interface{}{
"type": "string",
"value": "[variables('appGwName')]",
}
outputs["appGwIdentityResourceId"] = map[string]interface{}{
"type": "string",
"value": "[variables('appGwICIdentityId')]",
}
outputs["appGwIdentityClientId"] = map[string]interface{}{
"type": "string",
"value": "[reference(variables('appGwICIdentityId'), variables('apiVersionManagedIdentity')).clientId]",
}
}
return outputs
}
func getMasterOutputs(cs *api.ContainerService) map[string]interface{} {
outputs := map[string]interface{}{}
masterFQDN := ""
if !cs.Properties.OrchestratorProfile.IsPrivateCluster() {
masterFQDN = "[reference(concat('Microsoft.Network/publicIPAddresses/', variables('masterPublicIPAddressName'))).dnsSettings.fqdn]"
}
outputs["masterFQDN"] = map[string]interface{}{
"type": "string",
"value": masterFQDN,
}
if cs.Properties.HasVMASAgentPool() {
outputs["agentStorageAccountSuffix"] = map[string]interface{}{
"type": "string",
"value": "[variables('storageAccountBaseName')]",
}
outputs["agentStorageAccountPrefixes"] = map[string]interface{}{
"type": "array",
"value": "[variables('storageAccountPrefixes')]",
}
}
return outputs
}