Search in sources :

Example 1 with KnownServiceIdentifier

use of com.sequenceiq.cloudbreak.ccm.endpoint.KnownServiceIdentifier in project cloudbreak by hortonworks.

the class CcmUserDataService method getCcmConnectivityParameters.

private CcmConnectivityParameters getCcmConnectivityParameters(Stack stack, String keyId) {
    CcmConnectivityParameters ccmConnectivityParameters;
    String actorCrn = Objects.requireNonNull(crnService.getUserCrn(), "userCrn is null");
    int gatewayPort = Optional.ofNullable(stack.getGatewayport()).orElse(ServiceFamilies.GATEWAY.getDefaultPort());
    Map<KnownServiceIdentifier, Integer> tunneledServicePorts = Collections.singletonMap(KnownServiceIdentifier.GATEWAY, gatewayPort);
    CcmParameters ccmV1Parameters = ccmParameterSupplier.getCcmParameters(actorCrn, stack.getAccountId(), keyId, tunneledServicePorts).orElse(null);
    ccmConnectivityParameters = new CcmConnectivityParameters(ccmV1Parameters);
    saveCcmV1Config(stack.getId(), ccmV1Parameters);
    return ccmConnectivityParameters;
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) KnownServiceIdentifier(com.sequenceiq.cloudbreak.ccm.endpoint.KnownServiceIdentifier) CcmParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmParameters)

Example 2 with KnownServiceIdentifier

use of com.sequenceiq.cloudbreak.ccm.endpoint.KnownServiceIdentifier in project cloudbreak by hortonworks.

the class CcmUserDataService method getCcmConnectivityParameters.

private CcmConnectivityParameters getCcmConnectivityParameters(Stack stack) {
    CcmConnectivityParameters ccmConnectivityParameters;
    String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
    String actorCrn = Objects.requireNonNull(userCrn, "userCrn is null");
    ImmutableMap.Builder<KnownServiceIdentifier, Integer> builder = ImmutableMap.builder();
    int gatewayPort = Optional.ofNullable(stack.getGatewayPort()).orElse(ServiceFamilies.GATEWAY.getDefaultPort());
    builder.put(KnownServiceIdentifier.GATEWAY, gatewayPort);
    // Optionally configure a tunnel for (nginx fronting) Knox
    if (stack.getCluster().getGateway() != null) {
        // JSA TODO Do we support a non-default port for the nginx that fronts Knox?
        builder.put(KnownServiceIdentifier.KNOX, ServiceFamilies.KNOX.getDefaultPort());
    }
    Map<KnownServiceIdentifier, Integer> tunneledServicePorts = builder.build();
    CcmParameters ccmV1Parameters = ccmParameterSupplier.getCcmParameters(actorCrn, ThreadBasedUserCrnProvider.getAccountId(), CcmResourceUtil.getKeyId(stack.getResourceCrn()), tunneledServicePorts).orElse(null);
    ccmConnectivityParameters = new CcmConnectivityParameters(ccmV1Parameters);
    saveCcmV1Config(stack.getId(), ccmV1Parameters);
    return ccmConnectivityParameters;
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) KnownServiceIdentifier(com.sequenceiq.cloudbreak.ccm.endpoint.KnownServiceIdentifier) CcmParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmParameters) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

CcmConnectivityParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters)2 CcmParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmParameters)2 KnownServiceIdentifier (com.sequenceiq.cloudbreak.ccm.endpoint.KnownServiceIdentifier)2 ImmutableMap (com.google.common.collect.ImmutableMap)1