Demogorgon314 commented on code in PR #19102:
URL: https://github.com/apache/pulsar/pull/19102#discussion_r1059245743
##########
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:
This is how to create the namespace.
--
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]