-
Notifications
You must be signed in to change notification settings - Fork 558
Add Rescheduler addon #1780
Add Rescheduler addon #1780
Changes from 32 commits
ab8d33d
dca734d
bae42e6
8840dec
5cf7e98
94ab4c1
bb5b2ce
bedfe00
02de386
86b004e
981cf24
989de34
be3c624
b840a41
9c2a09a
ae8d620
d31849e
afb09d7
5bdf726
5cf36c1
900cd02
46de126
b04de96
1b1bc40
0eb1314
d4df8fc
0a4c0f3
93e58e5
e4ef915
c0b3f35
e69d7b7
35d65f0
3beedcd
8823cb3
083ec7d
ee7e850
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: rescheduler | ||
namespace: kube-system | ||
labels: | ||
k8s-app: rescheduler | ||
kubernetes.io/cluster-service: "true" | ||
addonmanager.kubernetes.io/mode: Reconcile | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
k8s-app: rescheduler | ||
template: | ||
metadata: | ||
labels: | ||
k8s-app: rescheduler | ||
annotations: | ||
scheduler.alpha.kubernetes.io/critical-pod: '' | ||
spec: | ||
containers: | ||
- image: <kubernetesReschedulerSpec> | ||
name: rescheduler | ||
resources: | ||
requests: | ||
cpu: <kubernetesReschedulerCPURequests> | ||
memory: <kubernetesReschedulerCPULimit> | ||
limits: | ||
cpu: <kubernetesReschedulerCPULimit> | ||
memory: <kubernetesReschedulerMemoryLimit> | ||
command: | ||
- sh | ||
- -c | ||
- '/rescheduler' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,6 +140,15 @@ write_files: | |
content: !!binary | | ||
MASTER_ADDON_HEAPSTER_DEPLOYMENT_B64_GZIP_STR | ||
|
||
{{if .OrchestratorProfile.KubernetesConfig.IsReschedulerEnabled}} | ||
- path: /etc/kubernetes/addons/kube-rescheduler-deployment.yaml | ||
permissions: "0644" | ||
encoding: gzip | ||
owner: "root" | ||
content: !!binary | | ||
MASTER_ADDON_RESCHEDULER_DEPLOYMENT_B64_GZIP_STR | ||
{{end}} | ||
|
||
- path: /etc/kubernetes/addons/azure-storage-classes.yaml | ||
permissions: "0644" | ||
encoding: gzip | ||
|
@@ -284,6 +293,13 @@ write_files: | |
sed -i "s|<kubernetesTillerCPULimit>|{{WrapAsVariable "kubernetesTillerCPULimit"}}|g" "/etc/kubernetes/addons/kube-tiller-deployment.yaml" | ||
sed -i "s|<kubernetesTillerMemoryLimit>|{{WrapAsVariable "kubernetesTillerMemoryLimit"}}|g" "/etc/kubernetes/addons/kube-tiller-deployment.yaml" | ||
{{end}} | ||
{{if .OrchestratorProfile.KubernetesConfig.IsReschedulerEnabled}} | ||
sed -i "s|<kubernetesReschedulerSpec>|{{WrapAsVariable "kubernetesReschedulerSpec"}}|g" "/etc/kubernetes/addons/kube-rescheduler-deployment.yaml" | ||
sed -i "s|<kubernetesReschedulerCPURequests>|{{WrapAsVariable "kubernetesReschedulerCPURequests"}}|g" "/etc/kubernetes/addons/kube-rescheduler-deployment.yaml" | ||
sed -i "s|<kubernetesReschedulerMemoryRequests>|{{WrapAsVariable "kubernetesReschedulerMemoryRequests"}}|g" "/etc/kubernetes/addons/kube-rescheduler-deployment.yaml" | ||
sed -i "s|<kubernetesReschedulerCPULimit>|{{WrapAsVariable "kubernetesReschedulerCPULimit"}}|g" "/etc/kubernetes/addons/kube-rescheduler-deployment.yaml" | ||
sed -i "s|<kubernetesReschedulerMemoryLimit>|{{WrapAsVariable "kubernetesReschedulerMemoryLimit"}}|g" "/etc/kubernetes/addons/kube-rescheduler-deployment.yaml" | ||
{{end}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for clarity let's unindent this |
||
sed -i "s|<kubeDNSServiceIP>|{{WrapAsVariable "kubeDNSServiceIP"}}|g" "/etc/kubernetes/addons/kube-dns-deployment.yaml" | ||
|
||
{{if .OrchestratorProfile.KubernetesConfig.EnableRbac }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,10 @@ const ( | |
DefaultOrchestratorName = "k8s" | ||
// DefaultEtcdDiskSize specifies the default size for Kubernetes master etcd disk volumes in GB | ||
DefaultEtcdDiskSize = "128" | ||
// DefaultReschedulerImage defines the rescheduler deployment version on Kubernetes Clusters | ||
DefaultReschedulerImage = "rescheduler:v0.3.1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the right version to use as default? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's ship w/ latest There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0.3.1 is the latest tag here |
||
// DefaultReschedulerAddonName is the name of the rescheduler addon deployment | ||
DefaultReschedulerAddonName = "rescheduler" | ||
) | ||
|
||
const ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,7 @@ var ( | |
// DefaultTillerAddonsConfig is the default tiller Kubernetes addon Config | ||
DefaultTillerAddonsConfig = api.KubernetesAddon{ | ||
Name: DefaultTillerAddonName, | ||
Enabled: pointerToBool(true), | ||
Enabled: pointerToBool(api.DefaultTillerAddonEnabled), | ||
Containers: []api.KubernetesContainerSpec{ | ||
{ | ||
Name: DefaultTillerAddonName, | ||
|
@@ -167,7 +167,7 @@ var ( | |
// DefaultDashboardAddonsConfig is the default kubernetes-dashboard addon Config | ||
DefaultDashboardAddonsConfig = api.KubernetesAddon{ | ||
Name: DefaultDashboardAddonName, | ||
Enabled: pointerToBool(true), | ||
Enabled: pointerToBool(api.DefaultDashboardAddonEnabled), | ||
Containers: []api.KubernetesContainerSpec{ | ||
{ | ||
Name: DefaultDashboardAddonName, | ||
|
@@ -178,6 +178,21 @@ var ( | |
}, | ||
}, | ||
} | ||
|
||
// DefaultReschedulerAddonsConfig is the default rescheduler Kubernetes addon Config | ||
DefaultReschedulerAddonsConfig = api.KubernetesAddon{ | ||
Name: DefaultReschedulerAddonName, | ||
Enabled: pointerToBool(api.DefaultReschedulerAddonEnabled), | ||
Containers: []api.KubernetesContainerSpec{ | ||
{ | ||
Name: DefaultReschedulerAddonName, | ||
CPURequests: "10m", | ||
MemoryRequests: "100Mi", | ||
CPULimits: "10m", | ||
MemoryLimits: "100Mi", | ||
}, | ||
}, | ||
} | ||
) | ||
|
||
// SetPropertiesDefaults for the container Properties, returns true if certs are generated | ||
|
@@ -227,6 +242,7 @@ func setOrchestratorDefaults(cs *api.ContainerService) { | |
o.KubernetesConfig.Addons = []api.KubernetesAddon{ | ||
DefaultTillerAddonsConfig, | ||
DefaultDashboardAddonsConfig, | ||
DefaultReschedulerAddonsConfig, | ||
} | ||
} else { | ||
// For each addon, provide default configuration if user didn't provide its own config | ||
|
@@ -240,6 +256,11 @@ func setOrchestratorDefaults(cs *api.ContainerService) { | |
// Provide default acs-engine config for Dashboard | ||
o.KubernetesConfig.Addons = append(o.KubernetesConfig.Addons, DefaultDashboardAddonsConfig) | ||
} | ||
r := getAddonsIndexByName(o.KubernetesConfig.Addons, DefaultReschedulerAddonName) | ||
if r < 0 { | ||
// Provide default acs-engine config for Rescheduler | ||
o.KubernetesConfig.Addons = append(o.KubernetesConfig.Addons, DefaultReschedulerAddonsConfig) | ||
} | ||
} | ||
if o.KubernetesConfig.KubernetesImageBase == "" { | ||
o.KubernetesConfig.KubernetesImageBase = cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase | ||
|
@@ -334,6 +355,10 @@ func setOrchestratorDefaults(cs *api.ContainerService) { | |
if a.OrchestratorProfile.KubernetesConfig.Addons[d].IsEnabled(api.DefaultDashboardAddonEnabled) { | ||
a.OrchestratorProfile.KubernetesConfig.Addons[d] = assignDefaultAddonVals(a.OrchestratorProfile.KubernetesConfig.Addons[d], DefaultDashboardAddonsConfig) | ||
} | ||
r := getAddonsIndexByName(a.OrchestratorProfile.KubernetesConfig.Addons, DefaultReschedulerAddonName) | ||
if a.OrchestratorProfile.KubernetesConfig.Addons[r].IsEnabled(api.DefaultReschedulerAddonEnabled) { | ||
a.OrchestratorProfile.KubernetesConfig.Addons[r] = assignDefaultAddonVals(a.OrchestratorProfile.KubernetesConfig.Addons[r], DefaultDashboardAddonsConfig) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 2nd arg to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes thanks for catching that |
||
} | ||
|
||
if "" == a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB { | ||
a.OrchestratorProfile.KubernetesConfig.EtcdDiskSizeGB = DefaultEtcdDiskSize | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,7 @@ var kubernetesAddonYamls = map[string]string{ | |
"MASTER_ADDON_KUBERNETES_DASHBOARD_DEPLOYMENT_B64_GZIP_STR": "kubernetesmasteraddons-kubernetes-dashboard-deployment.yaml", | ||
"MASTER_ADDON_AZURE_STORAGE_CLASSES_B64_GZIP_STR": "kubernetesmasteraddons-azure-storage-classes.yaml", | ||
"MASTER_ADDON_TILLER_DEPLOYMENT_B64_GZIP_STR": "kubernetesmasteraddons-tiller-deployment.yaml", | ||
"MASTER_ADDON_RESCHEDULER_DEPLOYMENT_B64_GZIP_STR": "kubernetesmasteraddons-kube-rescheduler-deployment.yaml", | ||
} | ||
|
||
var kubernetesAddonYamls15 = map[string]string{ | ||
|
@@ -547,6 +548,7 @@ func getParameters(cs *api.ContainerService, isClassicMode bool, generatorCode s | |
addValue(parametersMap, "kubernetesDNSMasqSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeConfigs[k8sVersion]["dnsmasq"]) | ||
addValue(parametersMap, "kubernetesExecHealthzSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeConfigs[k8sVersion]["exechealthz"]) | ||
addValue(parametersMap, "kubernetesHeapsterSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeConfigs[k8sVersion]["heapster"]) | ||
addValue(parametersMap, "kubernetesReschedulerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeConfigs[k8sVersion]["rescheduler"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
tillerAddon := getAddonByName(properties.OrchestratorProfile.KubernetesConfig.Addons, DefaultTillerAddonName) | ||
c := getAddonContainersIndexByName(tillerAddon.Containers, DefaultTillerAddonName) | ||
if c > -1 { | ||
|
@@ -570,7 +572,20 @@ func getParameters(cs *api.ContainerService, isClassicMode bool, generatorCode s | |
if dashboardAddon.Containers[c].Image != "" { | ||
addValue(parametersMap, "kubernetesDashboardSpec", dashboardAddon.Containers[c].Image) | ||
} else { | ||
addValue(parametersMap, "kubernetesDashboardSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeConfigs[k8sVersion]["dashboard"]) | ||
addValue(parametersMap, "kubernetesDashboardSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeConfigs[k8sVersion][DefaultDashboardAddonName]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jackfrancis is there a reason why this wasn't using the name var? is it okay that I changed it? (1/3) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 and thanks! |
||
} | ||
} | ||
reschedulerAddon := getAddonByName(properties.OrchestratorProfile.KubernetesConfig.Addons, DefaultReschedulerAddonName) | ||
c = getAddonContainersIndexByName(reschedulerAddon.Containers, DefaultReschedulerAddonName) | ||
if c > -1 { | ||
addValue(parametersMap, "kubernetesReschedulerCPURequests", reschedulerAddon.Containers[c].CPURequests) | ||
addValue(parametersMap, "kubernetesReschedulerCPULimit", reschedulerAddon.Containers[c].CPULimits) | ||
addValue(parametersMap, "kubernetesReschedulerMemoryRequests", reschedulerAddon.Containers[c].MemoryRequests) | ||
addValue(parametersMap, "kubernetesReschedulerMemoryLimit", reschedulerAddon.Containers[c].MemoryLimits) | ||
if reschedulerAddon.Containers[c].Image != "" { | ||
addValue(parametersMap, "kubernetesReschedulerSpec", dashboardAddon.Containers[c].Image) | ||
} else { | ||
addValue(parametersMap, "kubernetesReschedulerSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeConfigs[k8sVersion][DefaultReschedulerAddonName]) | ||
} | ||
} | ||
addValue(parametersMap, "kubernetesKubeDNSSpec", cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase+KubeConfigs[k8sVersion]["dns"]) | ||
|
@@ -962,6 +977,9 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat | |
if !profile.OrchestratorProfile.KubernetesConfig.IsDashboardEnabled() { | ||
delete(addonYamls, "MASTER_ADDON_KUBERNETES_DASHBOARD_DEPLOYMENT_B64_GZIP_STR") | ||
} | ||
if !profile.OrchestratorProfile.KubernetesConfig.IsReschedulerEnabled() { | ||
delete(addonYamls, "MASTER_ADDON_RESCHEDULER_DEPLOYMENT_B64_GZIP_STR") | ||
} | ||
for placeholder, filename := range addonYamls { | ||
addonTextContents := getBase64CustomScript(filename) | ||
str = strings.Replace(str, placeholder, addonTextContents, -1) | ||
|
@@ -1175,6 +1193,8 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat | |
tC := getAddonContainersIndexByName(tillerAddon.Containers, DefaultTillerAddonName) | ||
dashboardAddon := getAddonByName(cs.Properties.OrchestratorProfile.KubernetesConfig.Addons, DefaultDashboardAddonName) | ||
dC := getAddonContainersIndexByName(dashboardAddon.Containers, DefaultDashboardAddonName) | ||
reschedulerAddon := getAddonByName(cs.Properties.OrchestratorProfile.KubernetesConfig.Addons, DefaultReschedulerAddonName) | ||
rC := getAddonContainersIndexByName(reschedulerAddon.Containers, DefaultReschedulerAddonName) | ||
switch attr { | ||
case "kubernetesHyperkubeSpec": | ||
val = cs.Properties.OrchestratorProfile.KubernetesConfig.KubernetesImageBase + KubeConfigs[k8sVersion]["hyperkube"] | ||
|
@@ -1191,7 +1211,7 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat | |
val = dashboardAddon.Containers[dC].Image | ||
} | ||
} else { | ||
val = cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase + KubeConfigs[k8sVersion]["dashboard"] | ||
val = cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase + KubeConfigs[k8sVersion][DefaultDashboardAddonName] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jackfrancis same here (2/3) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 and thanks ditto |
||
} | ||
case "kubernetesDashboardCPURequests": | ||
if dC > -1 { | ||
|
@@ -1255,6 +1275,38 @@ func (t *TemplateGenerator) getTemplateFuncMap(cs *api.ContainerService) templat | |
} else { | ||
val = "" | ||
} | ||
case "kubernetesReschedulerSpec": | ||
if rC > -1 { | ||
if reschedulerAddon.Containers[rC].Image != "" { | ||
val = reschedulerAddon.Containers[rC].Image | ||
} | ||
} else { | ||
val = cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase + KubeConfigs[k8sVersion][DefaultReschedulerAddonName] | ||
} | ||
case "kubernetesReschedulerCPURequests": | ||
if rC > -1 { | ||
val = reschedulerAddon.Containers[rC].CPURequests | ||
} else { | ||
val = "" | ||
} | ||
case "kubernetesReschedulerMemoryRequests": | ||
if rC > -1 { | ||
val = reschedulerAddon.Containers[rC].MemoryRequests | ||
} else { | ||
val = "" | ||
} | ||
case "kubernetesReschedulerCPULimit": | ||
if rC > -1 { | ||
val = reschedulerAddon.Containers[rC].CPULimits | ||
} else { | ||
val = "" | ||
} | ||
case "kubernetesReschedulerMemoryLimit": | ||
if rC > -1 { | ||
val = reschedulerAddon.Containers[rC].MemoryLimits | ||
} else { | ||
val = "" | ||
} | ||
case "kubernetesKubeDNSSpec": | ||
val = cloudSpecConfig.KubernetesSpecConfig.KubernetesImageBase + KubeConfigs[k8sVersion]["dns"] | ||
case "kubernetesPodInfraContainerSpec": | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be
<kubernetesReschedulerMemoryRequests>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops yes thank you!