Search in sources :

Example 1 with MesosConfiguration

use of com.hubspot.singularity.config.MesosConfiguration in project Singularity by HubSpot.

the class SingularityAuthorizationHelperTest method buildAuthDisabledConfig.

public static SingularityConfiguration buildAuthDisabledConfig() {
    AuthConfiguration authConfiguration = new AuthConfiguration();
    authConfiguration.setEnabled(false);
    SingularityConfiguration configuration = new SingularityConfiguration();
    configuration.setAuthConfiguration(authConfiguration);
    configuration.setMesosConfiguration(new MesosConfiguration());
    return configuration;
}
Also used : MesosConfiguration(com.hubspot.singularity.config.MesosConfiguration) AuthConfiguration(com.hubspot.singularity.config.AuthConfiguration) SingularityConfiguration(com.hubspot.singularity.config.SingularityConfiguration)

Example 2 with MesosConfiguration

use of com.hubspot.singularity.config.MesosConfiguration in project Singularity by HubSpot.

the class SingularityMesosSchedulerImpl method start.

public void start() throws Exception {
    MesosConfiguration mesosConfiguration = configuration.getMesosConfiguration();
    // If more than one host is provided choose at random, we will be redirected if the host is not the master
    List<String> masters = Arrays.asList(mesosConfiguration.getMaster().split(","));
    String masterUrl;
    if (mesosConfiguration.getMesosUsername().isPresent() && mesosConfiguration.getMesosPassword().isPresent()) {
        masterUrl = String.format(SCHEDULER_API_URL_CREDENTIALS_FORMAT, mesosConfiguration.getMasterProtocol(), mesosConfiguration.getMesosUsername().get(), mesosConfiguration.getMesosPassword().get(), masters.get(new Random().nextInt(masters.size())));
    } else {
        masterUrl = String.format(SCHEDULER_API_URL_FORMAT, mesosConfiguration.getMasterProtocol(), masters.get(new Random().nextInt(masters.size())));
    }
    mesosSchedulerClient.subscribe(masterUrl, this);
}
Also used : MesosConfiguration(com.hubspot.singularity.config.MesosConfiguration) Random(java.util.Random)

Example 3 with MesosConfiguration

use of com.hubspot.singularity.config.MesosConfiguration in project Singularity by HubSpot.

the class SingularityAuthorizationHelperTest method buildAuthEnabledConfig.

public static SingularityConfiguration buildAuthEnabledConfig(Set<String> requiredGroups, Set<String> adminGroups, Set<String> jitaGroups) {
    AuthConfiguration authConfiguration = new AuthConfiguration();
    authConfiguration.setEnabled(true);
    authConfiguration.setRequiredGroups(requiredGroups);
    authConfiguration.setAdminGroups(adminGroups);
    authConfiguration.setJitaGroups(jitaGroups);
    SingularityConfiguration configuration = new SingularityConfiguration();
    configuration.setAuthConfiguration(authConfiguration);
    configuration.setMesosConfiguration(new MesosConfiguration());
    return configuration;
}
Also used : MesosConfiguration(com.hubspot.singularity.config.MesosConfiguration) AuthConfiguration(com.hubspot.singularity.config.AuthConfiguration) SingularityConfiguration(com.hubspot.singularity.config.SingularityConfiguration)

Example 4 with MesosConfiguration

use of com.hubspot.singularity.config.MesosConfiguration in project Singularity by HubSpot.

the class SingularityTestModule method getSingularityConfigurationForTestingServer.

private static SingularityConfiguration getSingularityConfigurationForTestingServer(final TestingServer ts) {
    SingularityConfiguration config = new SingularityConfiguration();
    config.setLoadBalancerUri("test");
    MesosConfiguration mc = new MesosConfiguration();
    mc.setDefaultCpus(1);
    mc.setDefaultMemory(128);
    mc.setDefaultDisk(1024);
    config.setMesosConfiguration(mc);
    config.setSmtpConfiguration(new SMTPConfiguration());
    ZooKeeperConfiguration zookeeperConfiguration = new ZooKeeperConfiguration();
    zookeeperConfiguration.setQuorum(ts.getConnectString());
    config.setZooKeeperConfiguration(zookeeperConfiguration);
    config.setConsiderTaskHealthyAfterRunningForSeconds(0);
    return config;
}
Also used : SMTPConfiguration(com.hubspot.singularity.config.SMTPConfiguration) MesosConfiguration(com.hubspot.singularity.config.MesosConfiguration) SingularityConfiguration(com.hubspot.singularity.config.SingularityConfiguration) ZooKeeperConfiguration(com.hubspot.singularity.config.ZooKeeperConfiguration)

Aggregations

MesosConfiguration (com.hubspot.singularity.config.MesosConfiguration)4 SingularityConfiguration (com.hubspot.singularity.config.SingularityConfiguration)3 AuthConfiguration (com.hubspot.singularity.config.AuthConfiguration)2 SMTPConfiguration (com.hubspot.singularity.config.SMTPConfiguration)1 ZooKeeperConfiguration (com.hubspot.singularity.config.ZooKeeperConfiguration)1 Random (java.util.Random)1