Search in sources :

Example 1 with SupervisorConfiguration

use of com.netflix.titus.master.supervisor.SupervisorConfiguration in project titus-control-plane by Netflix.

the class SupervisorServiceModule method getLocalMasterInstanceResolver.

/**
 * As MasterInstance data contain a lot of details that are deployment specific, this binding is provided here
 * for completeness/as an example only. It should be overridden by deployment specific configuration.
 */
@Provides
@Singleton
public LocalMasterInstanceResolver getLocalMasterInstanceResolver(SupervisorConfiguration configuration, GrpcMasterEndpointConfiguration grpcServerConfiguration, LocalMasterReadinessResolver localMasterReadinessResolver, TitusRuntime titusRuntime) {
    String ipAddress = NetworkExt.getLocalIPs().flatMap(ips -> ips.stream().filter(NetworkExt::isIpV4).findFirst()).orElse("127.0.0.1");
    ServerPort grpcPort = ServerPort.newBuilder().withPortNumber(grpcServerConfiguration.getPort()).withSecure(false).withProtocol("grpc").withDescription("TitusMaster GRPC endpoint").build();
    MasterInstance initial = MasterInstance.newBuilder().withInstanceId(configuration.getTitusMasterInstanceId()).withInstanceGroupId(configuration.getTitusMasterInstanceId() + "Group").withIpAddress(ipAddress).withStatusHistory(Collections.emptyList()).withStatus(MasterStatus.newBuilder().withState(MasterState.Starting).withMessage("Bootstrapping").withTimestamp(titusRuntime.getClock().wallTime()).build()).withServerPorts(Collections.singletonList(grpcPort)).build();
    return new DefaultLocalMasterInstanceResolver(localMasterReadinessResolver, initial);
}
Also used : SupervisorConfiguration(com.netflix.titus.master.supervisor.SupervisorConfiguration) LeaderActivator(com.netflix.titus.api.supervisor.service.LeaderActivator) AlwaysEnabledLocalMasterReadinessResolver(com.netflix.titus.api.supervisor.service.resolver.AlwaysEnabledLocalMasterReadinessResolver) LocalMasterMonitor(com.netflix.titus.master.supervisor.service.leader.LocalMasterMonitor) LocalMasterReadinessResolver(com.netflix.titus.api.supervisor.service.LocalMasterReadinessResolver) Singleton(javax.inject.Singleton) LocalMasterInstanceResolver(com.netflix.titus.api.supervisor.service.LocalMasterInstanceResolver) ConfigProxyFactory(com.netflix.archaius.ConfigProxyFactory) MasterState(com.netflix.titus.api.supervisor.model.MasterState) MasterStatus(com.netflix.titus.api.supervisor.model.MasterStatus) GuiceLeaderActivator(com.netflix.titus.master.supervisor.service.leader.GuiceLeaderActivator) ServerPort(com.netflix.titus.api.supervisor.model.ServerPort) SupervisorOperations(com.netflix.titus.api.supervisor.service.SupervisorOperations) DefaultLocalMasterInstanceResolver(com.netflix.titus.master.supervisor.service.resolver.DefaultLocalMasterInstanceResolver) MasterMonitor(com.netflix.titus.api.supervisor.service.MasterMonitor) ImmediateLeaderElector(com.netflix.titus.master.supervisor.service.leader.ImmediateLeaderElector) Provides(com.google.inject.Provides) TitusRuntime(com.netflix.titus.common.runtime.TitusRuntime) NetworkExt(com.netflix.titus.common.util.NetworkExt) LeaderElectionOrchestrator(com.netflix.titus.master.supervisor.service.leader.LeaderElectionOrchestrator) Collections(java.util.Collections) GrpcMasterEndpointConfiguration(com.netflix.titus.master.endpoint.grpc.GrpcMasterEndpointConfiguration) LeaderElector(com.netflix.titus.api.supervisor.service.LeaderElector) AbstractModule(com.google.inject.AbstractModule) MasterInstance(com.netflix.titus.api.supervisor.model.MasterInstance) DefaultLocalMasterInstanceResolver(com.netflix.titus.master.supervisor.service.resolver.DefaultLocalMasterInstanceResolver) MasterInstance(com.netflix.titus.api.supervisor.model.MasterInstance) ServerPort(com.netflix.titus.api.supervisor.model.ServerPort) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

AbstractModule (com.google.inject.AbstractModule)1 Provides (com.google.inject.Provides)1 ConfigProxyFactory (com.netflix.archaius.ConfigProxyFactory)1 MasterInstance (com.netflix.titus.api.supervisor.model.MasterInstance)1 MasterState (com.netflix.titus.api.supervisor.model.MasterState)1 MasterStatus (com.netflix.titus.api.supervisor.model.MasterStatus)1 ServerPort (com.netflix.titus.api.supervisor.model.ServerPort)1 LeaderActivator (com.netflix.titus.api.supervisor.service.LeaderActivator)1 LeaderElector (com.netflix.titus.api.supervisor.service.LeaderElector)1 LocalMasterInstanceResolver (com.netflix.titus.api.supervisor.service.LocalMasterInstanceResolver)1 LocalMasterReadinessResolver (com.netflix.titus.api.supervisor.service.LocalMasterReadinessResolver)1 MasterMonitor (com.netflix.titus.api.supervisor.service.MasterMonitor)1 SupervisorOperations (com.netflix.titus.api.supervisor.service.SupervisorOperations)1 AlwaysEnabledLocalMasterReadinessResolver (com.netflix.titus.api.supervisor.service.resolver.AlwaysEnabledLocalMasterReadinessResolver)1 TitusRuntime (com.netflix.titus.common.runtime.TitusRuntime)1 NetworkExt (com.netflix.titus.common.util.NetworkExt)1 GrpcMasterEndpointConfiguration (com.netflix.titus.master.endpoint.grpc.GrpcMasterEndpointConfiguration)1 SupervisorConfiguration (com.netflix.titus.master.supervisor.SupervisorConfiguration)1 GuiceLeaderActivator (com.netflix.titus.master.supervisor.service.leader.GuiceLeaderActivator)1 ImmediateLeaderElector (com.netflix.titus.master.supervisor.service.leader.ImmediateLeaderElector)1