rancher: [backport v2.11] [BUG] error syncing : handler namespace-auth: not found
This is a backport issue for #50046, automatically created via GitHub Actions workflow initiated by @samjustus
Original issue body:
Rancher Server Setup
- Rancher version: 2.11.1
- Installation option (Docker install/Helm Chart): Helm Chart
- If Helm Chart, Kubernetes Cluster and version (RKE1, RKE2, k3s, EKS, etc): RKE2/K3s
- Proxy/Cert Details:
Information about the Cluster
- Kubernetes version: v1.31.6+k3s1 & v1.32.3+k3s1
- Cluster Type (Local/Downstream):
- Cluster A: Local cluster hosting Rancher
- Cluster B: Downstream cluster from cluster A & hosting Rancher
- Cluster C: Downstream cluster from cluster B & hosting Rancher with RKE2 downstream clusters
User Information
- What is the role of the user logged in? Admin/Cluster
Describe the bug After upgrading to rancher 2.11.1 the rancher pods starts spamming the following logs:
2025/04/25 08:07:49 [ERROR] error syncing '<namespace>': handler namespace-auth: projects.management.cattle.io "c-m-xxxxxx/p-xxxxx" not found, requeuing
2025/04/25 08:07:49 [ERROR] error syncing '<namespace>': handler namespace-auth: projects.management.cattle.io "local/p-xxxxx" not found, requeuing
2025/04/25 08:07:49 [ERROR] error syncing '<namespace>': handler namespace-auth: projects.management.cattle.io "c-m-xxxxxx/p-xxxxx" not found, requeuing
2025/04/25 08:07:49 [ERROR] error syncing '<namespace>': handler namespace-auth: projects.management.cattle.io "c-m-xxxxxx/p-xxxxx" not found, requeuing
Additional information The error only appears for namespaces that are linked to a project.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (8 by maintainers)
Thanks so much for taking a look @hansbogert . We realized separately that was the cause. We’ve incorporated that change into https://github.com/rancher/rancher/pull/50110, and will be backporting the change to the next release of v2.11. Just running a final test myself to ensure it’s working as expected since I’m taking it over from Kevin, who is on vacation.
Yeah, there will be a 1 time warning in the logs since they will not be requeued. We’re doing that to ensure if someone is encountering this and it’s a bug we will be aware of it from the logs.
I think there’s a more thorough fix in here that addresses why this controller is being run on a namespace that it shouldn’t be running on, but for now we will go with the simple fix.
The behavior change is due to the the change in the following commit and lines:
https://github.com/rancher/rancher/commit/f036e8b6ab726c3abbc03bbf7c8d0d53373c84e5#diff-0c48bc561d5b6b95a7c11d3c57da516af90a9922fb1c689f64b102b13186ec8eR264-R268 (it seems anchors are broken in github, it’s line 264-268 for the
pkg/controllers/managementuser/rbac/namespace_handler.gofile )Previously, if a projectId was unknown to Cluster B – because it was annotated by cluster A – then it would be ignored and the above code’s previous behavior would just use an unknown projectId in the
namespacevariable. I’m not sure if this was every intended to use projectIds which do not reference any projects on the local cluster, but at least it didn’t result in errors.But with the new behavior the following expression
project, err := n.rq.ProjectLister.Get(parts[0], parts[1])can result in a Not found error.I think the solution, at least to get the same behavior as previously, is to extend the if clause s.t. it becomes:
Maybe this is not fixing but rather hiding a deeper issue, but at least this exhibits the same behavior as before.