Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Add Rescheduler addon #1780

Merged
merged 36 commits into from
Nov 18, 2017
Merged

Add Rescheduler addon #1780

merged 36 commits into from
Nov 18, 2017

Conversation

CecileRobertMichon
Copy link
Contributor

What this PR does / why we need it: Guaranteed scheduling of critical add-ons requires a Rescheduler pod to be running, this PR adds that Rescheduler.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #944

Release note:

@ghost ghost added the in progress label Nov 16, 2017
// DefaultReschedulerAddonsConfig is the default rescheduler Kubernetes addon Config
DefaultReschedulerAddonsConfig = api.KubernetesAddon{
Name: DefaultReschedulerAddonName,
Enabled: pointerToBool(true),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be enabled by default?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ship this as false to be cautious, and then figure out how we want to bake the feature before turning default to true.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you could pay back some of my tech debt by changing these boolean literals inside pointerToBool() to api.DefaultTillerAddonEnabled and api.DefaultDashboardAddonEnabled :)

CPURequests: "300m",
MemoryRequests: "150Mi",
CPULimits: "300m",
MemoryLimits: "150Mi",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ need to discuss what default limits to use for rescheduler

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name: rescheduler
resources:
requests:
cpu: 10m
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// todo change this to param

@@ -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])
Copy link
Contributor Author

@CecileRobertMichon CecileRobertMichon Nov 16, 2017

Choose a reason for hiding this comment

The 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)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 and thanks!

@@ -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]
Copy link
Contributor Author

@CecileRobertMichon CecileRobertMichon Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackfrancis same here (2/3)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 and thanks ditto

"gchighthreshold": strconv.Itoa(DefaultKubernetesGCHighThreshold),
"gclowthreshold": strconv.Itoa(DefaultKubernetesGCLowThreshold),
"hyperkube": "hyperkube-amd64:v1.8.2",
DefaultDashboardAddonName: "kubernetes-dashboard-amd64:v1.7.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackfrancis and here (3/3)

pkg/api/const.go Outdated
@@ -86,4 +86,6 @@ const (
DefaultTillerAddonEnabled = true
// DefaultDashboardAddonEnabled determines the acs-engine provided default for enabling kubernetes-dashboard addon
DefaultDashboardAddonEnabled = true
// DefaultReschedulerAddonEnabled determines the acs-engine provided default for enabling kubernetes-rescheduler addon
DefaultReschedulerAddonEnabled = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True or false here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be false to match.

@@ -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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the right version to use as default?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's ship w/ latest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.3.1 is the latest tag here

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}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for clarity let's unindent this {{end}} to match the `{{if``

@@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2nd arg to assignDefaultAddonVals() here should be DefaultReschedulerAddonsConfig. (I know, copy/paste + tired eye sockets...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes thanks for catching that

@@ -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"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use DefaultReschedulerAddonName as map key here

pkg/api/types.go Outdated
func (k *KubernetesConfig) IsReschedulerEnabled() bool {
var reschedulerAddon KubernetesAddon
for i := range k.Addons {
if k.Addons[i].Name == "rescheduler" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use DefaultReschedulerAddonName here

if e != DefaultReschedulerAddonEnabled {
t.Fatalf("KubernetesConfig.IsReschedulerEnabled() should return %t when no rescheduler addon has been specified, instead returned %t", DefaultReschedulerAddonEnabled, e)
}
c.Addons = append(c.Addons, getMockAddon("rescheduler"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use DefaultReschedulerAddonName here

c = KubernetesConfig{
Addons: []KubernetesAddon{
{
Name: "rescheduler",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use DefaultReschedulerAddonName here

resources:
requests:
cpu: <kubernetesReschedulerCPURequests>
memory: <kubernetesReschedulerCPULimit>
Copy link
Member

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>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops yes thank you!

@@ -49,6 +49,7 @@ Here are the valid values for the orchestrator types:
|Name of addon|Enabled by default?|How many containers|Description|
|tiller|true|Delivers the Helm server-side component: tiller. See https://github.com/kubernetes/helm for more info.|
|kubernetes-dashboard|true|1|Delivers the kubernetes dashboard component. See https://github.com/kubernetes/dashboard for more info.|
|rescheduler|false|Delivers the kubernetes rescheduler component.|
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find the kubernetes repo for rescheduler

Copy link
Member

@jackfrancis jackfrancis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jackfrancis jackfrancis merged commit 0ec78c7 into Azure:master Nov 18, 2017
@ghost ghost removed the awaiting review label Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

guaranteed scheduling of critical add-ons requires a **Rescheduler** pod
2 participants