Skip to content

Commit

Permalink
Add support for two more kubelet flags
Browse files Browse the repository at this point in the history
cpu-manager-policy and kube-reserved
  • Loading branch information
puneetguptanitj committed Nov 26, 2018
1 parent 03c667d commit 6a69caf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
// Currently set it similar to upstream
// https://github.com/kubernetes/kubernetes/blob/v1.10.4/cmd/kubeadm/app/phases/controlplane/manifests.go#L340
ControllerManagerAllocateNodeCIDRs = "true"
KubeletConfigKubeReservedCPUKey = "cpu"
)

const (
Expand Down Expand Up @@ -75,7 +76,7 @@ const (
NodeadmKubeletSystemdDropinFilename = "20-nodeadm.conf"
NodeadmKubeletSystemdDropinTemplate = `[Service]
Environment="KUBELET_DNS_ARGS=--cluster-dns={{ .ClusterDNS }} --cluster-domain={{ .ClusterDomain }}"
Environment="KUBELET_EXTRA_ARGS=--max-pods={{ .MaxPods }} --fail-swap-on={{ .FailSwapOn }} --hostname-override={{ .HostnameOverride }} --kube-api-qps={{ .KubeAPIQPS }} --kube-api-burst={{ .KubeAPIBurst }} --feature-gates={{ .FeatureGates}} --eviction-hard={{ .EvictionHard }}"
Environment="KUBELET_EXTRA_ARGS=--max-pods={{ .MaxPods }} --fail-swap-on={{ .FailSwapOn }} --hostname-override={{ .HostnameOverride }} --kube-api-qps={{ .KubeAPIQPS }} --kube-api-burst={{ .KubeAPIBurst }} --feature-gates={{ .FeatureGates}} --eviction-hard={{ .EvictionHard }} --cpu-manager-policy={{ .CPUManagerPolicy }} --kube-reserved={{ .KubeReservedCPU }}"
`
)

Expand Down
6 changes: 6 additions & 0 deletions utils/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ func placeAndModifyNodeadmKubeletSystemdDropin(netConfig apis.Networking, kubele
KubeAPIBurst int32
EvictionHard string
FeatureGates string
CPUManagerPolicy string
KubeReservedCPU string
}{
FailSwapOn: *kubeletConfig.FailSwapOn,
MaxPods: kubeletConfig.MaxPods,
Expand All @@ -133,6 +135,10 @@ func placeAndModifyNodeadmKubeletSystemdDropin(netConfig apis.Networking, kubele
KubeAPIBurst: kubeletConfig.KubeAPIBurst,
EvictionHard: constants.KubeletEvictionHard,
FeatureGates: constants.FeatureGates,
CPUManagerPolicy: kubeletConfig.CPUManagerPolicy,
}
if value, ok := kubeletConfig.KubeReserved[constants.KubeletConfigKubeReservedCPUKey]; ok {
data.KubeReservedCPU = fmt.Sprintf("%q=%q", constants.KubeletConfigKubeReservedCPUKey, value)
}

writeTemplateIntoFile(constants.NodeadmKubeletSystemdDropinTemplate, "nodeadm-kubelet-systemd-dropin", confFile, data)
Expand Down

0 comments on commit 6a69caf

Please sign in to comment.