Class KubernetesApiDiscovery
- All Implemented Interfaces:
DiscoveryStrategy
This implementation stays within the existing discovery surface: it talks directly to the Kubernetes API server, discovers peer pod addresses, and periodically refreshes the cached peer list. It does not assume any operator, Helm chart, or external control plane.
-
Constructor Summary
ConstructorsConstructorDescriptionKubernetesApiDiscovery(KubernetesApiDiscoveryConfig config, @Nullable io.micrometer.core.instrument.MeterRegistry meterRegistry) -
Method Summary
-
Constructor Details
-
KubernetesApiDiscovery
-
KubernetesApiDiscovery
public KubernetesApiDiscovery(KubernetesApiDiscoveryConfig config, @Nullable io.micrometer.core.instrument.MeterRegistry meterRegistry)
-
-
Method Details
-
discoverPeers
Description copied from interface:DiscoveryStrategyDiscover available peers.Returns a snapshot of currently known peers. If no peers are available, an empty list is returned (not null). The returned list is mutable and modifications should not affect internal strategy state.
- Specified by:
discoverPeersin interfaceDiscoveryStrategy- Returns:
- list of discovered peer addresses; empty list if none available
-
start
Description copied from interface:DiscoveryStrategyStart the discovery strategy.Initializes the discovery mechanism and starts any background threads or I/O operations (e.g., watching files, listening to multicast, resolving DNS). Implementations must handle errors gracefully and should not leave resources in an inconsistent state if startup fails.
- Specified by:
startin interfaceDiscoveryStrategy- Throws:
IOExceptionGeneralSecurityException
-
stop
public void stop()Description copied from interface:DiscoveryStrategyStop the discovery strategy and release resources.Cleanly shuts down the discovery mechanism, including stopping any background threads and closing I/O resources. Safe to call multiple times and must be idempotent (calling twice should have no additional effect).
- Specified by:
stopin interfaceDiscoveryStrategy
-
getName
Description copied from interface:DiscoveryStrategyGet the name of this discovery strategy.Used for logging, metrics, and debugging purposes.
- Specified by:
getNamein interfaceDiscoveryStrategy- Returns:
- human-readable strategy name (e.g., "FileBasedDiscovery", "MulticastDiscovery")
-