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

Commit

Permalink
rationalize kubelet flag enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis committed Oct 1, 2018
1 parent 737219b commit 57f09c9
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions pkg/acsengine/defaults-kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,34 +93,15 @@ func setKubeletConfig(cs *api.ContainerService) {
o.KubernetesConfig.KubeletConfig[key] = val
}

// Get rid of values not supported in v1.5 clusters
if !common.IsKubernetesVersionGe(o.OrchestratorVersion, "1.6.0") {
for _, key := range []string{"--non-masquerade-cidr", "--cgroups-per-qos", "--enforce-node-allocatable"} {
delete(o.KubernetesConfig.KubeletConfig, key)
}
}

// Get rid of values not supported in v1.10 clusters
if !common.IsKubernetesVersionGe(o.OrchestratorVersion, "1.10.0") {
for _, key := range []string{"--pod-max-pids"} {
delete(o.KubernetesConfig.KubeletConfig, key)
}
}

// Get rid of values not supported in v1.12 and up
if common.IsKubernetesVersionGe(o.OrchestratorVersion, "1.12.0") {
for _, key := range []string{"--cadvisor-port"} {
delete(o.KubernetesConfig.KubeletConfig, key)
}
}

// Remove secure kubelet flags, if configured
if !helpers.IsTrueBoolPointer(o.KubernetesConfig.EnableSecureKubelet) {
for _, key := range []string{"--anonymous-auth", "--client-ca-file"} {
delete(o.KubernetesConfig.KubeletConfig, key)
}
}

removeKubeletFlags(o.KubernetesConfig.KubeletConfig, o.OrchestratorVersion)

// Master-specific kubelet config changes go here
if cs.Properties.MasterProfile != nil {
if cs.Properties.MasterProfile.KubernetesConfig == nil {
Expand All @@ -129,6 +110,8 @@ func setKubeletConfig(cs *api.ContainerService) {
}
setMissingKubeletValues(cs.Properties.MasterProfile.KubernetesConfig, o.KubernetesConfig.KubeletConfig)
addDefaultFeatureGates(cs.Properties.MasterProfile.KubernetesConfig.KubeletConfig, o.OrchestratorVersion, "", "")

removeKubeletFlags(cs.Properties.MasterProfile.KubernetesConfig.KubeletConfig, o.OrchestratorVersion)
}

// Agent-specific kubelet config changes go here
Expand Down Expand Up @@ -156,6 +139,24 @@ func setKubeletConfig(cs *api.ContainerService) {
addDefaultFeatureGates(profile.KubernetesConfig.KubeletConfig, o.OrchestratorVersion, "1.6.0", "Accelerators=true")
}
}

removeKubeletFlags(profile.KubernetesConfig.KubeletConfig, o.OrchestratorVersion)
}
}

func removeKubeletFlags(k map[string]string, v string) {
// Get rid of values not supported until v1.10
if !common.IsKubernetesVersionGe(v, "1.10.0") {
for _, key := range []string{"--pod-max-pids"} {
delete(k, key)
}
}

// Get rid of values not supported in v1.12 and up
if common.IsKubernetesVersionGe(v, "1.12.0") {
for _, key := range []string{"--cadvisor-port"} {
delete(k, key)
}
}
}

Expand Down

0 comments on commit 57f09c9

Please sign in to comment.