Skip to content

Commit

Permalink
disable localStorageCapacityIsolation for rootless in > v1.25.0-alpha…
Browse files Browse the repository at this point in the history
….3.440+0064010cddfa00
  • Loading branch information
BenTheElder committed Aug 3, 2022
1 parent 5e5f8f7 commit 4f47894
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions pkg/cluster/internal/kubeadm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,16 @@ type ConfigData struct {
// Labels are the labels, in the format "key1=val1,key2=val2", with which the respective node will be labeled
NodeLabels string

// DerivedConfigData is populated by Derive()
// These auto-generated fields are available to Config templates,
// but not meant to be set by hand
DerivedConfigData

// Provider is running with rootless mode, so kube-proxy needs to be configured
// not to fail on sysctl error.
// RootlessProvider is true if kind is running with rootless mode
RootlessProvider bool

// DisableLocalStorageCapacityIsolation is typically set true based on RootlessProvider
// based on the Kubernetes version, if true kubelet localStorageCapacityIsolation is set false
DisableLocalStorageCapacityIsolation bool

// DerivedConfigData contains fields computed from the other fields for use
// in the config templates and should only be populated by calling Derive()
DerivedConfigData
}

// DerivedConfigData fields are automatically derived by
Expand Down Expand Up @@ -537,6 +539,7 @@ evictionHard:
{{ range $key := .SortedFeatureGateKeys }}
"{{ $key }}": {{ index $.FeatureGates $key }}
{{end}}{{end}}
localStorageCapacityIsolation: {{if .DisableLocalStorageCapacityIsolation}}false{{else}}true{{end}}
{{if ne .KubeProxyMode "None"}}
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
Expand Down Expand Up @@ -585,7 +588,14 @@ func Config(data ConfigData) (config string, err error) {

// For avoiding err="failed to get rootfs info: failed to get device for dir \"/var/lib/kubelet\": could not find device with major: 0, minor: 41 in cached partitions map"
// https://github.com/kubernetes-sigs/kind/issues/2524
data.FeatureGates["LocalStorageCapacityIsolation"] = false
// TODO: make this version more precise
if ver.LessThan(version.MustParseSemantic("v1.25.0-alpha.3.440+0064010cddfa00")) {
// this feature gate was removed in v1.25 and replaced by an opt-out to disable
data.FeatureGates["LocalStorageCapacityIsolation"] = false
} else {
// added in v1.25 https://github.com/kubernetes/kubernetes/pull/111513
data.DisableLocalStorageCapacityIsolation = true
}
}

// assume the latest API version, then fallback if the k8s version is too low
Expand Down

0 comments on commit 4f47894

Please sign in to comment.