use of com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyEnablementService in project cloudbreak by hortonworks.
the class ClusterCreationActions method clusterProxyRegistrationAction.
@Bean(name = "CLUSTER_PROXY_REGISTRATION_STATE")
public Action<?, ?> clusterProxyRegistrationAction() {
return new AbstractStackCreationAction<>(ProvisionEvent.class) {
@Inject
private ClusterProxyEnablementService clusterProxyEnablementService;
@Override
protected void prepareExecution(ProvisionEvent payload, Map<Object, Object> variables) {
super.prepareExecution(payload, variables);
variables.put(PROVISION_TYPE, payload.getProvisionType());
}
@Override
protected void doExecute(StackCreationContext context, ProvisionEvent payload, Map<Object, Object> variables) {
if (clusterProxyEnablementService.isClusterProxyApplicable(context.getStack().cloudPlatform())) {
clusterCreationService.registeringToClusterProxy(context.getStack());
sendEvent(context);
} else {
ClusterProxyRegistrationSuccess clusterProxyRegistrationSuccess = new ClusterProxyRegistrationSuccess(payload.getResourceId());
sendEvent(context, clusterProxyRegistrationSuccess);
}
}
@Override
protected Selectable createRequest(StackCreationContext context) {
return new ClusterProxyRegistrationRequest(context.getStack().getId(), context.getStack().cloudPlatform());
}
};
}
use of com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyEnablementService in project cloudbreak by hortonworks.
the class StackUpscaleActions method reRegisterWithClusterProxy.
@Bean(name = "RE_REGISTER_WITH_CLUSTER_PROXY_STATE")
public Action<?, ?> reRegisterWithClusterProxy() {
return new AbstractStackUpscaleAction<>(StackEvent.class) {
@Inject
private ClusterProxyEnablementService clusterProxyEnablementService;
@Override
protected void doExecute(StackScalingFlowContext context, StackEvent payload, Map<Object, Object> variables) {
if (clusterProxyEnablementService.isClusterProxyApplicable(context.getStack().cloudPlatform())) {
stackUpscaleService.reRegisterWithClusterProxy(context.getStack().getId());
sendEvent(context);
} else {
LOGGER.info("Cluster Proxy integration is DISABLED, skipping re-registering with Cluster Proxy service");
StackEvent bootstrapNewNodesEvent = new StackEvent(StackUpscaleEvent.CLUSTER_PROXY_RE_REGISTRATION_FINISHED_EVENT.event(), payload.getResourceId());
sendEvent(context, bootstrapNewNodesEvent);
}
}
@Override
protected Selectable createRequest(StackScalingFlowContext context) {
return new ClusterProxyReRegistrationRequest(context.getStack().getId(), context.getStack().getCloudPlatform(), StackUpscaleEvent.CLUSTER_PROXY_RE_REGISTRATION_FINISHED_EVENT.event());
}
};
}
Aggregations