Class KubernetesCatalogueProvider

Namespace
Kuestenlogik.Bowire.Catalogue.Kubernetes
Assembly
Kuestenlogik.Bowire.Catalogue.Kubernetes.dll

Queries the Kubernetes API server for Service objects and materialises each into a BowireCatalogueEntry — Phase D of the catalogue-provider seam (#305 / #136).

public sealed class KubernetesCatalogueProvider : IBowireCatalogueProvider
Inheritance
KubernetesCatalogueProvider
Implements
Inherited Members

Remarks

Talks to the API server over plain HTTP (Kubernetes' v1 REST surface is stable across releases) instead of pulling the full KubernetesClient package (~4 MB). Bowire needs exactly one verb — GET /api/v1/namespaces/{namespace}/services — and the 25-line JSON shape below is the entirety of the contract we care about. Operators that need watch streams or richer object access can stand up an aggregator and point Bowire at it via the cheaper http provider.

Auth + URL discovery walks three sources in order:

  1. Explicit options block (tests, sidecars).
  2. In-cluster service-account files + KUBERNETES_SERVICE_HOST / _PORT env-vars (the default when running inside a pod).
  3. Mounted kubeconfig file (developer laptops; current context's cluster.server + user.token only).

Each Service materialises into one entry per declared port. The URL is built as {scheme}://{name}.{namespace}.svc.cluster.local:{port} — the canonical in-cluster DNS form. Service labels surface as catalogue tags (label-key:value) so the workbench's filter popup keys on them the same way the Consul provider's tags do.

Constructors

KubernetesCatalogueProvider()

Parameterless ctor for the assembly-scan discovery path. Uses the default options resolver (no explicit settings) and the real filesystem / env-var environment.

public KubernetesCatalogueProvider()

Properties

Id

Stable id used to select this provider in config (e.g. "local", "http", "consul", "kubernetes", "agent"). Compared case-insensitively against the configured provider key.

public string Id { get; }

Property Value

string

Name

Human-readable provider name for the Settings → Sources tab and startup logs (e.g. "Local file", "HTTP endpoint", "Consul").

public string Name { get; }

Property Value

string

Methods

FetchAsync(CancellationToken)

Fetch the current catalogue snapshot. Called on a configurable refresh interval (default 5 minutes; see RefreshInterval) and on a manual trigger from the workbench UI.

public Task<IReadOnlyList<BowireCatalogueEntry>> FetchAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token — refresh cycles are bounded by the configured interval, so providers should respect it to avoid piling up overlapping fetches when an upstream is slow.

Returns

Task<IReadOnlyList<BowireCatalogueEntry>>

The list of catalogue entries currently visible to this provider. Empty list is fine (means "no entries"); throw to signal a hard fetch failure — the registry catches and surfaces it as a problem-details response on GET /api/catalogue/entries.