Offboard a team from a backend if it's removed from GroupCR - #214
Offboard a team from a backend if it's removed from GroupCR#214maxkashyap41 wants to merge 3 commits into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a critical automation feature to the Group controller, enabling it to gracefully handle the removal of backend integrations from a Group Custom Resource. Previously, manual intervention might have been required to clean up teams from external systems when their corresponding backend was removed from the Group's specification. This change automates the end-to-end offboarding process, ensuring that when a backend is no longer specified, the associated team is automatically deleted from that backend and relevant cache stores are updated, thereby maintaining data consistency and reducing operational overhead. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. A backend removed, a team must depart, No longer needed, a fresh, clean start. The controller watches, with vigilant eye, To keep systems tidy, beneath the digital sky. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a key feature to handle the offboarding of teams from backends when they are removed from a Group custom resource, correctly detecting removed backends and orchestrating their cleanup. While the refactoring of the cache lock and the addition of comprehensive unit tests are positive, the implementation has two significant security concerns: a Broken Access Control (IDOR) vulnerability due to GroupName being used as a global identifier without namespace isolation, and a potential Denial of Service (DoS) vulnerability where an expensive network operation (FetchAllTeams) is performed while holding a global lock. Furthermore, the reliance on FetchAllTeams in the new offboarding logic could lead to performance inefficiencies for backends with a large number of teams.
…verage This PR implements the critical feature to automatically detect and offboard from backends that have been removed from a Group's specification, ensuring proper resource cleanup and preventing resource leakage. - Add handleRemovedBackends() to detect and offboard from removed backends - Add detectRemovedBackends() to compare spec vs status for removed backends - Add offboardFromRemovedBackends() to perform cleanup using existing DeleteTeamByID - Integrate backend removal detection into main Reconcile loop for continuous monitoring - Add comprehensive unit tests covering all error paths and edge cases - Test backend deleted while other backends exist (cache updated correctly) - Test last backend deleted (entire cache entry removed) - Test error handling for cache operations after backend deletion - Test graceful handling of cache misses, client creation errors, and transformation failures - All 18 controller tests passing with 32.9% code coverage - Implement DRY principle by extracting getBackendKey() helper function - Replace all duplicate backend key generation logic with helper function - Enhanced error collection - continues processing all backends even with failures - Clean up unused imports and resolve all linter errors - Remove PR reviewer comments from production code - Robust error handling for group name transformation failures - Graceful handling of missing backend configurations - Proper cache management for partial and complete backend removal - Zero linting issues - production ready Resolves: DATA-3526 Signed-off-by: Roshan Patil <roshpati@redhat.com> fix: resolve CI test failures by replacing rover backends with fivetran in tests - Fixed test panics caused by rover backend global config file loading - Changed failing tests to use fivetran backends which don't require external config files - Updated test expectations to match actual error messages - All 21 controller tests now passing successfully - Resolves GitHub Actions CI failures Signed-off-by: Roshan Patil <roshpati@redhat.com>
Signed-off-by: Madhurjya Das <madhurjyakumardas@gmail.com>
…llisions & scan Team details optimizations Signed-off-by: Madhurjya Das <madhurjyakumardas@gmail.com> Fixing the review comments on critical issues v2 Signed-off-by: Madhurjya Das <madhurjyakumardas@gmail.com>
Changes
📝 Description
What changed?
It handles the problem is the user_group removes any backend (rover/fivetran/gitlab/snowflake) the reconciler simply updates the functionality by removing the group for that specific backend. Also it updates both the groupstore and teamstore.
Why is this change needed?
This changes automates the e2e removal of user_group for a specific backend when the CR state changes and reconciler updates the desired state gracefully automating the process e2e from backend processes to updating the cache store of that particular group.
Dependencies
🧪 Testing
Test Coverage
Performance Impact
🚀 Deployment
Deploy Steps
Prerequisites
Post-Deployment Monitoring
Rollback Plan
Details:
⚙️ Configuration Changes
✅ Developer Checklist