Search in sources :

Example 1 with TLSProtocolVersion

use of io.pravega.common.security.TLSProtocolVersion in project pravega by pravega.

the class InProcPravegaCluster method startLocalController.

private ControllerServiceMain startLocalController(int controllerId) {
    ZKClientConfig zkClientConfig = ZKClientConfigImpl.builder().connectionString(zkUrl).namespace("pravega/" + clusterName).initialSleepInterval(2000).maxRetries(1).sessionTimeoutMs(10 * 1000).secureConnectionToZooKeeper(this.secureZK).trustStorePath(jksTrustFile).trustStorePasswordPath(keyPasswordFile).build();
    StoreClientConfig storeClientConfig = StoreClientConfigImpl.withPravegaTablesClient(zkClientConfig);
    HostMonitorConfig hostMonitorConfig = HostMonitorConfigImpl.builder().hostMonitorEnabled(true).containerCount(containerCount).hostMonitorMinRebalanceInterval(1).build();
    TimeoutServiceConfig timeoutServiceConfig = TimeoutServiceConfig.builder().maxLeaseValue(Config.MAX_LEASE_VALUE).build();
    ControllerEventProcessorConfig eventProcessorConfig = ControllerEventProcessorConfigImpl.withDefaultBuilder().shutdownTimeout(Duration.ofMillis(100)).build();
    GRPCServerConfig grpcServerConfig = GRPCServerConfigImpl.builder().port(this.controllerPorts[controllerId]).publishedRPCHost("localhost").publishedRPCPort(this.controllerPorts[controllerId]).authorizationEnabled(this.enableAuth).tlsEnabled(this.enableTls).tlsProtocolVersion(this.tlsProtocolVersion).tlsTrustStore(this.certFile).tlsCertFile(this.certFile).tlsKeyFile(this.keyFile).userPasswordFile(this.passwdFile).tokenSigningKey("secret").accessTokenTTLInSeconds(600).replyWithStackTraceOnError(false).requestTracingEnabled(true).build();
    RESTServerConfig restServerConfig = null;
    if (this.enableRestServer) {
        restServerConfig = RESTServerConfigImpl.builder().host("0.0.0.0").port(this.restServerPort).tlsEnabled(this.enableTls).tlsProtocolVersion(this.tlsProtocolVersion).keyFilePath(this.jksKeyFile).keyFilePasswordPath(this.keyPasswordFile).build();
    }
    ControllerServiceConfig serviceConfig = ControllerServiceConfigImpl.builder().threadPoolSize(Runtime.getRuntime().availableProcessors()).storeClientConfig(storeClientConfig).hostMonitorConfig(hostMonitorConfig).controllerClusterListenerEnabled(false).timeoutServiceConfig(timeoutServiceConfig).eventProcessorConfig(Optional.of(eventProcessorConfig)).grpcServerConfig(Optional.of(grpcServerConfig)).restServerConfig(Optional.ofNullable(restServerConfig)).shutdownTimeout(Duration.ofMillis(100)).build();
    ControllerServiceMain controllerService = new ControllerServiceMain(serviceConfig);
    try {
        controllerService.startAsync().awaitRunning();
        return controllerService;
    } catch (Throwable ex) {
        Callbacks.invokeSafely(controllerService::close, ex2 -> log.error("Unable to clean up controller startup.", ex2));
        throw ex;
    }
}
Also used : ControllerEventProcessorConfig(io.pravega.controller.server.eventProcessor.ControllerEventProcessorConfig) Arrays(java.util.Arrays) ZooKeeperServiceRunner(io.pravega.segmentstore.storage.impl.bookkeeper.ZooKeeperServiceRunner) ZKClientConfigImpl(io.pravega.controller.store.client.impl.ZKClientConfigImpl) Cleanup(lombok.Cleanup) ServiceBuilderConfig(io.pravega.segmentstore.server.store.ServiceBuilderConfig) RESTServerConfigImpl(io.pravega.shared.rest.impl.RESTServerConfigImpl) ControllerServiceConfigImpl(io.pravega.controller.server.impl.ControllerServiceConfigImpl) StoreClientConfigImpl(io.pravega.controller.store.client.impl.StoreClientConfigImpl) HostMonitorConfig(io.pravega.controller.store.host.HostMonitorConfig) Duration(java.time.Duration) ToString(lombok.ToString) URI(java.net.URI) ServiceStarter(io.pravega.segmentstore.server.host.ServiceStarter) AutoScalerConfig(io.pravega.segmentstore.server.host.stat.AutoScalerConfig) Synchronized(lombok.Synchronized) DurableLogConfig(io.pravega.segmentstore.server.logs.DurableLogConfig) UUID(java.util.UUID) GuardedBy(javax.annotation.concurrent.GuardedBy) Collectors(java.util.stream.Collectors) Slf4j(lombok.extern.slf4j.Slf4j) CuratorFramework(org.apache.curator.framework.CuratorFramework) Builder(lombok.Builder) Config(io.pravega.controller.util.Config) RetryPolicy(org.apache.curator.RetryPolicy) StorageLayoutType(io.pravega.segmentstore.storage.StorageLayoutType) Optional(java.util.Optional) ZKClientConfig(io.pravega.controller.store.client.ZKClientConfig) GRPCServerConfig(io.pravega.controller.server.rpc.grpc.GRPCServerConfig) StoreClientConfig(io.pravega.controller.store.client.StoreClientConfig) CuratorFrameworkFactory(org.apache.curator.framework.CuratorFrameworkFactory) ControllerServiceConfig(io.pravega.controller.server.ControllerServiceConfig) ZKTLSUtils(io.pravega.common.security.ZKTLSUtils) ServiceConfig(io.pravega.segmentstore.server.store.ServiceConfig) GRPCServerConfigImpl(io.pravega.controller.server.rpc.grpc.impl.GRPCServerConfigImpl) TimeoutServiceConfig(io.pravega.controller.timeout.TimeoutServiceConfig) Strings(com.google.common.base.Strings) ControllerEventProcessorConfigImpl(io.pravega.controller.server.eventProcessor.impl.ControllerEventProcessorConfigImpl) ExponentialBackoffRetry(org.apache.curator.retry.ExponentialBackoffRetry) RESTServerConfig(io.pravega.shared.rest.RESTServerConfig) DefaultCredentials(io.pravega.shared.security.auth.DefaultCredentials) TLSProtocolVersion(io.pravega.common.security.TLSProtocolVersion) HostMonitorConfigImpl(io.pravega.controller.store.host.impl.HostMonitorConfigImpl) Callbacks(io.pravega.common.function.Callbacks) ControllerEventProcessorConfig(io.pravega.controller.server.eventProcessor.ControllerEventProcessorConfig) IOException(java.io.IOException) ControllerServiceMain(io.pravega.controller.server.ControllerServiceMain) MetricsConfig(io.pravega.shared.metrics.MetricsConfig) Credentials(io.pravega.shared.security.auth.Credentials) Preconditions(com.google.common.base.Preconditions) TimeoutServiceConfig(io.pravega.controller.timeout.TimeoutServiceConfig) ZKClientConfig(io.pravega.controller.store.client.ZKClientConfig) GRPCServerConfig(io.pravega.controller.server.rpc.grpc.GRPCServerConfig) StoreClientConfig(io.pravega.controller.store.client.StoreClientConfig) ControllerServiceConfig(io.pravega.controller.server.ControllerServiceConfig) HostMonitorConfig(io.pravega.controller.store.host.HostMonitorConfig) RESTServerConfig(io.pravega.shared.rest.RESTServerConfig) ControllerServiceMain(io.pravega.controller.server.ControllerServiceMain)

Aggregations

Preconditions (com.google.common.base.Preconditions)1 Strings (com.google.common.base.Strings)1 Callbacks (io.pravega.common.function.Callbacks)1 TLSProtocolVersion (io.pravega.common.security.TLSProtocolVersion)1 ZKTLSUtils (io.pravega.common.security.ZKTLSUtils)1 ControllerServiceConfig (io.pravega.controller.server.ControllerServiceConfig)1 ControllerServiceMain (io.pravega.controller.server.ControllerServiceMain)1 ControllerEventProcessorConfig (io.pravega.controller.server.eventProcessor.ControllerEventProcessorConfig)1 ControllerEventProcessorConfigImpl (io.pravega.controller.server.eventProcessor.impl.ControllerEventProcessorConfigImpl)1 ControllerServiceConfigImpl (io.pravega.controller.server.impl.ControllerServiceConfigImpl)1 GRPCServerConfig (io.pravega.controller.server.rpc.grpc.GRPCServerConfig)1 GRPCServerConfigImpl (io.pravega.controller.server.rpc.grpc.impl.GRPCServerConfigImpl)1 StoreClientConfig (io.pravega.controller.store.client.StoreClientConfig)1 ZKClientConfig (io.pravega.controller.store.client.ZKClientConfig)1 StoreClientConfigImpl (io.pravega.controller.store.client.impl.StoreClientConfigImpl)1 ZKClientConfigImpl (io.pravega.controller.store.client.impl.ZKClientConfigImpl)1 HostMonitorConfig (io.pravega.controller.store.host.HostMonitorConfig)1 HostMonitorConfigImpl (io.pravega.controller.store.host.impl.HostMonitorConfigImpl)1 TimeoutServiceConfig (io.pravega.controller.timeout.TimeoutServiceConfig)1 Config (io.pravega.controller.util.Config)1