feat(pulsaradmin): add offload policies API and tests#1512
Open
freeznet wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds namespace- and topic-level Pulsar Admin APIs for managing offload policies, expands the OffloadPolicies model to cover additional broker/admin fields, and introduces unit tests validating the new JSON and REST behaviors.
Changes:
- Expanded
utils.OffloadPolicieswith additional offload-related configuration fields (S3/GCS/filesystem/universal driver fields, extra configurations). - Added “applied” variants for topic offload policy retrieval to support fetching the effective policy.
- Added namespace offload policy get/set/remove APIs and accompanying REST-level unit tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pulsaradmin/pkg/utils/offload_policies.go |
Extends the OffloadPolicies struct with additional JSON fields and initializes extra configuration maps in the constructor. |
pulsaradmin/pkg/utils/offload_policies_test.go |
Adds serialization/deserialization coverage for newly added OffloadPolicies fields and makes JSON assertions order-insensitive. |
pulsaradmin/pkg/admin/topic.go |
Adds topic APIs to retrieve offload policies with an applied option (effective policy) and wires the legacy getter through the new implementation. |
pulsaradmin/pkg/admin/namespace.go |
Introduces namespace offload policy get/set/remove APIs, including optional JSON decoding behavior. |
pulsaradmin/pkg/admin/offload_policies_test.go |
New tests validating topic “applied” query param behavior and namespace offload policies REST endpoints + null decoding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…elds in offload policies
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 #
(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
align pulsaradmin with broker namespace offload policies API; support namespace full offload config and applied topic get.
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:)
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation