-
Notifications
You must be signed in to change notification settings - Fork 4
Add RVR Status Config Peers Controller #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
asergunov
wants to merge
17
commits into
astef-prototype
Choose a base branch
from
rvr-status-config-peers-controller
base: astef-prototype
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+822
−21
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add readiness check and implement RVR status config peers controller - Introduced `IsReady` method in `ReplicatedVolumeReplica` to determine readiness based on node name and status configuration. - Added a new controller for managing the status of replicated volume replicas, including a handler and reconciler for processing replica readiness and peer management. Signed-off-by: Anton Sergunov <[email protected]>
- Removed the `IsReady` method from `ReplicatedVolumeReplica` as it is no longer needed. - Updated the controller to use a more concise naming convention for the controller and reconciler. - Eliminated the `Handler` struct and its associated logic, streamlining the reconciliation process. - Enhanced the peer management logic to filter out unrelated replicas and ensure only relevant peers are considered. - Improved logging for better traceability during reconciliation. Signed-off-by: Anton Sergunov <[email protected]>
- Updated the reconciliation process to skip adding peers that already exist on the same node, improving efficiency and preventing duplicate entries. - Adjusted logging to indicate when a peer on the node is already found and skipped. Signed-off-by: Anton Sergunov <[email protected]>
- Introduced the `rvr_status_config_peers` controller to manage the status of replicated volume replicas. - Implemented a reconciler for handling the reconciliation logic. - Added unit tests for the reconciler to ensure correct behavior. - Updated the main registry to include the new controller. Signed-off-by: Anton Sergunov <[email protected]>
- Expanded unit tests for the RVR status config peers controller, adding comprehensive checks for peer management and reconciliation scenarios. - Introduced new Gomega matchers to validate the presence and correctness of peers in the RVR status. - Updated the reconciler to ensure proper handling of peer updates, including filtering out duplicates and managing readiness states effectively. Signed-off-by: Anton Sergunov <[email protected]>
…iency - Removed redundant helper functions and streamlined test cases for better readability. - Introduced a new `makeReady` function to simplify the setup of RVR readiness in tests. - Enhanced test assertions to ensure accurate validation of peer management and reconciliation outcomes. Signed-off-by: Anton Sergunov <[email protected]>
- Renamed the `whenResourcesCreated` function to `whenCreated` for clarity and improved parameter order. - Updated test cases to utilize the new helper function, enhancing readability and consistency. - Added support for multiple `ReplicatedVolume` instances in tests to better simulate real-world scenarios. Signed-off-by: Anton Sergunov <[email protected]>
- Removed redundant helper functions and streamlined test cases for improved clarity and efficiency. - Introduced a new `makeReady` function to simplify the setup of RVR readiness in tests. - Enhanced test assertions to ensure accurate validation of peer management and reconciliation outcomes. - Updated the reconciler to improve logging and ensure proper handling of peer updates. Signed-off-by: Anton Sergunov <[email protected]>
…rity - Removed the `newScheme` helper function and directly initialized the scheme in the test setup for better readability. - Simplified test cases by consolidating assertions and enhancing the context descriptions for clarity. - Ensured consistent use of the `expectReconcileSuccessfully` function to streamline reconciliation checks. Signed-off-by: Anton Sergunov <[email protected]>
- Added Apache License 2.0 copyright notice to the top of the following files: controller.go, reconciler.go, reconciler_test.go, and rvr_status_config_peers_suite_test.go. - Ensured compliance with licensing requirements for the project. Signed-off-by: Anton Sergunov <[email protected]>
- Changed the client type in tests from `client.Client` to `client.WithWatch` to support watch functionality. - Added interceptor functions to the client builder for enhanced testing capabilities. - Improved test setup by integrating the new client configuration. Signed-off-by: Anton Sergunov <[email protected]>
- Added test cases to handle non-NotFound errors during Get, List, and Patch operations for ReplicatedVolume and ReplicatedVolumeReplica. - Introduced interceptor functions to simulate error conditions, improving the robustness of the tests. - Ensured that the reconciler behaves correctly when encountering various error scenarios, enhancing overall test coverage. Signed-off-by: Anton Sergunov <[email protected]>
…onsistency - Simplified the `makeReady` function by removing the `nodeName` parameter, enhancing clarity in test setup. - Updated test cases to reflect the new function signature, ensuring consistent usage across tests. - Improved matcher assertions for checking RVR status and peers, streamlining the validation process. Signed-off-by: Anton Sergunov <[email protected]>
- Updated the HaveAllPeersSet matcher to return HaveNoPeers when the expectedResources slice contains fewer than two RVRs, ensuring correct behavior in edge cases. - Improved documentation for the matcher to clarify its functionality regarding peer checks. Signed-off-by: Anton Sergunov <[email protected]>
…tus config peers tests - Eliminated the Status field containing DRBDConfig from multiple instances of ReplicatedVolumeReplica in the reconciler test file, streamlining the test setup. - This change enhances clarity and focuses on the essential aspects of the tests without unnecessary complexity. Signed-off-by: Anton Sergunov <[email protected]>
Signed-off-by: Anton Sergunov <[email protected]>
…r handling - Replaced WithTransform with gcustom.MakeMatcher in the HaveAllPeersSet and HaveAllPeersSetForAll matchers to enhance error handling and clarity. - Streamlined the matcher logic to ensure consistent behavior when validating RVR peers. Signed-off-by: Anton Sergunov <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add RVR Status Config Peers Controller
Implements #335
Summary
This PR introduces a new controller
rvr_status_config_peers_controllerthat automatically manages peer configuration inReplicatedVolumeReplicastatus. The controller ensures that each replica has up-to-date information about all other replicas (peers) in the sameReplicatedVolume, excluding itself.Changes
New Controller Implementation
rvr_status_config_peers_controllerReplicatedVolumeresourcesReplicatedVolumeReplicaresources (via owner reference)status.config.peersfield in eachReplicatedVolumeReplicaKey Features
Peer Discovery: Automatically discovers all replicas belonging to a
ReplicatedVolumeby:ReplicatedVolumeNodeName,Status.Config.NodeId,Status.Config.Address)Peer Management:
status.config.peerscontains all other replicas (excluding itself)Disklessflag in peer informationOptimization:
Testing
Comprehensive test suite using Ginkgo/Gomega covering:
Dependencies
github.com/onsi/ginkgo/v2tov2.27.2github.com/onsi/gomegatov1.38.2Files Changed
images/controller/internal/controllers/rvr_status_config_peers/controller.go- Controller setupimages/controller/internal/controllers/rvr_status_config_peers/reconciler.go- Reconciliation logicimages/controller/internal/controllers/rvr_status_config_peers/reconciler_test.go- Test suiteimages/controller/internal/controllers/rvr_status_config_peers/rvr_status_config_peers_suite_test.go- Test suite setupimages/controller/internal/controllers/registry.go- Controller registrationimages/controller/go.mod- Dependency updatesimages/controller/go.sum- Dependency checksumsHow It Works
ReplicatedVolumeor itsReplicatedVolumeReplicachanges, the controller is triggeredReplicatedVolumeReplicatedVolumeReplicaresourcesReplicatedVolumewith required status fieldsstatus.config.peerswith all other replicas (excluding itself)Benefits