Skip to content

PIP-266: Support batch deletion of tenants, namespaces, topics, and subscriptions using input files and regex in Pulsar CLI  #20225

@liangyepianzhou

Description

@liangyepianzhou

Background knowledge

In Pulsar, the current CLI commands for deleting tenants, namespaces, topics, and subscriptions require specifying each entity individually. This can be cumbersome and time-consuming, especially in testing or maintenance scenarios where multiple entities need to be deleted.

Motivation

The motivation behind this proposal is to improve the efficiency of the deletion process and make it more convenient to clean up environments in certain scenarios, such as testing and production environments where entities like subscriptions associated with deprecated services need to be cleaned up. This can be achieved by adding support for reading entity names from a file and using regular expressions for batch deletion.

Goals

In Scope

  1. Add support for reading entity names (tenants, namespaces, topics, and subscriptions) from a file.
  2. Add support for regular expressions in CLI commands for deleting entities.
  3. Delete entities from the local cluster where the command is run.
  4. Maintain backward compatibility.

Out of Scope

N/A

High Level Design

The solution involves extending the current Pulsar CLI commands to support batch deletion by reading entity names from a file and using regular expressions. This will allow users to delete multiple entities at once, making the process more efficient and convenient.

Detailed Design

Design & Implementation Details

  1. Extend the current CLI commands (pulsar-admin tenants delete, pulsar-admin namespaces delete, pulsar-admin topics delete, and pulsar-admin subscriptions delete) to include optional arguments --regex, and --from-file.

  2. If --from-file is specified, read the entity names from the provided file, with one entity name per line. If --regex is specified, filter the entity names based on the provided regular expression.

  3. Perform the deletion operation on the filtered list of entity names in the local cluster where the command is run.

Public-facing Changes

CLI

  1. Add optional arguments --regex, and --from-file to the following CLI commands:

    • pulsar-admin tenants delete
    • pulsar-admin namespaces delete
    • pulsar-admin topics delete
    • pulsar-admin subscriptions delete
  2. Update the documentation and help messages for these commands to include the new arguments and their usage.

Monitoring

No additional monitoring is required for this feature, as it only extends the CLI commands' functionality.

Security Considerations

There are no new security considerations introduced by this proposal, as the existing authentication and authorization mechanisms will still apply to the modified CLI commands.

Backward & Forward Compatibility

Revert

To revert back to a version without this feature, users can simply downgrade their Pulsar CLI version to a version that does not include the changes.

Upgrade

No special upgrade steps are required. Users can upgrade their Pulsar CLI version to a version that includes the changes without any issues.

Alternatives

N/A

General Notes

N/A

Links

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions