use of org.eclipse.jkube.watcher.api.WatcherContext in project jkube by eclipse.
the class WatchMojo method executeInternal.
@Override
public void executeInternal() throws MojoExecutionException {
URL masterUrl = kubernetesClient.getMasterUrl();
KubernetesResourceUtil.validateKubernetesMasterUrl(masterUrl);
try {
List<HasMetadata> appliedK8sResources = KubernetesHelper.loadResources(getManifest(kubernetesClient));
WatcherContext context = getWatcherContext();
WatcherManager.watch(getResolvedImages(), applicableNamespace(null, namespace, resources, clusterAccess), appliedK8sResources, context);
} catch (KubernetesClientException ex) {
KubernetesResourceUtil.handleKubernetesClientException(ex, this.log);
} catch (Exception ex) {
throw new MojoExecutionException("An error has occurred while while trying to watch the resources", ex);
}
}
use of org.eclipse.jkube.watcher.api.WatcherContext in project jkube by eclipse.
the class KubernetesWatchTask method run.
@Override
public void run() {
try (KubernetesClient kubernetesClient = jKubeServiceHub.getClient()) {
URL masterUrl = kubernetesClient.getMasterUrl();
KubernetesResourceUtil.validateKubernetesMasterUrl(masterUrl);
try {
List<HasMetadata> resources = KubernetesHelper.loadResources(getManifest(kubernetesClient));
WatcherContext context = createWatcherContext();
WatcherManager.watch(resolvedImages, applicableNamespace(null, kubernetesExtension.getNamespaceOrNull(), kubernetesExtension.resources, clusterAccess), resources, context);
} catch (KubernetesClientException kubernetesClientException) {
KubernetesResourceUtil.handleKubernetesClientException(kubernetesClientException, kitLogger);
} catch (Exception ioException) {
throw new IllegalStateException("An error has occurred while while trying to watch the resources", ioException);
}
}
}
Aggregations