Search in sources :

Example 56 with Path

use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.

the class MappingRuleResolver method findMappingRule.

public MappingResult findMappingRule(String requestURI) {
    String[] paths = Paths.splitPaths(requestURI);
    MappingResult answer = null;
    // TODO we could build a path based tree to do more efficient matching?
    for (HttpProxyRule mappingRule : mappingRules.getMappingRules().values()) {
        answer = mappingRule.matches(paths);
        if (answer != null) {
            break;
        }
    }
    return answer;
}
Also used : HttpProxyRule(io.fabric8.gateway.model.HttpProxyRule)

Example 57 with Path

use of io.fabric8.annotations.Path in project ballerina by ballerina-lang.

the class DefaultBallerinaDockerClient method buildImage.

/*
    Execute a Docker image build using Fabric8 DSL.
     */
private void buildImage(String dockerEnv, String imageName, Path tmpDir, String buildArgs) throws InterruptedException, IOException {
    DockerClient client = getDockerClient(dockerEnv);
    OutputHandle buildHandle = client.image().build().withRepositoryName(imageName).withNoCache().alwaysRemovingIntermediate().withBuildArgs(buildArgs).usingListener(new DockerBuilderEventListener()).fromFolder(tmpDir.toString());
    buildDone.await();
    buildHandle.close();
    client.close();
}
Also used : DockerClient(io.fabric8.docker.client.DockerClient) BallerinaDockerClient(org.ballerinalang.containers.docker.BallerinaDockerClient) OutputHandle(io.fabric8.docker.dsl.OutputHandle)

Example 58 with Path

use of io.fabric8.annotations.Path in project fabric8-maven-plugin by fabric8io.

the class WildFlySwarmHealthCheckEnricher method discoverWildFlySwarmHealthCheck.

private Probe discoverWildFlySwarmHealthCheck(int initialDelay) {
    if (hasDependency(this.getProject(), "org.wildfly.swarm", "monitor")) {
        Integer port = getPort();
        // scheme must be in upper case in k8s
        String scheme = getScheme().toUpperCase();
        String path = getPath();
        // lets default to adding a wildfly swarm health check
        return new ProbeBuilder().withNewHttpGet().withNewPort(port).withPath(path).withScheme(scheme).endHttpGet().withInitialDelaySeconds(initialDelay).build();
    }
    return null;
}
Also used : ProbeBuilder(io.fabric8.kubernetes.api.model.ProbeBuilder)

Example 59 with Path

use of io.fabric8.annotations.Path in project fabric8-maven-plugin by fabric8io.

the class ClientToolsService method getKubeCtlExecutable.

public File getKubeCtlExecutable() {
    OpenShiftClient openShiftClient = controller.getOpenShiftClientOrNull();
    String command = openShiftClient != null ? "oc" : "kubectl";
    String missingCommandMessage;
    File file = ProcessUtil.findExecutable(log, command);
    if (file == null && command.equals("oc")) {
        file = ProcessUtil.findExecutable(log, command);
        missingCommandMessage = "commands oc or kubectl";
    } else {
        missingCommandMessage = "command " + command;
    }
    if (file == null) {
        throw new IllegalStateException("Could not find " + missingCommandMessage + ". Please install the necessary binaries and ensure they get added to your $PATH");
    }
    return file;
}
Also used : OpenShiftClient(io.fabric8.openshift.client.OpenShiftClient) File(java.io.File)

Example 60 with Path

use of io.fabric8.annotations.Path in project fabric8-maven-plugin by fabric8io.

the class ContainerHandlerTest method getVolumeMountWithMultipleMountTest.

@Test
public void getVolumeMountWithMultipleMountTest() {
    ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
    images.clear();
    images.add(imageConfiguration1);
    List<String> mounts = new ArrayList<>();
    mounts.add("/path/etc");
    // volume config with name and multiple mount
    mounts.add("/path/system");
    mounts.add("/path/sys");
    VolumeConfig volumeConfig4 = new VolumeConfig.Builder().name("test").mounts(mounts).build();
    volumes1.clear();
    volumes1.add(volumeConfig4);
    ResourceConfig config4 = new ResourceConfig.Builder().volumes(volumes1).build();
    containers = handler.getContainers(config4, images);
    assertEquals(3, containers.get(0).getVolumeMounts().size());
    for (int i = 0; i <= 2; i++) assertEquals("test", containers.get(0).getVolumeMounts().get(i).getName());
}
Also used : ArrayList(java.util.ArrayList) ResourceConfig(io.fabric8.maven.core.config.ResourceConfig) VolumeConfig(io.fabric8.maven.core.config.VolumeConfig) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)45 File (java.io.File)41 IOException (java.io.IOException)34 ArrayList (java.util.ArrayList)18 PathTestUtil.createTmpFile (io.fabric8.maven.docker.util.PathTestUtil.createTmpFile)17 HashMap (java.util.HashMap)12 ResourceConfig (io.fabric8.maven.core.config.ResourceConfig)11 VolumeConfig (io.fabric8.maven.core.config.VolumeConfig)11 Path (java.nio.file.Path)11 FabricService (io.fabric8.api.FabricService)10 RuntimeProperties (io.fabric8.api.RuntimeProperties)9 Properties (java.util.Properties)9 BuildImageConfiguration (io.fabric8.maven.docker.config.BuildImageConfiguration)8 ImageConfiguration (io.fabric8.maven.docker.config.ImageConfiguration)8 InputStream (java.io.InputStream)8 Path (javax.ws.rs.Path)8 HttpProxyRule (io.fabric8.gateway.model.HttpProxyRule)7 NodeState (io.fabric8.groups.NodeState)7 URISyntaxException (java.net.URISyntaxException)7 List (java.util.List)6