Search in sources :

Example 1 with PortMapping

use of org.eclipse.jkube.kit.build.api.model.PortMapping in project jkube by eclipse.

the class ContainerHandler method getContainerPorts.

private List<ContainerPort> getContainerPorts(ImageConfiguration imageConfig) {
    BuildConfiguration buildConfig = imageConfig.getBuildConfiguration();
    List<String> ports = buildConfig.getPorts();
    if (!ports.isEmpty()) {
        List<ContainerPort> ret = new ArrayList<>();
        PortMapping portMapping = new PortMapping(ports, configurationProperties);
        JsonArray portSpecs = portMapping.toJson();
        for (int i = 0; i < portSpecs.size(); i++) {
            JsonObject portSpec = portSpecs.get(i).getAsJsonObject();
            ret.add(extractContainerPort(portSpec));
        }
        return ret;
    } else {
        return null;
    }
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) JsonArray(com.google.gson.JsonArray) ContainerPort(io.fabric8.kubernetes.api.model.ContainerPort) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject) PortMapping(org.eclipse.jkube.kit.build.api.model.PortMapping)

Aggregations

JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 ContainerPort (io.fabric8.kubernetes.api.model.ContainerPort)1 ArrayList (java.util.ArrayList)1 PortMapping (org.eclipse.jkube.kit.build.api.model.PortMapping)1 BuildConfiguration (org.eclipse.jkube.kit.config.image.build.BuildConfiguration)1