feat: Stateful Resource Reconciler#320
Merged
Merged
Conversation
Contributor
|
@freeznet:Thanks for your contribution. For this PR, do we need to update docs? |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a stateful reconciliation framework for managing Pulsar resource state, with new tests added to validate permission state annotations and multi-permission handling.
- Introduces a BaseStatefulReconciler and its interfaces for generic state tracking
- Enhances PulsarPermission reconciliation with context change detection and state annotation updates
- Adds comprehensive test cases to verify correct permission operations and state transitions
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/operator/resources_test.go | Added test cases for initial state, role modifications, and multi-permission scenarios |
| pkg/reconciler/stateful_reconciler.go | Introduced a generic framework for stateful resource reconciliation using annotations |
| pkg/connection/reconcile_permission.go | Updated PulsarPermission reconciliation with context change detection and improved state tracking |
Comments suppressed due to low confidence (1)
pkg/connection/reconcile_permission.go:181
- The variable 'currentPermissions' is used to determine slice capacity and in the iteration below but is not defined in this scope. Consider replacing it with the appropriate source of current roles (for example, using permission.Spec.Roles) to ensure the intended logic is applied.
currentRoles := make([]string, 0, len(currentPermissions))
maxsxu
approved these changes
Jun 27, 2025
Member
maxsxu
left a comment
There was a problem hiding this comment.
👍 Creative work! two questions here:
- what if the annotations been modified externally or lost?
- we need take care that annotation has max value size limitation
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
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.
(If this PR fixes a github issue, please add
Fixes #<xyz>.)Fixes #310
(or if this PR is one task of a github issue, please add
Master Issue: #<xyz>to link to the master issue.)Master Issue: #
Motivation
Explain here the context, and why you're making that change. What is the problem you're trying to solve.
Modifications
Describe the modifications you've done.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Documentation
Check the box below.
Need to update docs?
doc-required(If you need help on updating docs, create a doc issue)
no-need-doc(Please explain why)
doc(If this PR contains doc changes)