Skip to content

Commit

Permalink
config: don't check or use FeatureGate
Browse files Browse the repository at this point in the history
GetAllocatableResponse's FG matured in recent kubes (around 1.27)
so there's no point anymore in checking it.

Signed-off-by: Francesco Romani <[email protected]>
  • Loading branch information
ffromani committed Feb 13, 2024
1 parent fcf14ad commit 7f25fb8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 47 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ kubeadmConfigPatches:
cpuManagerPolicy: "static"
topologyManagerPolicy: "single-numa-node"
reservedSystemCPUs: "0,16"
featureGates:
KubeletPodResourcesGetAllocatable: true
nodes:
- role: control-plane
- role: worker
Expand Down Expand Up @@ -158,8 +156,6 @@ kubeadmConfigPatches:
cpuManagerPolicy: "static"
topologyManagerPolicy: "single-numa-node"
reservedSystemCPUs: "0,16"
featureGates:
KubeletPodResourcesGetAllocatable: true
nodes:
- role: control-plane
- role: worker
Expand Down
2 changes: 0 additions & 2 deletions hack/kind-config-e2e-positive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ kubeadmConfigPatches:
memory: "612Mi"
systemReserved:
memory: "256Mi"
featureGates:
KubeletPodResourcesGetAllocatable: true
nodes:
- role: control-plane
- role: worker
44 changes: 3 additions & 41 deletions pkg/validator/kubeletconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ const (
)

const (
ExpectedPodResourcesFeatureGate = "KubeletPodResourcesGetAllocatable"
ExpectedCPUManagerPolicy = "static"
ExpectedMemoryManagerPolicy = kubeletconfigv1beta1.StaticMemoryManagerPolicy
ExpectedTopologyManagerPolicy = kubeletconfigv1beta1.SingleNumaNodeTopologyManagerPolicy
ExpectedCPUManagerPolicy = "static"
ExpectedMemoryManagerPolicy = kubeletconfigv1beta1.StaticMemoryManagerPolicy
ExpectedTopologyManagerPolicy = kubeletconfigv1beta1.SingleNumaNodeTopologyManagerPolicy
)

const (
Expand Down Expand Up @@ -112,30 +111,6 @@ func ValidateClusterNodeKubeletConfig(nodeName string, nodeVersion *version.Info
return vrs
}

if needCheckFeatureGates(nodeVersion) {
if kubeletConf.FeatureGates == nil {
vrs = append(vrs, ValidationResult{
Node: nodeName,
Area: AreaKubelet,
Component: ComponentFeatureGates,
/* no specific Setting: all are missing! */
Expected: "present",
Detected: "missing data",
})
} else {
if enabled := kubeletConf.FeatureGates[ExpectedPodResourcesFeatureGate]; !enabled {
vrs = append(vrs, ValidationResult{
Node: nodeName,
Area: AreaKubelet,
Component: ComponentFeatureGates,
Setting: ExpectedPodResourcesFeatureGate,
Expected: "enabled",
Detected: "disabled",
})
}
}
}

if kubeletConf.CPUManagerPolicy != ExpectedCPUManagerPolicy {
vrs = append(vrs, ValidationResult{
Node: nodeName,
Expand Down Expand Up @@ -203,16 +178,3 @@ func ValidateClusterNodeKubeletConfig(nodeName string, nodeVersion *version.Info
}
return vrs
}

func needCheckFeatureGates(nodeVersion *version.Info) bool {
if nodeVersion == nil {
// we don't know, we don't take any risk
return true
}
if nodeVersion.GitVersion == "" {
// ditto
return true
}
ok, _ := isAPIVersionAtLeast(nodeVersion.GitVersion, kubeMinVersionGetAllocatable)
return !ok // note NOT
}

0 comments on commit 7f25fb8

Please sign in to comment.