Search in sources :

Example 1 with ListServiceForAllNamespaces

use of com.marcnuri.yakc.api.core.v1.CoreV1Api.ListServiceForAllNamespaces in project yakc by manusa.

the class ServiceService method watch.

@Override
public Observable<WatchEvent<Service>> watch() throws IOException {
    final CoreV1Api api = kubernetesClient.create(CoreV1Api.class);
    return tryWithFallback(() -> {
        api.listServiceForAllNamespaces(new ListServiceForAllNamespaces().limit(1)).get();
        return api.listServiceForAllNamespaces().watch();
    }, () -> {
        final String ns = kubernetesClient.getConfiguration().getNamespace();
        api.listNamespacedService(ns, new ListNamespacedService().limit(1)).get();
        return api.listNamespacedService(ns).watch();
    });
}
Also used : ListNamespacedService(com.marcnuri.yakc.api.core.v1.CoreV1Api.ListNamespacedService) ListServiceForAllNamespaces(com.marcnuri.yakc.api.core.v1.CoreV1Api.ListServiceForAllNamespaces) CoreV1Api(com.marcnuri.yakc.api.core.v1.CoreV1Api)

Aggregations

CoreV1Api (com.marcnuri.yakc.api.core.v1.CoreV1Api)1 ListNamespacedService (com.marcnuri.yakc.api.core.v1.CoreV1Api.ListNamespacedService)1 ListServiceForAllNamespaces (com.marcnuri.yakc.api.core.v1.CoreV1Api.ListServiceForAllNamespaces)1