Skip to content

Commit

Permalink
[WebSocket] Add configuration metadata store url setting in websocket (
Browse files Browse the repository at this point in the history
…apache#13786)

Master Issue: apache#13760 

### Motivation

As per apache#13077, `configurationStoreServers` need to be renamed to `configurationMetadataStoreUrl`.

### Modifications

* Add `configurationMetadataStoreUrl` setting to websocket
* Deprecate `configurationStoreServers` in websocket
  • Loading branch information
RobertIndie committed Jan 25, 2022
1 parent 8c8738f commit bd7e2a3
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 9 deletions.
5 changes: 4 additions & 1 deletion conf/websocket.conf
Expand Up @@ -20,7 +20,7 @@
### --- Web Socket proxy settings --- ###

# Configuration Store connection string
configurationStoreServers=
configurationMetadataStoreUrl=

# Zookeeper session timeout in milliseconds
zooKeeperSessionTimeoutMillis=30000
Expand Down Expand Up @@ -123,3 +123,6 @@ tlsCertRefreshCheckDurationSec=300

# Deprecated. Use configurationStoreServers
globalZookeeperServers=

# Deprecated. Use configurationMetadataStoreUrl
configurationStoreServers=
Expand Up @@ -70,7 +70,7 @@ public void setup() throws Exception {
config.setClusterName("test");
config.setAuthenticationEnabled(true);
// If this is not set, 500 error occurs.
config.setConfigurationStoreServers(GLOBAL_DUMMY_VALUE);
config.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
config.setSuperUserRoles(Sets.newHashSet("pulsar.super_user"));

if (methodName.equals("authenticatedSocketTest") || methodName.equals("statsTest")) {
Expand Down
Expand Up @@ -59,11 +59,10 @@ protected void setup() throws Exception {
WebSocketProxyConfiguration config = new WebSocketProxyConfiguration();
Set<String> superUser = Sets.newHashSet("");
config.setAuthorizationEnabled(true);
config.setConfigurationStoreServers("dummy-zk-servers");
config.setSuperUserRoles(superUser);
config.setClusterName("c1");
config.setWebServicePort(Optional.of(0));
config.setConfigurationStoreServers(GLOBAL_DUMMY_VALUE);
config.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
service = spyWithClassAndConstructorArgs(WebSocketService.class, config);
doReturn(new ZKMetadataStore(mockZooKeeperGlobal)).when(service).createMetadataStore(anyString(), anyInt());
service.start();
Expand Down
Expand Up @@ -46,7 +46,7 @@ public void setup() throws Exception {
config = new WebSocketProxyConfiguration();
config.setWebServicePort(Optional.of(0));
config.setClusterName("test");
config.setConfigurationStoreServers(GLOBAL_DUMMY_VALUE);
config.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
}

@AfterMethod(alwaysRun = true)
Expand Down
Expand Up @@ -99,7 +99,7 @@ public void setup() throws Exception {
WebSocketProxyConfiguration config = new WebSocketProxyConfiguration();
config.setWebServicePort(Optional.of(0));
config.setClusterName("test");
config.setConfigurationStoreServers(GLOBAL_DUMMY_VALUE);
config.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
service = spyWithClassAndConstructorArgs(WebSocketService.class, config);
doReturn(new ZKMetadataStore(mockZooKeeperGlobal)).when(service).createMetadataStore(anyString(), anyInt());
proxyServer = new ProxyServer(config);
Expand Down
Expand Up @@ -70,10 +70,9 @@ public void setup() throws Exception {
config.setTlsTrustCertsFilePath(TLS_TRUST_CERT_FILE_PATH);
config.setBrokerClientTrustCertsFilePath(TLS_TRUST_CERT_FILE_PATH);
config.setClusterName("use");
config.setConfigurationStoreServers("dummy-zk-servers");
config.setBrokerClientAuthenticationParameters("tlsCertFile:" + TLS_CLIENT_CERT_FILE_PATH + ",tlsKeyFile:" + TLS_CLIENT_KEY_FILE_PATH);
config.setBrokerClientAuthenticationPlugin(AuthenticationTls.class.getName());
config.setConfigurationStoreServers(GLOBAL_DUMMY_VALUE);
config.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
service = spyWithClassAndConstructorArgs(WebSocketService.class, config);
doReturn(new ZKMetadataStore(mockZooKeeperGlobal)).when(service).createMetadataStore(anyString(), anyInt());
proxyServer = new ProxyServer(config);
Expand Down
Expand Up @@ -72,7 +72,7 @@ public void setup() throws Exception {
config.setClusterName("use");
config.setAuthenticationEnabled(true);
// If this is not set, 500 error occurs.
config.setConfigurationStoreServers(GLOBAL_DUMMY_VALUE);
config.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
config.setSuperUserRoles(Sets.newHashSet("pulsar.super_user"));

if (methodName.equals("authenticatedSocketTest") || methodName.equals("statsTest")) {
Expand Down
Expand Up @@ -65,9 +65,13 @@ public class WebSocketProxyConfiguration implements PulsarConfiguration {
)
private String globalZookeeperServers;

@Deprecated
@FieldContext(doc = "Connection string of configuration store servers")
private String configurationStoreServers;

@FieldContext(doc = "Connection string of configuration metadata store servers")
private String configurationMetadataStoreUrl;

@FieldContext(doc = "ZooKeeper session timeout in milliseconds")
private long zooKeeperSessionTimeoutMillis = 30000;

Expand Down

0 comments on commit bd7e2a3

Please sign in to comment.