Skip to content

add namespace bundles, subscription-permission, get-deduplication, ge…#2022

Open
nlu90 wants to merge 1 commit intomasterfrom
neng/enhance-namespace
Open

add namespace bundles, subscription-permission, get-deduplication, ge…#2022
nlu90 wants to merge 1 commit intomasterfrom
neng/enhance-namespace

Conversation

@nlu90
Copy link
Contributor

@nlu90 nlu90 commented Mar 12, 2026

…t-encryption-required, and get-subscription-auth-mode commands with tests and help/output cleanup

(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

Improve namespace command parity in pulsarctl by adding several missing read-only/admin inspection commands that already have backing support through existing namespace APIs or policy payloads. This closes practical gaps for users validating namespace state on a Pulsar cluster, especially around subscription permissions, bundles, deduplication, encryption requirements, and subscription auth mode, without requiring SDK changes.

Modifications

  • Added namespace commands:
    • bundles
    • subscription-permission
    • get-deduplication
    • get-encryption-required
    • get-subscription-auth-mode
  • Added command tests for the new commands and argument validation
  • Improved existing subscription permission coverage by fixing revoke command help wiring
  • Cleaned up command UX:
    • removed duplicate alias entries in help for new commands
    • fixed messages-encryption example typo
    • added missing trailing newlines in some success output
    • updated the cluster verification script to build ./bin/pulsarctl explicitly

Verifying this change

  • Make sure that the change passes the CI checks.

(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:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

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)

…t-encryption-required, and get-subscription-auth-mode commands with tests and help/output cleanup
@github-actions
Copy link

@nlu90:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions github-actions bot added doc-info-missing This pr needs to mark a document option in description and removed doc-info-missing This pr needs to mark a document option in description labels Mar 12, 2026
@github-actions
Copy link

@nlu90:Thanks for providing doc info!

@github-actions github-actions bot added the no-need-doc This pr does not need any document label Mar 12, 2026
@nlu90
Copy link
Contributor Author

nlu90 commented Mar 12, 2026

Test cmd:

== bundles ==

+ ./bin/pulsarctl namespaces bundles public/test-ns-cmds
{
  "boundaries": [
    "0x00000000",
    "0x40000000",
    "0x80000000",
    "0xc0000000",
    "0xffffffff"
  ],
  "numBundles": 4
}
== subscription-permission initial ==

+ ./bin/pulsarctl namespaces subscription-permission public/test-ns-cmds
{}
== grant-subscription-permission ==

+ ./bin/pulsarctl namespaces grant-subscription-permission --role test-role public/test-ns-cmds test-sub
Grant the client role [test-role] to access the subscription test-sub of the namespace public/test-ns-cmds successfully

== subscription-permission after grant ==

+ ./bin/pulsarctl namespaces subscription-permission public/test-ns-cmds
{
  "test-sub": [
    "test-role"
  ]
}
== revoke-subscription-permission ==

+ ./bin/pulsarctl namespaces revoke-subscription-permission --role test-role public/test-ns-cmds test-sub
Revoke the client role test-role permissions of accessing the subscription test-sub of the namespace public/test-ns-cmds successfully

== subscription-permission after revoke ==

+ ./bin/pulsarctl namespaces subscription-permission public/test-ns-cmds
{}
== get-deduplication default/current ==

+ ./bin/pulsarctl namespaces get-deduplication public/test-ns-cmds
false
== set-deduplication enabled ==

+ ./bin/pulsarctl namespaces set-deduplication --enable public/test-ns-cmds
Set deduplication is [true] successfully for public/test-ns-cmds

+ ./bin/pulsarctl namespaces get-deduplication public/test-ns-cmds
true
== set-deduplication disabled ==

+ ./bin/pulsarctl namespaces set-deduplication public/test-ns-cmds
Set deduplication is [false] successfully for public/test-ns-cmds

+ ./bin/pulsarctl namespaces get-deduplication public/test-ns-cmds
false
== get-encryption-required default/current ==

+ ./bin/pulsarctl namespaces get-encryption-required public/test-ns-cmds
false
== enable encryption required ==

+ ./bin/pulsarctl namespaces messages-encryption public/test-ns-cmds
Enable messages encryption of the namespace public/test-ns-cmds

+ ./bin/pulsarctl namespaces get-encryption-required public/test-ns-cmds
true
== disable encryption required ==

+ ./bin/pulsarctl namespaces messages-encryption --disable public/test-ns-cmds
Disable messages encryption of the namespace public/test-ns-cmds

+ ./bin/pulsarctl namespaces get-encryption-required public/test-ns-cmds
false
== get-subscription-auth-mode default/current ==

+ ./bin/pulsarctl namespaces get-subscription-auth-mode public/test-ns-cmds
"None"
== set subscription auth mode Prefix ==

+ ./bin/pulsarctl namespaces set-subscription-auth-mode --mode Prefix public/test-ns-cmds
Successfully set the default subscription auth mode of namespace public/test-ns-cmds to Prefix

+ ./bin/pulsarctl namespaces get-subscription-auth-mode public/test-ns-cmds
"Prefix"
== set subscription auth mode None ==

+ ./bin/pulsarctl namespaces set-subscription-auth-mode --mode None public/test-ns-cmds
Successfully set the default subscription auth mode of namespace public/test-ns-cmds to None

+ ./bin/pulsarctl namespaces get-subscription-auth-mode public/test-ns-cmds
"None"
== negative checks (expected failures) ==

+ ./bin/pulsarctl namespaces bundles
[✖]  the namespace name is not specified or the namespace name is specified more than one
exit=1

+ ./bin/pulsarctl namespaces grant-subscription-permission --role test-role public/test-ns-cmds
[✖]  need to specified namespace name and subscription name
exit=1

+ ./bin/pulsarctl namespaces revoke-subscription-permission --role test-role public/test-ns-cmds
[✖]  need to specified namespace name and subscription name
exit=1

+ ./bin/pulsarctl namespaces set-subscription-auth-mode --mode Invalid public/test-ns-cmds
[✖]  Invalid subscription auth mode
exit=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-need-doc This pr does not need any document

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant