Search in sources :

Example 1 with FitRegistry

use of com.netflix.titus.common.framework.fit.FitRegistry in project titus-control-plane by Netflix.

the class TitusRuntimeModule method getTitusRuntime.

@Provides
@Singleton
public TitusRuntime getTitusRuntime(Config config, SystemLogService systemLogService, SystemAbortListener systemAbortListener, Registry registry) {
    CodeInvariants codeInvariants = new CompositeCodeInvariants(LoggingCodeInvariants.getDefault(), new SpectatorCodeInvariants(registry.createId("titus.runtime.invariant.violations"), registry));
    DefaultTitusRuntime titusRuntime = new DefaultTitusRuntime(MyEnvironments.newArchaius(config), codeInvariants, systemLogService, systemExitOnFailure, systemAbortListener, registry);
    // Setup FIT component hierarchy
    FitFramework fitFramework = titusRuntime.getFitFramework();
    if (fitFramework.isActive()) {
        FitComponent root = fitFramework.getRootComponent();
        root.createChild(LeaderActivator.COMPONENT);
        root.createChild(V3JobOperations.COMPONENT);
        root.createChild(DirectKubeApiServerIntegrator.COMPONENT);
        // Add custom FIT actions
        FitRegistry fitRegistry = fitFramework.getFitRegistry();
        fitRegistry.registerActionKind(JobStoreFitAction.DESCRIPTOR, (id, properties) -> injection -> new JobStoreFitAction(id, properties, injection));
        fitRegistry.registerActionKind(KubeFitAction.DESCRIPTOR, (id, properties) -> injection -> new KubeFitAction(id, properties, injection));
    }
    return titusRuntime;
}
Also used : JobStoreFitAction(com.netflix.titus.api.jobmanager.store.JobStoreFitAction) FitComponent(com.netflix.titus.common.framework.fit.FitComponent) CodeInvariants(com.netflix.titus.common.util.code.CodeInvariants) SpectatorCodeInvariants(com.netflix.titus.common.util.code.SpectatorCodeInvariants) LoggingCodeInvariants(com.netflix.titus.common.util.code.LoggingCodeInvariants) CompositeCodeInvariants(com.netflix.titus.common.util.code.CompositeCodeInvariants) KubeFitAction(com.netflix.titus.master.kubernetes.client.KubeFitAction) SpectatorCodeInvariants(com.netflix.titus.common.util.code.SpectatorCodeInvariants) FitFramework(com.netflix.titus.common.framework.fit.FitFramework) CompositeCodeInvariants(com.netflix.titus.common.util.code.CompositeCodeInvariants) DefaultTitusRuntime(com.netflix.titus.common.runtime.internal.DefaultTitusRuntime) FitRegistry(com.netflix.titus.common.framework.fit.FitRegistry) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Provides (com.google.inject.Provides)1 JobStoreFitAction (com.netflix.titus.api.jobmanager.store.JobStoreFitAction)1 FitComponent (com.netflix.titus.common.framework.fit.FitComponent)1 FitFramework (com.netflix.titus.common.framework.fit.FitFramework)1 FitRegistry (com.netflix.titus.common.framework.fit.FitRegistry)1 DefaultTitusRuntime (com.netflix.titus.common.runtime.internal.DefaultTitusRuntime)1 CodeInvariants (com.netflix.titus.common.util.code.CodeInvariants)1 CompositeCodeInvariants (com.netflix.titus.common.util.code.CompositeCodeInvariants)1 LoggingCodeInvariants (com.netflix.titus.common.util.code.LoggingCodeInvariants)1 SpectatorCodeInvariants (com.netflix.titus.common.util.code.SpectatorCodeInvariants)1 KubeFitAction (com.netflix.titus.master.kubernetes.client.KubeFitAction)1 Singleton (javax.inject.Singleton)1