This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new d8904321a3a [improve][pip] PIP-277: Add `current` option in the
Clusters list cmd (#20614)
d8904321a3a is described below
commit d8904321a3a661eda3382c35ff92d54e7cdde57d
Author: Jiwei Guo <[email protected]>
AuthorDate: Wed Sep 6 22:06:21 2023 -0500
[improve][pip] PIP-277: Add `current` option in the Clusters list cmd
(#20614)
---
pip/pip-277.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/pip/pip-277.md b/pip/pip-277.md
new file mode 100644
index 00000000000..295a8c87536
--- /dev/null
+++ b/pip/pip-277.md
@@ -0,0 +1,48 @@
+# Motivation
+
+After configuring the geo-replication on Pulsar clusters, the `clusters list`
API will return multiple clusters, including the local Pulsar cluster and
remote clusters like
+
+```
+bin/pulsar-admin clusters list
+us-west
+us-east
+us-cent
+```
+But in this return, you can't distinguish the local and the remote cluster.
When you need to remove the geo-replication configuration, it will be hard to
decide which cluster should be removed on replicated tenants and namespaces
unless you record the cluster information.
+
+# High Level Design
+
+Add `--current` option to the cluster list cmd and mark the current cluster
with `(*)`
+```
+bin/pulsar-admin clusters list --current
+us-west(*)
+us-east
+us-cent
+```
+
+# Detailed Design
+
+## Implementation Details
+
+Add `--current` option to the cluster list cmd
+```
+@Parameter(names = { "-c", "--current" }, description = "Print the current
cluster with (*)", required = false)
+private boolean current = false;
+```
+
+```
+void run() throws PulsarAdminException {
+ java.util.List<String> clusters = getAdmin().clusters().getClusters();
+ String clusterName =
getAdmin().brokers().getRuntimeConfigurations().get("clusterName");
+ List<String> result = clusters.stream().map(c ->c.equals(clusterName) ?
(current ? c + "(*)" : c) : c).collect(Collectors.toList());
+ print(result);
+}
+```
+
+# Links
+
+<!--
+Updated afterwards
+-->
+* Mailing List discussion thread:
https://lists.apache.org/thread/800r6ld5wg7bttbywmk38m1qx12hs6nl
+* Mailing List voting thread:
https://lists.apache.org/thread/rqn3rd3c4hj11o3b12ygopmztj2yy7pv