# WorkstationPool and WorkstationPoolLease

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> A set of workstations that Ringleader builds from one template and lends out one at a time, each through a lease.


A **WorkstationPool** is a set of workstations that Ringleader builds from one template and
lends out one at a time, each through a **WorkstationPoolLease**. This page lists the fields
of both kinds.
[Pools and leases](https://docs-stg.ringleader.dev/workstations/lifecycle/pools-leases/) explains how a
pool works and how to use one.

## Spec fields

| Field | Type | Description |
|-------|------|-------------|
| `template.metadata.labels` | `map` | Labels every member carries, beside the pool's own `pools.ringleader.dev/pool` label. |
| `template.spec` | `object` | **Required.** Each member's spec, checked as a Workstation's would be. `stopped`, `lifecycle`, `ttl`, `ttlAction` and the nonce fields are refused. |
| `size.max` | `int` | **Required.** The most members at once, from 1 to 1000. |
| `warm.running`, `warm.stopped` | `int` | Idle members kept running and kept stopped. Default `0` each. Their sum may not exceed `size.max`. |
| `idle.stopAfter`, `idle.deleteAfter` | `string` | How long an idle member above the floors stays running, then how long it stays stopped. Default `15m` and `72h`. |
| `maxAge` | `string` | How long any member is kept. An idle member past it is deleted and never recycled. Default `168h`. |
| `lease.maxTerm` | `string` | How far ahead a lease's `expiresAt` may be set, and its default when left out. Default `24h`, at most 30 days. |
| `lease.failedRetention` | `string` | How long a `Failed` lease is kept. Default `24h`. |
| `lease.maxPending` | `int` | How many leases may wait at once, and how many `Failed` ones are kept. Default `100`, at most 1000. |
| `lease.configChanges` | `string` | `Apply` or `Hold`. Whether a configuration change reaches a leased member at once, or waits until its lease ends. Absent means `Apply`. |
| `recycle` | `object` | Present only when the pool recycles. `{maxReuses, timeout, reboot}`, default `20`, `10m` and `false`. |

## Status fields

The pool writes a constant-size summary. Members and leases are listed by name with
`rl workstationpool describe`, and each member's own Workstation carries its pool state as
annotations.

| Field | Type | Description |
|-------|------|-------------|
| `phase` | `string` | `Active`, `Degraded` when the template keeps failing or the owner may not create workstations, or `Terminating`. |
| `message` | `string` | The one-line headline. A `Terminating` pool says how many leases it waits for and when the last one expires. |
| `members` | `object` | Counts of `provisioning`, `idleRunning`, `idleStopped`, `leased`, `recycling`, `retiring` and `cordoned` members. |
| `warm` | `object` | `{running, stopped}`: the idle members built from the current template, and not cordoned, that fill the two floors. |
| `leases` | `object` | `{pending, oldestPendingSince}`. |
| `capacity` | `int` | How many leases the pool can serve at once. `size.max` less cordoned members while the pool can build, the members that can serve while it cannot, and `0` while it is being deleted. |
| `templateHash` | `string` | The hash of the current template. A member built from another hash is replaced once idle. |
| `configChanges` | `string` | The mode in force, `Apply` or `Hold`. |
| `observedGeneration` | `int` | The `metadata.generation` this status was computed for. |
| `conditions` | `[]object` | `TemplateHealthy`, `WithinQuota`, `WithinRunningCaps`, `WithinCloudCapacity` and `OwnerAuthorized`. |

`rl workstationpool get` prints the phase, the capacity, and the idle, leased and pending counts.
`rl workstationpool wait` without `--for` waits until every condition the pool reports is `True`
and both warm floors are filled.

## Lease spec fields

| Field | Type | Description |
|-------|------|-------------|
| `workstationPoolRef` | `object` | **Required.** `{name}`: the pool to lease from, in the lease's namespace. It never changes after the lease is created. |
| `state` | `string` | `Needed`, `Done` or `Recycle`. It moves forward only: from `Needed` to `Done` or `Recycle`, and from `Recycle` to `Done`. |
| `expiresAt` | `string` | When the lease ends if nobody releases it, as a timestamp. Default: one `lease.maxTerm` after the write. A time in the past, or more than one `lease.maxTerm` ahead, is rejected. |
| `authorizedKeys` | `[]string` | Public SSH keys that can log in as the member's login user while the lease holds it. |

## Lease phases

| Phase | Meaning |
|-------|---------|
| `Pending` | Waiting for a member. |
| `Bound` | A member is assigned and is starting, configuring, or taking on this lease's keys. |
| `Ready` | The member is usable. Its `Ready` condition is `True`, and `status.workstation` names it. |
| `Releasing` | The holder asked for `Done` or `Recycle`. Access is being removed and the member deleted or recycled. The lease is deleted when that finishes. |
| `Failed` | The lease ended without the holder asking. `status.release.reason` says why. |

## Lease status fields

| Field | Type | Description |
|-------|------|-------------|
| `phase` | `string` | `Pending`, `Bound`, `Ready`, `Releasing` or `Failed`. |
| `message` | `string` | Why a lease waits, or what ended it. |
| `workstation`, `workstationUID` | `string` | The bound member. |
| `boundAt`, `readyAt` | `string` | When the member was bound and became ready. |
| `expiresAt` | `string` | The expiry in force, the default included. It follows a renewal while the lease is `Pending`, `Bound` or `Ready`. |
| `failedAt` | `string` | When the lease reached `Failed`, which starts `lease.failedRetention`. |
| `release` | `object` | `{action, reason}`. `action` is `Deleted` when the member was deleted. `reason` is `Requested`, `Expired`, `WorkstationLost`, `PoolDeleted`, `RecycleFailed`, `RecycleTimedOut`, or one of the six reasons a `Recycle` request deletes the member instead, which [Member recycling](https://docs-stg.ringleader.dev/workstations/lifecycle/pools-leases/#member-recycling) lists. A successful recycle deletes the lease, so it leaves no reason; the pool's `Recycled` event records it. |
| `conditions` | `[]object` | `Ready`. |

`rl workstationpoollease get` prints each lease's holder, pool, phase, member and expiry, and
`--mine` narrows the list to your own. `rl workstationpoollease wait` without `--for` waits for
`Ready`, and a `Failed` lease ends the wait.

## Next steps
- [Pools and leases](https://docs-stg.ringleader.dev/workstations/lifecycle/pools-leases/): how a pool lends out, recycles and replaces its members.
- [Workstation access](https://docs-stg.ringleader.dev/reference/cli/commands/workstation-access/#rl-workstationpool): the `workstationpool`, `workstationpoollease` and `cordon` commands.
- [Shares and access](https://docs-stg.ringleader.dev/reference/cli/commands/shares-access/#rl-workstationpool-share-name): letting a teammate lease from your pool.
- [Grant](https://docs-stg.ringleader.dev/reference/resources/grant/): the `lease` right and who holds it.
- [Workstation](https://docs-stg.ringleader.dev/reference/resources/workstation/): the members, and the `recycleNonce` field a recycle uses.

