This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 522
/
defaults-controller-manager.go
81 lines (69 loc) · 3.77 KB
/
defaults-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
71
72
73
74
75
76
77
78
79
80
81
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
package api
import (
"strconv"
"github.com/Azure/go-autorest/autorest/to"
)
func (cs *ContainerService) setControllerManagerConfig() {
o := cs.Properties.OrchestratorProfile
staticControllerManagerConfig := map[string]string{
"--kubeconfig": "/var/lib/kubelet/kubeconfig",
"--allocate-node-cidrs": strconv.FormatBool(!o.IsAzureCNI()),
"--configure-cloud-routes": strconv.FormatBool(o.RequireRouteTable()),
"--cluster-cidr": o.KubernetesConfig.ClusterSubnet,
"--root-ca-file": "/etc/kubernetes/certs/ca.crt",
"--cluster-signing-cert-file": "/etc/kubernetes/certs/ca.crt",
"--cluster-signing-key-file": "/etc/kubernetes/certs/ca.key",
"--service-account-private-key-file": "/etc/kubernetes/certs/apiserver.key",
"--leader-elect": "true",
"--v": "2",
"--controllers": "*,bootstrapsigner,tokencleaner",
}
// Set --cluster-name based on appropriate DNS prefix
if cs.Properties.MasterProfile != nil {
staticControllerManagerConfig["--cluster-name"] = cs.Properties.MasterProfile.DNSPrefix
} else if cs.Properties.HostedMasterProfile != nil {
staticControllerManagerConfig["--cluster-name"] = cs.Properties.HostedMasterProfile.DNSPrefix
}
// Enable cloudprovider if we're not using cloud controller manager
if !to.Bool(o.KubernetesConfig.UseCloudControllerManager) {
staticControllerManagerConfig["--cloud-provider"] = "azure"
staticControllerManagerConfig["--cloud-config"] = "/etc/kubernetes/azure.json"
} else {
staticControllerManagerConfig["--cloud-provider"] = "external"
}
// Default controller-manager config
defaultControllerManagerConfig := map[string]string{
"--node-monitor-grace-period": DefaultKubernetesCtrlMgrNodeMonitorGracePeriod,
"--pod-eviction-timeout": DefaultKubernetesCtrlMgrPodEvictionTimeout,
"--route-reconciliation-period": DefaultKubernetesCtrlMgrRouteReconciliationPeriod,
"--terminated-pod-gc-threshold": DefaultKubernetesCtrlMgrTerminatedPodGcThreshold,
"--use-service-account-credentials": DefaultKubernetesCtrlMgrUseSvcAccountCreds,
"--profiling": DefaultKubernetesCtrMgrEnableProfiling,
}
// If no user-configurable controller-manager config values exists, use the defaults
if o.KubernetesConfig.ControllerManagerConfig == nil {
o.KubernetesConfig.ControllerManagerConfig = defaultControllerManagerConfig
} else {
for key, val := range defaultControllerManagerConfig {
// If we don't have a user-configurable controller-manager config for each option
if _, ok := o.KubernetesConfig.ControllerManagerConfig[key]; !ok {
// then assign the default value
o.KubernetesConfig.ControllerManagerConfig[key] = val
}
}
}
// Enables Node Exclusion from Services (toggled on agent nodes by the alpha.service-controller.kubernetes.io/exclude-balancer label).
addDefaultFeatureGates(o.KubernetesConfig.ControllerManagerConfig, o.OrchestratorVersion, "1.9.0", "ServiceNodeExclusion=true")
// Enable the consumption of local ephemeral storage and also the sizeLimit property of an emptyDir volume.
addDefaultFeatureGates(o.KubernetesConfig.ControllerManagerConfig, o.OrchestratorVersion, "1.10.0", "LocalStorageCapacityIsolation=true")
// We don't support user-configurable values for the following,
// so any of the value assignments below will override user-provided values
for key, val := range staticControllerManagerConfig {
o.KubernetesConfig.ControllerManagerConfig[key] = val
}
if o.KubernetesConfig.IsRBACEnabled() {
o.KubernetesConfig.ControllerManagerConfig["--use-service-account-credentials"] = "true"
}
}