class KubernetesProvider
implements DiscoveryProvider
Since 0.2.0

Reads EndpointSlices for a service.

Constructors

KubernetesProvider(
runtime: IRuntimeServices
)
Parameters

Namespace, API server, token, and port selection

The HTTP seam

runtime: IRuntimeServices

Supplies the monotonic clock, timers, and fs

Properties

readonly
kind: string

Backend id.

Methods

authHeader(): Promise<string>

Resolves the bearer token, reading the projected file when no explicit token was configured.

isHealthy(): Promise<boolean>

M70c: probes the API server with a limit=1 EndpointSlice LIST through the existing seam. This is the probe that makes X10-3 visible: an UnknownIssuer TLS rejection surfaces here as down. 2xx means the API is reachable.

listUrl(
serviceName: string,
extra?: Readonly<Record<string, string>>
): string

Builds the EndpointSlice list URL for a service.

mapSlices(
body: unknown,
serviceName: string
): readonly ServiceInstance[]

Maps an EndpointSlice list onto instances.

resolve(serviceName: string): Promise<readonly ServiceInstance[]>

Reads the current instance list for a service.

watch(
serviceName: string,
listener: (instances: readonly ServiceInstance[]) => void
): Promise<Unsubscribe>

Subscribes to instance-list changes.

Push-based where the backend supports it, interval-polled where it does not. The listener always receives the full list.

Usage

import { KubernetesProvider } from "service-discovery-plugin/src/index.ts";