Search in sources :

Example 1 with TcpPortBinding

use of com.sequenceiq.cloudbreak.orchestrator.model.port.TcpPortBinding in project cloudbreak by hortonworks.

the class ContainerConstraintFactory method getAmbariServerConstraint.

public ContainerConstraint getAmbariServerConstraint(String dbHostname, String gatewayHostname, String cloudPlatform, String clusterName, String identifier) {
    String env = String.format("/usr/sbin/init systemd.setenv=POSTGRES_DB=%s systemd.setenv=CLOUD_PLATFORM=%s", dbHostname, cloudPlatform);
    Builder builder = new Builder().withName(createContainerInstanceName(AMBARI_SERVER.getName(), clusterName, identifier)).instances(1).networkMode(HOST_NETWORK_MODE).tcpPortBinding(new TcpPortBinding(AMBARI_PORT, "0.0.0.0", AMBARI_PORT)).addVolumeBindings(ImmutableMap.of("/var/log/ambari-server-container", CONTAINER_VOLUME_PATH, "/etc/krb5.conf", "/etc/krb5.conf")).addEnv(ImmutableMap.of("SERVICE_NAME", "ambari-8080"));
    if (!StringUtils.isEmpty(gatewayHostname)) {
        builder.addHosts(ImmutableList.of(gatewayHostname));
    } else {
        env += " systemd.setenv=USE_CONSUL_DNS=false";
    }
    builder.cmd(new String[] { env });
    return builder.build();
}
Also used : TcpPortBinding(com.sequenceiq.cloudbreak.orchestrator.model.port.TcpPortBinding) Builder(com.sequenceiq.cloudbreak.orchestrator.model.ContainerConstraint.Builder)

Aggregations

Builder (com.sequenceiq.cloudbreak.orchestrator.model.ContainerConstraint.Builder)1 TcpPortBinding (com.sequenceiq.cloudbreak.orchestrator.model.port.TcpPortBinding)1