Skip to content

K8sHttpClient.ts

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



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
>

Source

Since v4.0.0

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
>

Source

Since v4.0.0

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>

Source

Since v4.0.0

Schema for Kubernetes Pod values used by cluster helpers.

Details

The model exposes readiness helpers derived from the pod status conditions.

Signature

declare class Pod

Source

Since v4.0.0

Schema for the subset of Kubernetes Pod status used by cluster helpers.

Signature

declare class PodStatus

Source

Since v4.0.0

Service tag for the HTTP client used to call the Kubernetes API.

Signature

declare class K8sHttpClient

Source

Since v4.0.0