When using the Kubernetes client to watch resource related events, some boilerplate code is needed. Inspired by the reactive route support that exists for Vert.x, I think it would be very beneficial if watch events can be expressed using annotations.
Implementation ideas
As example, some annotations and classes can be introduced:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.Method)
public @interface LabelSelector {
String key()),
String operation() default "In"),
String[] values()
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.Method)
public @interface ResourceWatcher {
/*
* An optional namespace, if not set, watch all namespaces.
* Can be defined using a placeholder
*/
String namespace() default ALL_NAMESPACES,
/*
* An optional ID of an informer, if not defined, the watcher
* is a plain watcher.
* Can be defined using a placeholder
*/
String informer() default NO_INCORMER,
/*
* A list of selectors used to fine tune the resources that
* should be watched
*/
LabelSelector[] selectors() default {}
/*
* The acions for which this watcher should be notified.
* Default is all actions
*/
Action[] actions() default { Action.ADDED, Action.MODIFIED, Action.DELETED, Action.ERROR }
}
interface WatchEvent<T> {
T resource();
Action action();
Throwable error();
}
Description
When using the Kubernetes client to watch resource related events, some boilerplate code is needed. Inspired by the reactive route support that exists for Vert.x, I think it would be very beneficial if watch events can be expressed using annotations.
Implementation ideas
As example, some annotations and classes can be introduced:
Those annotations can be then leveraged as:
Behind the scenes, quarkus should:
https://github.com/quarkusio/quarkus/issues/18526
$upstream:18526$