Search in sources :

Example 6 with DefaultOpenShiftClient

use of io.fabric8.openshift.client.DefaultOpenShiftClient in project kie-wb-common by kiegroup.

the class OpenShiftAccessInterfaceImpl method newOpenShiftClient.

@Override
public OpenShiftClient newOpenShiftClient(final ProviderConfig providerConfig) {
    checkInstanceOf("providerConfig", providerConfig, OpenShiftProviderConfig.class);
    OpenShiftConfig clientConfig = buildOpenShiftConfig((OpenShiftProviderConfig) providerConfig);
    return new OpenShiftClient(new DefaultOpenShiftClient(clientConfig));
}
Also used : OpenShiftClient(org.guvnor.ala.openshift.access.OpenShiftClient) DefaultOpenShiftClient(io.fabric8.openshift.client.DefaultOpenShiftClient) OpenShiftConfig(io.fabric8.openshift.client.OpenShiftConfig) DefaultOpenShiftClient(io.fabric8.openshift.client.DefaultOpenShiftClient)

Example 7 with DefaultOpenShiftClient

use of io.fabric8.openshift.client.DefaultOpenShiftClient in project fabric8 by jboss-fuse.

the class KubernetesHelper method createJenkinshiftOpenShiftClient.

public static OpenShiftClient createJenkinshiftOpenShiftClient(String jenkinshiftUrl) {
    Config config = createJenkinshiftConfig(jenkinshiftUrl);
    // TODO until jenkinshift supports HTTPS lets disable HTTPS by default
    // openShiftClient = new DefaultOpenShiftClient(jenkinshiftUrl);
    JenkinShiftClient jenkinShiftClient = new JenkinShiftClient(config);
    jenkinShiftClient.updateHttpClient(config);
    return jenkinShiftClient;
}
Also used : DeploymentConfig(io.fabric8.openshift.api.model.DeploymentConfig) Config(io.fabric8.kubernetes.client.Config)

Example 8 with DefaultOpenShiftClient

use of io.fabric8.openshift.client.DefaultOpenShiftClient in project fabric8 by jboss-fuse.

the class TriggerBuild method main.

public static void main(String... args) {
    if (args.length < 1) {
        System.out.println("Usage: buildConfigName namespace secret type");
        return;
    }
    String name = args[0];
    String namespace = "default";
    if (args.length > 1) {
        namespace = args[1];
    }
    OpenShiftClient client = new DefaultOpenShiftClient();
    try {
        client.buildConfigs().inNamespace(namespace).withName(name).trigger(new WebHookTrigger(true, null));
    } catch (Exception e) {
        System.out.println("FAILED: " + e);
        e.printStackTrace();
    }
}
Also used : WebHookTrigger(io.fabric8.openshift.api.model.WebHookTrigger) DefaultOpenShiftClient(io.fabric8.openshift.client.DefaultOpenShiftClient) OpenShiftClient(io.fabric8.openshift.client.OpenShiftClient) DefaultOpenShiftClient(io.fabric8.openshift.client.DefaultOpenShiftClient)

Example 9 with DefaultOpenShiftClient

use of io.fabric8.openshift.client.DefaultOpenShiftClient in project fabric8 by jboss-fuse.

the class WatchBuildsExample method main.

public static void main(String... args) throws Exception {
    OpenShiftClient client = new DefaultOpenShiftClient();
    client.builds().watch(new Watcher<Build>() {

        @Override
        public void eventReceived(Action action, Build build) {
            System.out.println(action + ": " + build);
        }

        @Override
        public void onClose(KubernetesClientException e) {
            System.out.println("Closed: " + e);
        }
    });
    client.close();
}
Also used : Build(io.fabric8.openshift.api.model.Build) DefaultOpenShiftClient(io.fabric8.openshift.client.DefaultOpenShiftClient) OpenShiftClient(io.fabric8.openshift.client.OpenShiftClient) DefaultOpenShiftClient(io.fabric8.openshift.client.DefaultOpenShiftClient) KubernetesClientException(io.fabric8.kubernetes.client.KubernetesClientException)

Example 10 with DefaultOpenShiftClient

use of io.fabric8.openshift.client.DefaultOpenShiftClient in project carbon-apimgt by wso2.

the class KubernetesGatewayImpl method initImpl.

/**
 * @see ContainerBasedGatewayGenerator#initImpl(Map)
 */
@Override
void initImpl(Map<String, String> implParameters) throws ContainerBasedGatewayException {
    try {
        setValues(implParameters);
        setClient(new DefaultOpenShiftClient(buildConfig()));
    } catch (KubernetesClientException e) {
        String msg = "Error occurred while creating Default Openshift Client";
        throw new ContainerBasedGatewayException(msg, e, ExceptionCodes.ERROR_INITIALIZING_DEDICATED_CONTAINER_BASED_GATEWAY);
    }
}
Also used : ContainerBasedGatewayException(org.wso2.carbon.apimgt.core.exception.ContainerBasedGatewayException) DefaultOpenShiftClient(io.fabric8.openshift.client.DefaultOpenShiftClient) KubernetesClientException(io.fabric8.kubernetes.client.KubernetesClientException)

Aggregations

DefaultOpenShiftClient (io.fabric8.openshift.client.DefaultOpenShiftClient)12 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)6 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)4 BuildFinishedEvent (io.fabric8.kubernetes.api.builds.BuildFinishedEvent)2 BuildListener (io.fabric8.kubernetes.api.builds.BuildListener)2 BuildWatcher (io.fabric8.kubernetes.api.builds.BuildWatcher)2 Config (io.fabric8.kubernetes.client.Config)2 ConfigBuilder (io.fabric8.kubernetes.client.ConfigBuilder)2 Build (io.fabric8.openshift.api.model.Build)2 DeploymentConfig (io.fabric8.openshift.api.model.DeploymentConfig)2 WebHookTrigger (io.fabric8.openshift.api.model.WebHookTrigger)2 Deployment (io.fabric8.kubernetes.api.model.extensions.Deployment)1 DeploymentList (io.fabric8.kubernetes.api.model.extensions.DeploymentList)1 DoneableDeployment (io.fabric8.kubernetes.api.model.extensions.DoneableDeployment)1 ScalableResource (io.fabric8.kubernetes.client.dsl.ScalableResource)1 BuildService (io.fabric8.maven.core.service.BuildService)1 Fabric8ServiceException (io.fabric8.maven.core.service.Fabric8ServiceException)1 OpenShiftConfig (io.fabric8.openshift.client.OpenShiftConfig)1 OpenShiftMockServer (io.fabric8.openshift.client.server.mock.OpenShiftMockServer)1 IOException (java.io.IOException)1