Search in sources :

Example 1 with ContainerPort

use of io.kubernetes.client.proto.V1.ContainerPort 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

ContainerPort (io.kubernetes.client.proto.V1.ContainerPort)1 Endpoint (io.seldon.protos.DeploymentProtos.Endpoint)1