forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
defaults-cloud-controller-manager.go
70 lines (61 loc) · 2.8 KB
/
defaults-cloud-controller-manager.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
package acsengine
import (
"strconv"
"github.com/Azure/acs-engine/pkg/api"
)
func setCloudControllerManagerConfig(cs *api.ContainerService) {
o := cs.Properties.OrchestratorProfile
staticLinuxCloudControllerManagerConfig := map[string]string{
"--allocate-node-cidrs": strconv.FormatBool(!o.IsAzureCNI()),
"--configure-cloud-routes": strconv.FormatBool(o.RequireRouteTable()),
"--cloud-provider": "azure",
"--cloud-config": "/etc/kubernetes/azure.json",
"--cluster-cidr": o.KubernetesConfig.ClusterSubnet,
"--kubeconfig": "/var/lib/kubelet/kubeconfig",
"--leader-elect": "true",
"--v": "2",
}
// Set --cluster-name based on appropriate DNS prefix
if cs.Properties.MasterProfile != nil {
staticLinuxCloudControllerManagerConfig["--cluster-name"] = cs.Properties.MasterProfile.DNSPrefix
} else if cs.Properties.HostedMasterProfile != nil {
staticLinuxCloudControllerManagerConfig["--cluster-name"] = cs.Properties.HostedMasterProfile.DNSPrefix
}
staticWindowsCloudControllerManagerConfig := make(map[string]string)
for key, val := range staticLinuxCloudControllerManagerConfig {
staticWindowsCloudControllerManagerConfig[key] = val
}
// Windows cloud-controller-manager config overrides
// TODO placeholder for specific config overrides for Windows clusters
// Default cloud-controller-manager config
defaultCloudControllerManagerConfig := map[string]string{
"--route-reconciliation-period": DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
}
// If no user-configurable cloud-controller-manager config values exists, use the defaults
if o.KubernetesConfig.CloudControllerManagerConfig == nil {
o.KubernetesConfig.CloudControllerManagerConfig = defaultCloudControllerManagerConfig
} else {
for key, val := range defaultCloudControllerManagerConfig {
// If we don't have a user-configurable cloud-controller-manager config for each option
if _, ok := o.KubernetesConfig.CloudControllerManagerConfig[key]; !ok {
// then assign the default value
o.KubernetesConfig.CloudControllerManagerConfig[key] = val
}
}
}
// We don't support user-configurable values for the following,
// so any of the value assignments below will override user-provided values
var overrideCloudControllerManagerConfig map[string]string
if cs.Properties.HasWindows() {
overrideCloudControllerManagerConfig = staticWindowsCloudControllerManagerConfig
} else {
overrideCloudControllerManagerConfig = staticLinuxCloudControllerManagerConfig
}
for key, val := range overrideCloudControllerManagerConfig {
o.KubernetesConfig.CloudControllerManagerConfig[key] = val
}
// TODO add RBAC support
/*if *o.KubernetesConfig.EnableRbac {
o.KubernetesConfig.CloudControllerManagerConfig["--use-service-account-credentials"] = "true"
}*/
}