From 6f7099806b6304323c7012d12d04054b30fdb212 Mon Sep 17 00:00:00 2001 From: Neeraj Krishna Gopalakrishna Date: Wed, 24 Jun 2026 10:02:57 +0530 Subject: [PATCH 1/2] Fix the system compressible --- test/extended/node/system_compressible.go | 35 +++++++++++------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/test/extended/node/system_compressible.go b/test/extended/node/system_compressible.go index 6eb0dcc6351d..b3bf7f4bf991 100644 --- a/test/extended/node/system_compressible.go +++ b/test/extended/node/system_compressible.go @@ -11,11 +11,13 @@ import ( o "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" kubeletconfigv1beta1 "k8s.io/kubelet/config/v1beta1" "k8s.io/kubernetes/test/e2e/framework" + "sigs.k8s.io/yaml" mcfgv1 "github.com/openshift/api/machineconfiguration/v1" machineconfigclient "github.com/openshift/client-go/machineconfiguration/clientset/versioned" @@ -55,24 +57,21 @@ var _ = g.Describe("[Suite:openshift/disruptive-longrunning][sig-node][Disruptiv o.Expect(isSystemCompressibleEnabled(config)).To(o.BeTrue(), "System compressible should be enabled by default") - // Read SYSTEM_RESERVED_CPU from /etc/node-sizing.env - g.By("Reading SYSTEM_RESERVED_CPU from /etc/node-sizing.env") - nodeSizingOutput, err := ExecOnNodeWithChroot(oc, nodeName, "cat", "/etc/node-sizing.env") - o.Expect(err).NotTo(o.HaveOccurred(), "Should be able to read /etc/node-sizing.env") - framework.Logf("/etc/node-sizing.env contents:\n%s", nodeSizingOutput) - - // Parse SYSTEM_RESERVED_CPU value (e.g., "0.5" means 500m) - var systemReservedCPU float64 - for _, line := range strings.Split(nodeSizingOutput, "\n") { - if strings.HasPrefix(line, "SYSTEM_RESERVED_CPU=") { - cpuStr := strings.TrimPrefix(line, "SYSTEM_RESERVED_CPU=") - systemReservedCPU, err = strconv.ParseFloat(cpuStr, 64) - o.Expect(err).NotTo(o.HaveOccurred(), "Should be able to parse SYSTEM_RESERVED_CPU value: %s", cpuStr) - break - } - } - o.Expect(systemReservedCPU).To(o.BeNumerically(">", 0), "SYSTEM_RESERVED_CPU should be set") - framework.Logf("SYSTEM_RESERVED_CPU: %.2f (%.0f millicores)", systemReservedCPU, systemReservedCPU*1000) + g.By("Reading systemReserved.cpu from /etc/openshift/kubelet.conf.d/20-auto-sizing.conf") + autoSizingOutput, err := ExecOnNodeWithChroot(oc, nodeName, "cat", "/etc/openshift/kubelet.conf.d/20-auto-sizing.conf") + o.Expect(err).NotTo(o.HaveOccurred(), "Should be able to read /etc/openshift/kubelet.conf.d/20-auto-sizing.conf") + framework.Logf("/etc/openshift/kubelet.conf.d/20-auto-sizing.conf contents:\n%s", autoSizingOutput) + + var autoSizingConfig kubeletconfigv1beta1.KubeletConfiguration + err = yaml.Unmarshal([]byte(autoSizingOutput), &autoSizingConfig) + o.Expect(err).NotTo(o.HaveOccurred(), "Should be able to parse auto-sizing config") + + cpuQuantity, ok := autoSizingConfig.SystemReserved["cpu"] + o.Expect(ok).To(o.BeTrue(), "systemReserved.cpu should be set") + cpuResource := resource.MustParse(cpuQuantity) + systemReservedCPU := float64(cpuResource.MilliValue()) / 1000.0 + o.Expect(systemReservedCPU).To(o.BeNumerically(">", 0), "systemReserved.cpu should be greater than 0") + framework.Logf("systemReserved.cpu: %.2f (%.0f millicores)", systemReservedCPU, systemReservedCPU*1000) // Convert to cpuShares: cpuShares = systemReservedCPU * 1024 cpuShares := uint64(systemReservedCPU * 1024) From ab505a01de2f38e2174fd5573c41df880f967a18 Mon Sep 17 00:00:00 2001 From: Neeraj Krishna Gopalakrishna Date: Fri, 26 Jun 2026 17:49:37 +0530 Subject: [PATCH 2/2] Update test/extended/node/system_compressible.go Fix based on coderabbit suggestion Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- test/extended/node/system_compressible.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/extended/node/system_compressible.go b/test/extended/node/system_compressible.go index b3bf7f4bf991..58aa680ac6b2 100644 --- a/test/extended/node/system_compressible.go +++ b/test/extended/node/system_compressible.go @@ -68,7 +68,8 @@ var _ = g.Describe("[Suite:openshift/disruptive-longrunning][sig-node][Disruptiv cpuQuantity, ok := autoSizingConfig.SystemReserved["cpu"] o.Expect(ok).To(o.BeTrue(), "systemReserved.cpu should be set") - cpuResource := resource.MustParse(cpuQuantity) + cpuResource, err := resource.ParseQuantity(cpuQuantity) + o.Expect(err).NotTo(o.HaveOccurred(), "systemReserved.cpu must be a valid resource quantity") systemReservedCPU := float64(cpuResource.MilliValue()) / 1000.0 o.Expect(systemReservedCPU).To(o.BeNumerically(">", 0), "systemReserved.cpu should be greater than 0") framework.Logf("systemReserved.cpu: %.2f (%.0f millicores)", systemReservedCPU, systemReservedCPU*1000)