2018-12-03 22:19:18 +03:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
// Licensed under the MIT license.
|
|
|
|
|
2018-10-11 03:43:14 +03:00
|
|
|
package api
|
2018-01-10 22:44:51 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
)
|
|
|
|
|
2018-10-11 03:43:14 +03:00
|
|
|
func (cs *ContainerService) setCloudControllerManagerConfig() {
|
2018-01-10 22:44:51 +03:00
|
|
|
o := cs.Properties.OrchestratorProfile
|
2018-06-20 03:12:24 +03:00
|
|
|
staticCloudControllerManagerConfig := map[string]string{
|
2018-05-03 01:48:06 +03:00
|
|
|
"--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",
|
2018-01-10 22:44:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set --cluster-name based on appropriate DNS prefix
|
|
|
|
if cs.Properties.MasterProfile != nil {
|
2018-06-20 03:12:24 +03:00
|
|
|
staticCloudControllerManagerConfig["--cluster-name"] = cs.Properties.MasterProfile.DNSPrefix
|
2018-01-10 22:44:51 +03:00
|
|
|
} else if cs.Properties.HostedMasterProfile != nil {
|
2018-06-20 03:12:24 +03:00
|
|
|
staticCloudControllerManagerConfig["--cluster-name"] = cs.Properties.HostedMasterProfile.DNSPrefix
|
2018-01-10 22:44:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Default cloud-controller-manager config
|
|
|
|
defaultCloudControllerManagerConfig := map[string]string{
|
2018-01-10 23:31:44 +03:00
|
|
|
"--route-reconciliation-period": DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
|
2018-01-10 22:44:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
2018-06-20 03:12:24 +03:00
|
|
|
for key, val := range staticCloudControllerManagerConfig {
|
2018-01-10 22:44:51 +03:00
|
|
|
o.KubernetesConfig.CloudControllerManagerConfig[key] = val
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO add RBAC support
|
|
|
|
/*if *o.KubernetesConfig.EnableRbac {
|
|
|
|
o.KubernetesConfig.CloudControllerManagerConfig["--use-service-account-credentials"] = "true"
|
|
|
|
}*/
|
|
|
|
}
|