Search in sources :

Example 1 with Container

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

the class BookkeeperService method createBookieApp.

private App createBookieApp() {
    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/bookkeeper:" + PRAVEGA_VERSION);
    Collection<Volume> volumeCollection = new ArrayList<>();
    volumeCollection.add(createVolume("/bk", "mnt", "RW"));
    // TODO: add persistent volume  (see issue https://github.com/pravega/pravega/issues/639)
    app.getContainer().setVolumes(volumeCollection);
    app.setPorts(Arrays.asList(BK_PORT));
    app.setRequirePorts(true);
    // set env
    String zk = zkUri.getHost() + ":" + ZKSERVICE_ZKPORT;
    Map<String, Object> map = new HashMap<>();
    map.put("ZK_URL", zk);
    map.put("ZK", zk);
    map.put("bookiePort", String.valueOf(BK_PORT));
    map.put("DLOG_EXTRA_OPTS", "-Xms512m");
    app.setEnv(map);
    // healthchecks
    List<HealthCheck> healthCheckList = new ArrayList<>();
    healthCheckList.add(setHealthCheck(300, "TCP", false, 60, 20, 0, BK_PORT));
    app.setHealthChecks(healthCheckList);
    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) Volume(mesosphere.marathon.client.model.v2.Volume) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HealthCheck(mesosphere.marathon.client.model.v2.HealthCheck)

Example 2 with Container

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

the class ZookeeperService method createZookeeperApp.

private App createZookeeperApp() {
    App app = new App();
    app.setId(this.id);
    app.setCpus(cpu);
    app.setMem(mem);
    app.setInstances(instances);
    app.setContainer(new Container());
    app.getContainer().setType(CONTAINER_TYPE);
    app.getContainer().setDocker(new Docker());
    app.getContainer().getDocker().setImage(ZK_IMAGE);
    List<HealthCheck> healthCheckList = new ArrayList<>();
    final HealthCheck hc = setHealthCheck(300, "TCP", false, 60, 20, 0, ZKSERVICE_ZKPORT);
    healthCheckList.add(hc);
    app.setHealthChecks(healthCheckList);
    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) HealthCheck(mesosphere.marathon.client.model.v2.HealthCheck) ArrayList(java.util.ArrayList)

Example 3 with Container

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

the class BasicTest method testInh2.

public void testInh2() {
    try {
        PersistenceManager pm = pmf.getPersistenceManager();
        Transaction tx = pm.currentTransaction();
        try {
            tx.begin();
            Base base1 = new Base(1, "b1");
            Base base2 = new Base(2, "b2");
            Base base3 = new Base(3, "b3");
            SubBase group1 = new SubBase(4, "b4", "SB1");
            SubBase group2 = new SubBase(5, "b5", "SB2");
            Container c = new Container(new Base[] { base1, base2, base3, group1, group2 });
            pm.makePersistent(c);
            tx.commit();
            tx.begin();
            Collection col = (Collection) pm.newQuery(SubBase.class).execute();
            assertTrue(col.size() == 2);
            assertTrue(col.contains(group1));
            assertTrue(col.contains(group2));
            tx.commit();
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
            pm.close();
        }
    } finally {
        clean(Container.class);
        clean(SubBase.class);
        clean(Base.class);
    }
}
Also used : SubBase(org.datanucleus.samples.metadata.inh2.SubBase) Container(org.datanucleus.samples.metadata.inh2.Container) Transaction(javax.jdo.Transaction) PersistenceManager(javax.jdo.PersistenceManager) Collection(java.util.Collection) Base(org.datanucleus.samples.metadata.inh2.Base) SubBase(org.datanucleus.samples.metadata.inh2.SubBase)

Example 4 with Container

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

the class PredictorBean method predictorStateFromPredictorSpec.

// TODO
public PredictorState predictorStateFromPredictorSpec(PredictorSpec predictorSpec) {
    // Boolean enabled = PredictorSpec.getEnabled();
    Boolean enabled = true;
    PredictiveUnit rootUnit = predictorSpec.getGraph();
    Map<String, Container> containersMap = new HashMap<String, Container>();
    for (Container container : predictorSpec.getComponentSpec().getSpec().getContainersList()) {
        containersMap.put(container.getName(), container);
    }
    PredictiveUnitState rootState = new PredictiveUnitState(rootUnit, containersMap);
    return new PredictorState(rootUnit.getName(), rootState, enabled);
}
Also used : Container(io.kubernetes.client.proto.V1.Container) HashMap(java.util.HashMap) PredictiveUnit(io.seldon.protos.DeploymentProtos.PredictiveUnit)

Example 5 with Container

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

the class SeldonDeploymentOperatorImpl method updatePredictiveUnitBuilderByName.

private void updatePredictiveUnitBuilderByName(PredictiveUnit.Builder puBuilder, V1.Container container) {
    if (puBuilder.getName().equals(container.getName())) {
        Endpoint.Builder b = puBuilder.getEndpointBuilder();
        for (ContainerPort p : container.getPortsList()) {
            if (// first found will be used
            "http".equals(p.getName())) {
                b.setServicePort(p.getContainerPort());
                b.setType(Endpoint.EndpointType.REST);
                // assumes localhost at present
                b.setServiceHost("0.0.0.0");
                return;
            } else if ("grpc".equals(p.getName())) {
                b.setServicePort(p.getContainerPort());
                b.setType(Endpoint.EndpointType.GRPC);
                // assumes localhost at present
                b.setServiceHost("0.0.0.0");
                return;
            }
        }
    } else {
        for (int i = 0; i < puBuilder.getChildrenCount(); i++) updatePredictiveUnitBuilderByName(puBuilder.getChildrenBuilder(i), container);
    }
}
Also used : Endpoint(io.seldon.protos.DeploymentProtos.Endpoint) ContainerPort(io.kubernetes.client.proto.V1.ContainerPort) Endpoint(io.seldon.protos.DeploymentProtos.Endpoint)

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