This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 560
/
defaults-scheduler.go
52 lines (46 loc) · 1.68 KB
/
defaults-scheduler.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
package acsengine
import (
"github.com/Azure/acs-engine/pkg/api"
)
// staticLinuxSchedulerConfig is not user-overridable
var staticLinuxSchedulerConfig = map[string]string{
"--kubeconfig": "/var/lib/kubelet/kubeconfig",
"--leader-elect": "true",
"--profiling": "false",
}
// defaultSchedulerConfig provides targeted defaults, but is user-overridable
var defaultSchedulerConfig = map[string]string{
"--v": "2",
}
func setSchedulerConfig(cs *api.ContainerService) {
o := cs.Properties.OrchestratorProfile
staticWindowsSchedulerConfig := make(map[string]string)
for key, val := range staticLinuxSchedulerConfig {
staticWindowsSchedulerConfig[key] = val
}
// Windows scheduler config overrides
// TODO placeholder for specific config overrides for Windows clusters
// If no user-configurable scheduler config values exists, use the defaults
if o.KubernetesConfig.SchedulerConfig == nil {
o.KubernetesConfig.SchedulerConfig = defaultSchedulerConfig
} else {
for key, val := range defaultSchedulerConfig {
// If we don't have a user-configurable scheduler config for each option
if _, ok := o.KubernetesConfig.SchedulerConfig[key]; !ok {
// then assign the default value
o.KubernetesConfig.SchedulerConfig[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 overrideSchedulerConfig map[string]string
if cs.Properties.HasWindows() {
overrideSchedulerConfig = staticWindowsSchedulerConfig
} else {
overrideSchedulerConfig = staticLinuxSchedulerConfig
}
for key, val := range overrideSchedulerConfig {
o.KubernetesConfig.SchedulerConfig[key] = val
}
}