Conversation
📝 WalkthroughWalkthroughThis PR replaces hardcoded ChangesDynamic Kubernetes namespace resolution
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/resources/analysis/entity.py (1)
59-77: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low valueUse
self.namespacein the deployment call for consistency. Pass the resolved namespace intocreate_analysis_deploymentso the start path uses the same value as the DB row and teardown path.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/resources/analysis/entity.py` around lines 59 - 77, The deployment creation path is using the raw namespace argument instead of the resolved value stored in self.namespace, which can diverge from the DB row and teardown flow. Update the create_analysis_deployment call in the analysis entity start path to pass self.namespace, matching the earlier database.create_analysis and keeping namespace usage consistent throughout the entity lifecycle.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/resources/analysis/entity.py`:
- Around line 59-77: The deployment creation path is using the raw namespace
argument instead of the resolved value stored in self.namespace, which can
diverge from the DB row and teardown flow. Update the create_analysis_deployment
call in the analysis entity start path to pass self.namespace, matching the
earlier database.create_analysis and keeping namespace usage consistent
throughout the entity lifecycle.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6f49b875-0691-496e-9267-d194e4664444
📒 Files selected for processing (9)
src/api/api.pysrc/k8s/kubernetes.pysrc/k8s/utils.pysrc/resources/analysis/entity.pysrc/resources/utils.pysrc/status/status.pysrc/utils/mb_client.pytests/test_k8s_utils.pytests/test_resources_utils.py
There were several method calls that took
namespaceas an input parameters, but were not set and fell back to "default" causing the PO to crash when deployed in non-default namespaces with RBAC enabled. This PR updates all methods that use the namespace context to use theget_current_namespace()method.Additionally, to cut down on IO, the
@lru_cache()decorator was added to theget_current_namespace()method since it is called often and this value should not change once deployed.Summary by CodeRabbit
Bug Fixes
Tests