Skip to content

Commit 2b8b6eb

Browse files
authored
Document ReclaimPolicy concept (#934)
Signed-off-by: Andreas Fritzler <andreas.fritzler@sap.com>
1 parent d4ad5dc commit 2b8b6eb

2 files changed

Lines changed: 54 additions & 13 deletions

File tree

docs/concepts/serverclaims.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,16 @@ spec:
5050
- This resource specifies how the server should be booted, including the image and ignition configuration.
5151

5252
- **State Transitions**:
53-
- Available → Reserved: When a server is successfully claimed.
54-
- Reserved → Cleanup: When the `ServerClaim` is deleted.
55-
- Cleanup → Available: After cleanup tasks are completed.
53+
- `Available` → `Reserved`: When a server is successfully claimed.
54+
- `Reserved` → `Available`: When the `ServerClaim` is deleted and the server's
55+
[`spec.reclaimPolicy`](servers.md#reclaim-policy) is `Recycle` (the default).
56+
- `Reserved` → `Released`: When the `ServerClaim` is deleted and the server's
57+
[`spec.reclaimPolicy`](servers.md#reclaim-policy) is `Retain`. The server stays in `Released`
58+
with `spec.serverClaimRef` set until an operator clears the reference, at which point it
59+
transitions back to `Available`.
5660

57-
- **Cleanup Process**:
58-
- Ensures that servers are sanitized before being made available again.
59-
- Tasks may include wiping disks, resetting BIOS settings, and clearing configurations.
61+
- **Release Process**:
62+
- On claim deletion the server is powered off and its `BootConfigurationRef` is cleared.
63+
- With `Recycle`, `spec.serverClaimRef` is also removed automatically and the server returns to `Available`.
64+
- With `Retain`, `spec.serverClaimRef` is preserved so the binding can be inspected before the
65+
server is released back into the pool.

docs/concepts/servers.md

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ metadata:
1515
spec:
1616
systemUUID: "123e4567-e89b-12d3-a456-426614174000"
1717
power: "Off"
18+
reclaimPolicy: Recycle
1819
bmcRef:
1920
name: my-bmc
2021
bootOrder:
@@ -56,10 +57,12 @@ A server undergoes the following phases:
5657
- The server transitions to the `Reserved` state.
5758
- The server is allocated for a specific use or user.
5859

59-
5. **Cleanup**:
60-
- When the [`ServerClaim`](serverclaims.md) is removed, the server enters the Cleanup state.
61-
- Sanitization processes are performed (e.g., wiping disks, resetting BIOS settings).
62-
60+
5. **Released**:
61+
- Only entered when `spec.reclaimPolicy` is `Retain` and the [`ServerClaim`](serverclaims.md) has been deleted.
62+
- The server is powered off and its `BootConfigurationRef` is cleared, but `spec.serverClaimRef` is kept.
63+
- The server stays in `Released` until an operator manually clears `spec.serverClaimRef`, at which point it transitions back to `Available`.
64+
- See [Reclaim Policy](#reclaim-policy) below.
65+
6366
6. **Maintenance**:
6467
- Servers in the `Available` state can transition to `Maintenance`.
6568
- Maintenance tasks such as BIOS updates or hardware repairs are performed.
@@ -78,19 +81,51 @@ stateDiagram-v2
7881
Available --> Reserved : ServerClaim created
7982
Reserved --> Maintenance : Maintenance initiated
8083
Maintenance --> Reserved : Maintenance complete
81-
Reserved --> Cleanup : ServerClaim removed
82-
Cleanup --> Available : Cleanup complete
84+
Reserved --> Available : ServerClaim removed (reclaimPolicy is Recycle)
85+
Reserved --> Released : ServerClaim removed (reclaimPolicy is Retain)
86+
Released --> Available : serverClaimRef cleared manually
8387
Available --> Maintenance : Maintenance initiated
8488
Maintenance --> Initial : Maintenance complete
8589
Available --> Error : Error detected
8690
Reserved --> Error : Error detected
8791
Discovery --> Error : Error detected
88-
Cleanup --> Error : Error detected
92+
Released --> Error : Error detected
8993
Maintenance --> Error : Error detected
9094
Error --> Maintenance : Enter maintenance to fix error
9195
Error --> Initial : Error resolved
9296
```
9397

98+
## Reclaim Policy
99+
100+
The `spec.reclaimPolicy` field controls what happens to a `Server` when its bound [`ServerClaim`](serverclaims.md) is deleted. Two values are supported, with `Recycle` as the default:
101+
102+
| Value | Behavior |
103+
|-----------|----------|
104+
| `Recycle` | When the claim is gone, the server is powered off, its `BootConfigurationRef` is cleared, `spec.serverClaimRef` is removed, and the server transitions directly back to `Available` so that it can be claimed again. |
105+
| `Retain` | When the claim is gone, the server is powered off and its `BootConfigurationRef` is cleared, but `spec.serverClaimRef` is **not** removed. The server transitions to the `Released` state and remains there until an operator manually clears `spec.serverClaimRef`. Once cleared, the server transitions back to `Available`. |
106+
107+
`Retain` is useful when human inspection is required between uses: for example, to forensically investigate a workload, audit disks, or run an out-of-band sanitization step before the server re-enters the pool. `Recycle` is the right choice for general-purpose pools where servers should be returned to `Available` automatically.
108+
109+
Example using `Retain`:
110+
111+
```yaml
112+
apiVersion: metal.ironcore.dev/v1alpha1
113+
kind: Server
114+
metadata:
115+
name: my-server
116+
spec:
117+
systemUUID: "123e4567-e89b-12d3-a456-426614174000"
118+
reclaimPolicy: Retain
119+
bmcRef:
120+
name: my-bmc
121+
```
122+
123+
To return a `Released` server to the pool, remove the stale claim reference:
124+
125+
```bash
126+
kubectl patch server my-server --type=merge -p '{"spec":{"serverClaimRef":null}}'
127+
```
128+
94129
## Interaction with BMC
95130

96131
Interaction with a server is done through its BMC:

0 commit comments

Comments
 (0)