K8sHttpClient.ts
K8sHttpClient.ts overview
Section titled “K8sHttpClient.ts overview”HTTP client support for talking to the Kubernetes API from code running
inside a cluster. The module builds a K8sHttpClient service on top of the
shared HTTP client, points requests at the in-cluster API endpoint, and uses
the mounted service-account token when one is available.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”constructors
Section titled “constructors”makeCreatePod
Section titled “makeCreatePod”Creates a scoped function that ensures a Kubernetes pod exists and waits until it is ready.
Details
The pod defaults to the default namespace and is deleted when the surrounding
scope closes.
Signature
declare const makeCreatePod: Effect.Effect< (spec: v1.Pod) => Effect.Effect<PodStatus, never, Scope>, never, K8sHttpClient>Since v4.0.0
makeGetPods
Section titled “makeGetPods”Creates a cached effect that fetches running Kubernetes pods.
Details
The request can be limited by namespace and label selector, and the result is a map keyed by pod IP address.
Signature
declare const makeGetPods: ( options?: { readonly namespace?: string | undefined; readonly labelSelector?: string | undefined } | undefined) => Effect.Effect< Effect.Effect<Map<string, Pod>, HttpClientError.HttpClientError | Schema.SchemaError, never>, never, K8sHttpClient>Since v4.0.0
layers
Section titled “layers”Layer that configures K8sHttpClient for the in-cluster Kubernetes API.
Details
It targets https://kubernetes.default.svc/api, adds the service-account
bearer token when available, requires successful HTTP statuses, and retries
transient failures.
Signature
declare const layer: Layer.Layer<K8sHttpClient, never, FileSystem.FileSystem | HttpClient.HttpClient>Since v4.0.0
schemas
Section titled “schemas”Pod (class)
Section titled “Pod (class)”Schema for Kubernetes Pod values used by cluster helpers.
Details
The model exposes readiness helpers derived from the pod status conditions.
Signature
declare class PodSince v4.0.0
PodStatus (class)
Section titled “PodStatus (class)”Schema for the subset of Kubernetes Pod status used by cluster helpers.
Signature
declare class PodStatusSince v4.0.0
services
Section titled “services”K8sHttpClient (class)
Section titled “K8sHttpClient (class)”Service tag for the HTTP client used to call the Kubernetes API.
Signature
declare class K8sHttpClientSince v4.0.0