Search in sources :

Example 11 with ConfigBuilder

use of io.fabric8.docker.client.ConfigBuilder in project ballerina by ballerina-lang.

the class DefaultBallerinaDockerClient method getDockerClient.

/**
 * Creates a {@link DockerClient} from the given Docker host URL.
 *
 * @param env The URL of the Docker host. If this is null, a {@link DockerClient} pointed to the local Docker
 *            daemon will be created.
 * @return {@link DockerClient} object.
 */
private DockerClient getDockerClient(String env) {
    DockerClient client;
    if (env == null) {
        env = LOCAL_DOCKER_DAEMON_SOCKET;
    }
    Config dockerClientConfig = new ConfigBuilder().withDockerUrl(env).build();
    client = new io.fabric8.docker.client.DefaultDockerClient(dockerClientConfig);
    return client;
}
Also used : DockerClient(io.fabric8.docker.client.DockerClient) BallerinaDockerClient(org.ballerinalang.containers.docker.BallerinaDockerClient) Config(io.fabric8.docker.client.Config) ConfigBuilder(io.fabric8.docker.client.ConfigBuilder)

Example 12 with ConfigBuilder

use of io.fabric8.docker.client.ConfigBuilder in project shinyproxy by openanalytics.

the class KubernetesBackend method initialize.

@Override
public void initialize() throws ShinyProxyException {
    super.initialize();
    ConfigBuilder configBuilder = new ConfigBuilder();
    String masterUrl = getProperty(PROPERTY_URL);
    if (masterUrl != null)
        configBuilder.withMasterUrl(masterUrl);
    String certPath = getProperty(PROPERTY_CERT_PATH);
    if (certPath != null && Files.isDirectory(Paths.get(certPath))) {
        Path certFilePath = Paths.get(certPath, "ca.pem");
        if (Files.exists(certFilePath))
            configBuilder.withCaCertFile(certFilePath.toString());
        certFilePath = Paths.get(certPath, "cert.pem");
        if (Files.exists(certFilePath))
            configBuilder.withClientCertFile(certFilePath.toString());
        certFilePath = Paths.get(certPath, "key.pem");
        if (Files.exists(certFilePath))
            configBuilder.withClientKeyFile(certFilePath.toString());
    }
    kubeClient = new DefaultKubernetesClient(configBuilder.build());
}
Also used : Path(java.nio.file.Path) ConfigBuilder(io.fabric8.kubernetes.client.ConfigBuilder) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient)

Aggregations

ConfigBuilder (io.fabric8.kubernetes.client.ConfigBuilder)9 DefaultKubernetesClient (io.fabric8.kubernetes.client.DefaultKubernetesClient)5 Config (io.fabric8.docker.client.Config)3 ConfigBuilder (io.fabric8.docker.client.ConfigBuilder)3 DockerClient (io.fabric8.docker.client.DockerClient)3 Config (io.fabric8.kubernetes.client.Config)3 AuthConfig (io.fabric8.docker.api.model.AuthConfig)2 AuthConfigBuilder (io.fabric8.docker.api.model.AuthConfigBuilder)2 DefaultDockerClient (io.fabric8.docker.client.DefaultDockerClient)2 EventListener (io.fabric8.docker.dsl.EventListener)2 OutputHandle (io.fabric8.docker.dsl.OutputHandle)2 ProjectConfig (io.fabric8.devops.ProjectConfig)1 Pod (io.fabric8.kubernetes.api.model.Pod)1 ReplicationController (io.fabric8.kubernetes.api.model.ReplicationController)1 AutoAdaptableKubernetesClient (io.fabric8.kubernetes.client.AutoAdaptableKubernetesClient)1 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)1 BuildConfig (io.fabric8.openshift.api.model.BuildConfig)1 DefaultOpenShiftClient (io.fabric8.openshift.client.DefaultOpenShiftClient)1 Path (java.nio.file.Path)1 KubernetesConfiguration (org.apache.camel.component.kubernetes.KubernetesConfiguration)1