Search in sources :

Example 6 with CoreV1Api

use of io.kubernetes.client.apis.CoreV1Api in project incubator-heron by apache.

the class KubernetesCompat method killTopology.

boolean killTopology(String kubernetesUri, String topology, String namespace) {
    final CoreV1Api client = new CoreV1Api(new ApiClient().setBasePath(kubernetesUri));
    // old version deployed topologies as naked pods
    try {
        final String labelSelector = KubernetesConstants.LABEL_TOPOLOGY + "=" + topology;
        final Response response = client.deleteCollectionNamespacedPodCall(namespace, null, null, null, null, labelSelector, null, null, null, null, null, null).execute();
        if (!response.isSuccessful()) {
            LOG.log(Level.SEVERE, "Error killing topology message: " + response.message());
            KubernetesUtils.logResponseBodyIfPresent(LOG, response);
            throw new TopologyRuntimeManagementException(KubernetesUtils.errorMessageFromResponse(response));
        }
    } catch (IOException | ApiException e) {
        LOG.log(Level.SEVERE, "Error killing topology " + e.getMessage());
        if (e instanceof ApiException) {
            LOG.log(Level.SEVERE, "Error details:\n" + ((ApiException) e).getResponseBody());
        }
        return false;
    }
    return true;
}
Also used : Response(com.squareup.okhttp.Response) TopologyRuntimeManagementException(com.twitter.heron.scheduler.TopologyRuntimeManagementException) IOException(java.io.IOException) ApiClient(io.kubernetes.client.ApiClient) CoreV1Api(io.kubernetes.client.apis.CoreV1Api) ApiException(io.kubernetes.client.ApiException)

Example 7 with CoreV1Api

use of io.kubernetes.client.apis.CoreV1Api in project weblogic-kubernetes-operator by oracle.

the class CallBuilder method listPersistentVolume.

/* Persistent Volumes */
/**
 * List persistent volumes
 * @return List of persistent volumes
 * @throws ApiException API Exception
 */
public V1PersistentVolumeList listPersistentVolume() throws ApiException {
    String _continue = "";
    ApiClient client = helper.take();
    try {
        return new CoreV1Api(client).listPersistentVolume(pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
    } finally {
        helper.recycle(client);
    }
}
Also used : ApiClient(io.kubernetes.client.ApiClient) CoreV1Api(io.kubernetes.client.apis.CoreV1Api)

Example 8 with CoreV1Api

use of io.kubernetes.client.apis.CoreV1Api in project weblogic-kubernetes-operator by oracle.

the class CallBuilder method listPersistentVolumeClaim.

/* Persistent Volume Claims */
/**
 * List persistent volume claims
 * @param namespace Namespace
 * @return List of persistent volume claims
 * @throws ApiException API Exception
 */
public V1PersistentVolumeClaimList listPersistentVolumeClaim(String namespace) throws ApiException {
    String _continue = "";
    ApiClient client = helper.take();
    try {
        return new CoreV1Api(client).listNamespacedPersistentVolumeClaim(namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
    } finally {
        helper.recycle(client);
    }
}
Also used : ApiClient(io.kubernetes.client.ApiClient) CoreV1Api(io.kubernetes.client.apis.CoreV1Api)

Example 9 with CoreV1Api

use of io.kubernetes.client.apis.CoreV1Api in project weblogic-kubernetes-operator by oracle.

the class CallBuilder method listConfigMap.

/* Config Maps */
/**
 * List config maps
 * @param namespace Namespace
 * @return List of config maps
 * @throws ApiException API Exception
 */
public V1ConfigMapList listConfigMap(String namespace) throws ApiException {
    String _continue = "";
    ApiClient client = helper.take();
    try {
        return new CoreV1Api(client).listNamespacedConfigMap(namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
    } finally {
        helper.recycle(client);
    }
}
Also used : ApiClient(io.kubernetes.client.ApiClient) CoreV1Api(io.kubernetes.client.apis.CoreV1Api)

Example 10 with CoreV1Api

use of io.kubernetes.client.apis.CoreV1Api in project weblogic-kubernetes-operator by oracle.

the class CallBuilder method listService.

/* Services */
/**
 * List services
 * @param namespace Namespace
 * @return List of services
 * @throws ApiException API Exception
 */
public V1ServiceList listService(String namespace) throws ApiException {
    String _continue = "";
    ApiClient client = helper.take();
    try {
        return new CoreV1Api(client).listNamespacedService(namespace, pretty, _continue, fieldSelector, includeUninitialized, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
    } finally {
        helper.recycle(client);
    }
}
Also used : ApiClient(io.kubernetes.client.ApiClient) CoreV1Api(io.kubernetes.client.apis.CoreV1Api)

Aggregations

CoreV1Api (io.kubernetes.client.apis.CoreV1Api)11 ApiClient (io.kubernetes.client.ApiClient)9 IOException (java.io.IOException)3 Response (com.squareup.okhttp.Response)1 TopologyRuntimeManagementException (com.twitter.heron.scheduler.TopologyRuntimeManagementException)1 ApiException (io.kubernetes.client.ApiException)1 AppsV1beta2Api (io.kubernetes.client.apis.AppsV1beta2Api)1 V1APIResourceList (io.kubernetes.client.models.V1APIResourceList)1 Authenticator (oracle.kubernetes.operator.authentication.Authenticator)1 Test (org.junit.Test)1