Skip to content

Commit 9d65167

Browse files
committed
improve: deprecated isWatching method for informers health indicator (#3326)
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 600988a commit 9d65167

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

docs/content/en/docs/documentation/operations/health-probes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ API.
1717
| `isStarted()` | `true` once the operator and all its controllers have fully started |
1818
| `allEventSourcesAreHealthy()` | `true` when every registered event source (informers, polling sources, etc.) reports a healthy status |
1919
| `unhealthyEventSources()` | returns a map of controller name → unhealthy event sources, useful for diagnostics |
20-
| `unhealthyInformerWrappingEventSourceHealthIndicator()` | returns a map of controller name → unhealthy informer-wrapping event sources, each exposing per-informer details via `InformerHealthIndicator` (`hasSynced()`, `isWatching()`, `isRunning()`, `getTargetNamespace()`) |
20+
| `unhealthyInformerWrappingEventSourceHealthIndicator()` | returns a map of controller name → unhealthy informer-wrapping event sources, each exposing per-informer details via `InformerHealthIndicator` (`hasSynced()`, `isRunning()`, `getTargetNamespace()`) |
2121

2222
In most cases a single readiness probe backed by `allEventSourcesAreHealthy()` is sufficient: before the
2323
operator has fully started the informers will not have synced yet, so the check naturally covers the startup
@@ -27,7 +27,7 @@ case as well. Once running, it detects runtime degradation such as a lost watch
2727

2828
For advanced use cases — such as exposing per-informer health in a diagnostic endpoint or logging which
2929
specific namespace lost its watch — `unhealthyInformerWrappingEventSourceHealthIndicator()` gives access to
30-
individual `InformerHealthIndicator` instances. Each indicator exposes `hasSynced()`, `isWatching()`,
30+
individual `InformerHealthIndicator` instances. Each indicator exposes `hasSynced()`,
3131
`isRunning()`, and `getTargetNamespace()`. This is typically not needed for a standard health probe but can
3232
be valuable for operational dashboards or troubleshooting.
3333

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/health/InformerHealthIndicator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ public interface InformerHealthIndicator extends EventSourceHealthIndicator {
1919

2020
boolean hasSynced();
2121

22+
/**
23+
* @deprecated this method is not suitable for health check, it is expected that the watches
24+
* sometimes fail.
25+
* @return if the watch is established at the moment.
26+
*/
27+
@Deprecated(forRemoval = true)
2228
boolean isWatching();
2329

2430
boolean isRunning();

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerWrapper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ public boolean hasSynced() {
215215
}
216216

217217
@Override
218+
@Deprecated(forRemoval = true)
218219
public boolean isWatching() {
219220
return informer.isWatching();
220221
}

0 commit comments

Comments
 (0)