Search in sources :

Example 6 with Container

use of io.kubernetes.client.proto.V1.Container in project seldon-core by SeldonIO.

the class SeldonDeploymentOperatorImpl method defaulting.

@Override
public SeldonDeployment defaulting(SeldonDeployment mlDep) {
    SeldonDeployment.Builder mlBuilder = SeldonDeployment.newBuilder(mlDep);
    int idx = 0;
    String serviceName = mlDep.getSpec().getName();
    String deploymentName = mlDep.getMetadata().getName();
    for (PredictorSpec p : mlDep.getSpec().getPredictorsList()) {
        ObjectMeta.Builder metaBuilder = ObjectMeta.newBuilder(p.getComponentSpec().getMetadata()).putLabels(LABEL_SELDON_APP, serviceName);
        mlBuilder.getSpecBuilder().getPredictorsBuilder(idx).getComponentSpecBuilder().setMetadata(metaBuilder);
        int cIdx = 0;
        mlBuilder.getSpecBuilder().getPredictorsBuilder(idx).getComponentSpecBuilder().getSpecBuilder().clearContainers();
        String predictorName = p.getName();
        for (V1.Container c : p.getComponentSpec().getSpec().getContainersList()) {
            V1.Container c2 = this.updateContainer(c, findPredictiveUnitForContainer(mlDep.getSpec().getPredictors(idx).getGraph(), c.getName()), cIdx, deploymentName, predictorName);
            mlBuilder.getSpecBuilder().getPredictorsBuilder(idx).getComponentSpecBuilder().getSpecBuilder().addContainers(cIdx, c2);
            updatePredictiveUnitBuilderByName(mlBuilder.getSpecBuilder().getPredictorsBuilder(idx).getGraphBuilder(), c2);
            cIdx++;
        }
        idx++;
    }
    return mlBuilder.build();
}
Also used : ObjectMeta(io.kubernetes.client.proto.Meta.ObjectMeta) IntOrString(io.kubernetes.client.proto.IntStr.IntOrString) V1(io.kubernetes.client.proto.V1) SeldonDeployment(io.seldon.protos.DeploymentProtos.SeldonDeployment) Endpoint(io.seldon.protos.DeploymentProtos.Endpoint) PredictorSpec(io.seldon.protos.DeploymentProtos.PredictorSpec)

Example 7 with Container

use of io.kubernetes.client.proto.V1.Container in project pravega by pravega.

the class PravegaControllerService method createPravegaControllerApp.

/**
 * To configure the controller app.
 *
 * @return App instance of marathon app
 */
private App createPravegaControllerApp() {
    App app = new App();
    app.setId(this.id);
    app.setCpus(cpu);
    app.setMem(mem);
    app.setInstances(instances);
    app.setConstraints(setConstraint("hostname", "UNIQUE"));
    app.setContainer(new Container());
    app.getContainer().setType(CONTAINER_TYPE);
    app.getContainer().setDocker(new Docker());
    app.getContainer().getDocker().setImage(IMAGE_PATH + "/nautilus/pravega:" + PRAVEGA_VERSION);
    String zk = zkUri.getHost() + ":" + ZKSERVICE_ZKPORT;
    // set port
    app.setPortDefinitions(Arrays.asList(createPortDefinition(CONTROLLER_PORT), createPortDefinition(REST_PORT)));
    app.setRequirePorts(true);
    List<HealthCheck> healthCheckList = new ArrayList<HealthCheck>();
    healthCheckList.add(setHealthCheck(300, "TCP", false, 60, 20, 0, CONTROLLER_PORT));
    app.setHealthChecks(healthCheckList);
    // set env
    String controllerSystemProperties = "-Xmx512m" + setSystemProperty("ZK_URL", zk) + setSystemProperty("CONTROLLER_RPC_PUBLISHED_HOST", this.id + ".marathon.mesos") + setSystemProperty("CONTROLLER_RPC_PUBLISHED_PORT", String.valueOf(CONTROLLER_PORT)) + setSystemProperty("CONTROLLER_SERVER_PORT", String.valueOf(CONTROLLER_PORT)) + setSystemProperty("REST_SERVER_PORT", String.valueOf(REST_PORT)) + setSystemProperty("log.level", "DEBUG") + setSystemProperty("log.dir", "$MESOS_SANDBOX/pravegaLogs") + setSystemProperty("curator-default-session-timeout", String.valueOf(10 * 1000)) + setSystemProperty("MAX_LEASE_VALUE", String.valueOf(60 * 1000)) + setSystemProperty("MAX_SCALE_GRACE_PERIOD", String.valueOf(60 * 1000)) + setSystemProperty("RETENTION_FREQUENCY_MINUTES", String.valueOf(2));
    Map<String, Object> map = new HashMap<>();
    map.put("PRAVEGA_CONTROLLER_OPTS", controllerSystemProperties);
    app.setEnv(map);
    app.setArgs(Arrays.asList("controller"));
    return app;
}
Also used : App(mesosphere.marathon.client.model.v2.App) Container(mesosphere.marathon.client.model.v2.Container) Docker(mesosphere.marathon.client.model.v2.Docker) HashMap(java.util.HashMap) HealthCheck(mesosphere.marathon.client.model.v2.HealthCheck) ArrayList(java.util.ArrayList)

Example 8 with Container

use of io.kubernetes.client.proto.V1.Container in project pravega by pravega.

the class PravegaSegmentStoreService method createPravegaSegmentStoreApp.

private App createPravegaSegmentStoreApp() {
    App app = new App();
    app.setId(this.id);
    app.setCpus(cpu);
    app.setMem(mem);
    app.setInstances(instances);
    // set constraints
    app.setConstraints(setConstraint("hostname", "UNIQUE"));
    // docker container
    app.setContainer(new Container());
    app.getContainer().setType(CONTAINER_TYPE);
    app.getContainer().setDocker(new Docker());
    // set the image and network
    app.getContainer().getDocker().setImage(IMAGE_PATH + "/nautilus/pravega:" + PRAVEGA_VERSION);
    // set port
    app.setPortDefinitions(Arrays.asList(createPortDefinition(SEGMENTSTORE_PORT)));
    app.setRequirePorts(true);
    // healthchecks
    List<HealthCheck> healthCheckList = new ArrayList<HealthCheck>();
    healthCheckList.add(setHealthCheck(300, "TCP", false, 60, 20, 0, SEGMENTSTORE_PORT));
    app.setHealthChecks(healthCheckList);
    // set env
    String zk = zkUri.getHost() + ":" + ZKSERVICE_ZKPORT;
    // Environment variables to configure SS service.
    Map<String, Object> map = new HashMap<>();
    map.put("ZK_URL", zk);
    map.put("BK_ZK_URL", zk);
    map.put("CONTROLLER_URL", conUri.toString());
    getCustomEnvVars(map, SEGMENTSTORE_EXTRA_ENV);
    // Properties set to override defaults for system tests
    String hostSystemProperties = "-Xmx1024m" + setSystemProperty("autoScale.muteInSeconds", "120") + setSystemProperty("autoScale.cooldownInSeconds", "120") + setSystemProperty("autoScale.cacheExpiryInSeconds", "120") + setSystemProperty("autoScale.cacheCleanUpInSeconds", "120") + setSystemProperty("log.level", "DEBUG") + setSystemProperty("log.dir", "$MESOS_SANDBOX/pravegaLogs") + setSystemProperty("curator-default-session-timeout", String.valueOf(30 * 1000)) + setSystemProperty("hdfs.replaceDataNodesOnFailure", "false");
    map.put("PRAVEGA_SEGMENTSTORE_OPTS", hostSystemProperties);
    app.setEnv(map);
    app.setArgs(Arrays.asList("segmentstore"));
    return app;
}
Also used : App(mesosphere.marathon.client.model.v2.App) Container(mesosphere.marathon.client.model.v2.Container) Docker(mesosphere.marathon.client.model.v2.Docker) HashMap(java.util.HashMap) HealthCheck(mesosphere.marathon.client.model.v2.HealthCheck) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 App (mesosphere.marathon.client.model.v2.App)4 Container (mesosphere.marathon.client.model.v2.Container)4 Docker (mesosphere.marathon.client.model.v2.Docker)4 HealthCheck (mesosphere.marathon.client.model.v2.HealthCheck)4 Endpoint (io.seldon.protos.DeploymentProtos.Endpoint)2 IntOrString (io.kubernetes.client.proto.IntStr.IntOrString)1 ObjectMeta (io.kubernetes.client.proto.Meta.ObjectMeta)1 V1 (io.kubernetes.client.proto.V1)1 Container (io.kubernetes.client.proto.V1.Container)1 ContainerPort (io.kubernetes.client.proto.V1.ContainerPort)1 PredictiveUnit (io.seldon.protos.DeploymentProtos.PredictiveUnit)1 PredictorSpec (io.seldon.protos.DeploymentProtos.PredictorSpec)1 SeldonDeployment (io.seldon.protos.DeploymentProtos.SeldonDeployment)1 Collection (java.util.Collection)1 PersistenceManager (javax.jdo.PersistenceManager)1 Transaction (javax.jdo.Transaction)1 Volume (mesosphere.marathon.client.model.v2.Volume)1 Base (org.datanucleus.samples.metadata.inh2.Base)1