fix: DevWorkspace watcher handling for forbidden namespaces (crw-12318) - #365
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe DevWorkspace watcher now handles Kubernetes ChangesDevWorkspace watcher lifecycle
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to The change improves handling of forbidden and missing namespaces without any actionable merge-blocking risk remaining; it is merge-ready after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #365 +/- ##
==========================================
+ Coverage 0.00% 35.45% +35.45%
==========================================
Files 4 114 +110
Lines 26 4978 +4952
Branches 0 962 +962
==========================================
+ Hits 0 1765 +1765
- Misses 26 2958 +2932
- Partials 0 255 +255 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
defcea4 to
0959977
Compare
| } catch (e: ApiException) { | ||
| if (e.code == 403 || e.code == 404) { | ||
| // User cannot watch this namespace/resource. | ||
| return |
There was a problem hiding this comment.
we're returning if we hit a 403/404 when watching the current namespace and stop trying to watch it. We should therefore set stopped = true
Signed-off-by: msivasubramaniaan <msivasub@redhat.com> Co-authored-by: Andre Dietisheim <adietish@redhat.com>
0959977 to
83a986d
Compare
|
@msivasubramaniaan: thanks! change is good, beside the additional change that I pointed out. |
fixes https://redhat.atlassian.net/browse/CRW-12318
What does this PR do?
Handles Kubernetes
403 Forbiddenand404 Not Founderrors when creating DevWorkspace watchers for namespaces where the user does not have permission to watchdevworkspaces.Why is this needed?
The initial DevWorkspace listing can succeed even when the user does not have
watchpermission. The watcher was created outside the exception handling block, causing theApiExceptionto escape the coroutine and terminate the watcher.This change:
tryblock.403/404errors without repeatedly retrying.This allows the Gateway to gracefully handle namespaces where DevWorkspace watch permissions are unavailable.