From 7f25fb8b9c1165375009e1384e729bf9f0db1f49 Mon Sep 17 00:00:00 2001 From: Francesco Romani Date: Tue, 13 Feb 2024 16:41:36 +0100 Subject: [PATCH] config: don't check or use FeatureGate GetAllocatableResponse's FG matured in recent kubes (around 1.27) so there's no point anymore in checking it. Signed-off-by: Francesco Romani --- README.md | 4 --- hack/kind-config-e2e-positive.yaml | 2 -- pkg/validator/kubeletconfig.go | 44 ++---------------------------- 3 files changed, 3 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 1553f84f..0618692c 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,6 @@ kubeadmConfigPatches: cpuManagerPolicy: "static" topologyManagerPolicy: "single-numa-node" reservedSystemCPUs: "0,16" - featureGates: - KubeletPodResourcesGetAllocatable: true nodes: - role: control-plane - role: worker @@ -158,8 +156,6 @@ kubeadmConfigPatches: cpuManagerPolicy: "static" topologyManagerPolicy: "single-numa-node" reservedSystemCPUs: "0,16" - featureGates: - KubeletPodResourcesGetAllocatable: true nodes: - role: control-plane - role: worker diff --git a/hack/kind-config-e2e-positive.yaml b/hack/kind-config-e2e-positive.yaml index 1b348bde..ba1931e6 100644 --- a/hack/kind-config-e2e-positive.yaml +++ b/hack/kind-config-e2e-positive.yaml @@ -17,8 +17,6 @@ kubeadmConfigPatches: memory: "612Mi" systemReserved: memory: "256Mi" - featureGates: - KubeletPodResourcesGetAllocatable: true nodes: - role: control-plane - role: worker diff --git a/pkg/validator/kubeletconfig.go b/pkg/validator/kubeletconfig.go index c59dfe31..1ea78f96 100644 --- a/pkg/validator/kubeletconfig.go +++ b/pkg/validator/kubeletconfig.go @@ -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 ( @@ -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, @@ -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 -}