use of io.fabric8.kubernetes.client.Watch in project fabric8 by jboss-fuse.
the class KubernetesConfigAdminBridge method watchConfigMapList.
private void watchConfigMapList() {
if (configWatch) {
KubernetesClient client = kubernetesClient.get();
if (client != null) {
FilterWatchListDeletable<ConfigMap, ConfigMapList, Boolean, Watch, Watcher<ConfigMap>> configMapsSelector = client.configMaps().withLabel(pidLabel);
for (String key : filters.keySet()) {
configMapsSelector.withLabelIn(key, filters.get(key).toArray(new String[filters.get(key).size()]));
}
watch = configMapsSelector.watch(this);
} else {
throw new RuntimeException("KubernetesClient not set");
}
}
}
use of io.fabric8.kubernetes.client.Watch in project fabric8 by jboss-fuse.
the class WatchServicesExample method main.
public static void main(String... args) throws Exception {
KubernetesClient client = new DefaultKubernetesClient();
client.services().watch(new io.fabric8.kubernetes.client.Watcher<Service>() {
@Override
public void eventReceived(Action action, Service service) {
System.out.println(action + ": " + service);
}
@Override
public void onClose(KubernetesClientException e) {
System.out.println("Closed: " + e);
}
});
client.close();
}
Aggregations