liangyepianzhou opened a new issue, #20225: URL: https://github.com/apache/pulsar/issues/20225
# 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 `--input-file`, `--regex`, and `--from-file`. 2. If `--input-file` or `--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 `--input-file`, `--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 <!-- Updated afterwards --> * Mailing List discussion thread: https://lists.apache.org/thread/bcw7wdbll6d85z9sry4g1mskfnn0nwrx * Mailing List voting thread: -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org