diff --git a/openshift-kube-apiserver/admission/autoscaling/managementcpusoverride/admission.go b/openshift-kube-apiserver/admission/autoscaling/managementcpusoverride/admission.go index 9bf0a1f8a1cfa..2895cbd1be410 100644 --- a/openshift-kube-apiserver/admission/autoscaling/managementcpusoverride/admission.go +++ b/openshift-kube-apiserver/admission/autoscaling/managementcpusoverride/admission.go @@ -192,9 +192,11 @@ func (a *managementCPUsOverride) Admit(ctx context.Context, attr admission.Attri return admission.NewForbidden(attr, err) // can happen due to informer latency } - // we still need to have nodes under the cluster to decide if the management resource enabled or not + // if the cluster has no nodes yet (e.g. during bootstrap), we cannot determine whether + // CPU partitioning is enabled — allow the pod without mutation rather than blocking it, + // which would prevent the machine-approver from starting and create a deadlock. if len(nodes) == 0 { - return admission.NewForbidden(attr, fmt.Errorf("%s the cluster does not have any nodes", PluginName)) + return nil } clusterInfra, err := a.infraConfigLister.Get(infraClusterName) diff --git a/openshift-kube-apiserver/admission/autoscaling/managementcpusoverride/admission_test.go b/openshift-kube-apiserver/admission/autoscaling/managementcpusoverride/admission_test.go index 9564bffe39578..a06304a31e10a 100644 --- a/openshift-kube-apiserver/admission/autoscaling/managementcpusoverride/admission_test.go +++ b/openshift-kube-apiserver/admission/autoscaling/managementcpusoverride/admission_test.go @@ -268,13 +268,12 @@ func TestAdmit(t *testing.T) { infra: testClusterInfraWithoutWorkloadPartitioning(), }, { - name: "should return admission error when the cluster does not have any nodes", + name: "should allow pod without mutation when the cluster does not have any nodes", pod: testManagedPod("500m", "250m", "500Mi", "250Mi"), expectedCpuRequest: resource.MustParse("250m"), namespace: testManagedNamespace(), nodes: []*corev1.Node{}, infra: testClusterSNOInfra(), - expectedError: fmt.Errorf("the cluster does not have any nodes"), }, }