BewareMyPower commented on code in PR #19102:
URL: https://github.com/apache/pulsar/pull/19102#discussion_r1061363555
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:
##########
@@ -925,6 +939,36 @@ public void start() throws PulsarServerException {
}
}
+ protected void createNamespaceIfNotExists(String cluster, String
publicTenant, NamespaceName ns) throws Exception {
+ ClusterResources cr = this.getPulsarResources().getClusterResources();
+ TenantResources tr = this.getPulsarResources().getTenantResources();
+ NamespaceResources nsr =
this.getPulsarResources().getNamespaceResources();
+
+ if (!cr.clusterExists(cluster)) {
+ cr.createCluster(cluster,
+ ClusterData.builder()
+ .serviceUrl(this.getWebServiceAddress())
+ .serviceUrlTls(this.getWebServiceAddressTls())
+ .brokerServiceUrl(this.getBrokerServiceUrl())
+ .brokerServiceUrlTls(this.getBrokerServiceUrlTls())
+ .build());
+ }
+
+ if (!tr.tenantExists(publicTenant)) {
+ tr.createTenant(publicTenant,
+ TenantInfo.builder()
+
.adminRoles(Sets.newHashSet(config.getSuperUserRoles()))
+ .allowedClusters(Sets.newHashSet(cluster))
+ .build());
+ }
+
+ if (!nsr.namespaceExists(ns)) {
+ Policies nsp = new Policies();
Review Comment:
I agree with @heesung-sn that we should create the namespace in advance. We
create namespaces in standalone because the standalone mode is deployed simply.
But brokers can start concurrently, so we should create the namespace in
advance in
https://pulsar.apache.org/docs/2.10.x/deploy-bare-metal/#initialize-cluster-metadata
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]