SealSkin

KubeClient

Minimal API client authenticated as the pod's service account.

Attributes

attributenamespace
= namespace

The namespace every object is created in.

attributetoken_path
= token_path
attributeverify
= verify
attributehttp
= httpx.AsyncClient(base_url=base_url, verify=verify, timeout=30.0, transport=transport)
attributemountslist[tuple[str, dict[str, Any], str]]
= []

The server container's mounts as (mount path, volume, subPath), longest path first.

attributelabelsdict[str, str]
= {}

The server pod's labels, which node-bound sessions follow.

attributeownerdict[str, Any] | None
= None

Owner reference given to session pods, or None.

attributeshared_claimsset[str]
= set()

Claims every node can mount (ReadWriteMany).

Functions

constructor__init__(base_url, namespace, verify=True, token_path=os.path.join(SERVICE_ACCOUNT_DIR, 'token'), transport=None) -> None

Create a client for base_url scoped to namespace.

parambase_urlstr
paramnamespacestr
paramverifyssl.SSLContext | bool
= True
paramtoken_pathstr
= os.path.join(SERVICE_ACCOUNT_DIR, 'token')
paramtransporthttpx.AsyncBaseTransport | None
= None

Returns

None
funcin_cluster() -> KubeClient

Build the client from the service account the kubelet mounts.

Returns

app.providers.kubernetes_provider.KubeClient
funcrequest(method, path, **kwargs) -> dict[str, Any]

Send one request and return the decoded body.

parammethodstr
parampathstr
paramkwargsAny
= {}

Returns

dict[str, typing.Any]
functext(method, path, **kwargs) -> str

Send one request and return the body as text, for a pod's log.

parammethodstr
parampathstr
paramkwargsAny
= {}

Returns

str
funcpath(resource, name='', group='') -> str

Return the URL path of a namespaced resource (collection when name is empty).

paramresourcestr
paramnamestr
= ''
paramgroupstr
= ''

Returns

str
funcexec(pod, container, command, timeout=30.0) -> str

Run a command in a container and return its output, over the API's WebSocket exec channel.

parampodstr
paramcontainerstr
paramcommandlist[str]
paramtimeoutfloat
= 30.0

Returns

str