[sig-cluster-lifecycle] CSR approver test fails with 401 Unauthorized on ROSA STS clusters in 4.22+
Bug Report
The test [sig-cluster-lifecycle] CSRs from machines that are not recognized by the cloud provider are not approved fails with 401 Unauthorized on ROSA Classic STS clusters starting in OCP 4.22. The test passes on 4.21.
Affected Jobs
periodic-ci-openshift-release-main-nightly-4.22-e2e-rosa-sts-ovnperiodic-ci-openshift-release-main-nightly-4.23-e2e-rosa-sts-ovnperiodic-ci-openshift-release-main-nightly-5.0-e2e-rosa-sts-ovn
What the Test Does
The test (in test/extended/csrapprover/csrapprover.go, lines 93-155):
- Creates a bogus CSR for
system:node:hacking-node.ec2.internal - Gets a bearer token for the
node-bootstrapperSA inopenshift-machine-config-operatorvia TokenRequest API - Uses that token to create a CertificateSigningRequest
- Expects either success (then verifies it was not approved) or timeout
What Fails
Step 3 returns 401 Unauthorized at csrapprover.go:133. The node-bootstrapper SA token is rejected by the kube-apiserver on ROSA STS clusters in 4.22+.
Expected Behavior
The test should handle 401 Unauthorized as a valid "not approved" outcome, since a rejected token means the CSR can never be approved. The current code only expects success or timeout.
Suggested Fix
In csrapprover.go:133, accept 401 Unauthorized as a valid outcome alongside the existing success and timeout paths. The 401 indicates stricter SA token validation on STS clusters in 4.22, which is arguably correct behavior (the token is rejected before the CSR is even created).
Environment
- Platform: ROSA Classic STS (AWS)
- OCP versions affected: 4.22+
- OCP versions passing: 4.21
- The test does not exist in the 4.19 openshift-tests binary
/area test /sig cluster-lifecycle
Source: openshift/origin