use of com.netflix.titus.common.framework.fit.FitComponent in project titus-control-plane by Netflix.
the class DefaultFitComponent method getChild.
@Override
public FitComponent getChild(String id) {
FitComponent child = children.get(id);
Preconditions.checkArgument(child != null, "FitComponent %s not found", id);
return child;
}
use of com.netflix.titus.common.framework.fit.FitComponent in project titus-control-plane by Netflix.
the class FitSpringResource method addAction.
@RequestMapping(method = RequestMethod.POST, path = "/actions", consumes = "application/json")
public Response addAction(@RequestBody Fit.AddAction request) {
FitComponent fitComponent = FitUtil.getFitComponentOrFail(fitFramework, request.getComponentId());
FitInjection fitInjection = FitUtil.getFitInjectionOrFail(request.getInjectionId(), fitComponent);
Function<FitInjection, FitAction> fitActionFactory = fitFramework.getFitRegistry().newFitActionFactory(request.getActionKind(), request.getActionId(), request.getPropertiesMap());
fitInjection.addAction(fitActionFactory.apply(fitInjection));
return Response.noContent().build();
}
use of com.netflix.titus.common.framework.fit.FitComponent in project titus-control-plane by Netflix.
the class FitResource method addAction.
@POST
@Path("/actions")
public Response addAction(Fit.AddAction request) {
FitComponent fitComponent = FitUtil.getFitComponentOrFail(fitFramework, request.getComponentId());
FitInjection fitInjection = FitUtil.getFitInjectionOrFail(request.getInjectionId(), fitComponent);
Function<FitInjection, FitAction> fitActionFactory = fitFramework.getFitRegistry().newFitActionFactory(request.getActionKind(), request.getActionId(), request.getPropertiesMap());
fitInjection.addAction(fitActionFactory.apply(fitInjection));
return Response.noContent().build();
}
use of com.netflix.titus.common.framework.fit.FitComponent 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;
}
use of com.netflix.titus.common.framework.fit.FitComponent in project titus-control-plane by Netflix.
the class RelocationTitusRuntimeComponent method getTitusRuntime.
@Bean
public TitusRuntime getTitusRuntime() {
FitFramework fitFramework = titusRuntime.getFitFramework();
if (fitFramework.isActive()) {
FitComponent root = fitFramework.getRootComponent();
root.createChild(GrpcFitInterceptor.COMPONENT);
}
return titusRuntime;
}
Aggregations