Skip to content

Commit f428390

Browse files
committed
address review comments, generalize some parts
1 parent 42fdbad commit f428390

File tree

1 file changed

+48
-21
lines changed

1 file changed

+48
-21
lines changed

docs/development/dev_setup.md

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ graph TD
2121

2222
### Run the local test suite
2323

24-
The local test suite can be run via
24+
The local test suite can be run via
2525

2626
```shell
2727
make test
@@ -53,6 +53,7 @@ make tilt-up
5353
```
5454

5555
This `Makefile` directive will:
56+
5657
- create a local Kind cluster with local registry
5758
- install cert-manager
5859
- install [boot-operator](https://github.com/ironcore-dev/boot-operator) to reconcile the `ServerBootConfiguration` CRD
@@ -78,7 +79,9 @@ By default, Tilt runs against a local Redfish mock server. To point the environm
7879

7980
#### Prerequisites: Claim the server on its origin cluster
8081

81-
Before pointing your local environment at a real BMC, ensure the server is not being reconciled by another metal-operator instance. On the cluster that originally owns the server, create a `ServerMaintenance` to claim it and power it off:
82+
Before pointing your local environment at a real BMC, ensure the server is not in use in other deployments or being reconciled by another metal-operator instance as this may cause conflicts on controlling the server.
83+
84+
For metal-operator deployments, on the cluster that originally owns the server, create a `ServerMaintenance` to claim it and power it off:
8285

8386
```yaml
8487
apiVersion: metal.ironcore.dev/v1alpha1
@@ -87,12 +90,12 @@ metadata:
8790
name: <maintenance-name>
8891
namespace: default
8992
annotations:
90-
metal.ironcore.dev/maintenance-reason: "<maintenance-name>"
93+
metal.ironcore.dev/maintenance-reason: '<maintenance-name>'
9194
spec:
9295
policy: Enforced
9396
serverRef:
9497
name: <server-name>
95-
serverPower: "Off"
98+
serverPower: 'Off'
9699
```
97100
98101
```shell
@@ -149,7 +152,7 @@ data:
149152

150153
#### 3. Enable HTTPS for the BMC connection
151154

152-
The manager defaults to `--insecure=true`, which uses plain HTTP. For a real BMC on port 443, set `--insecure=false` in the `Tiltfile` to use HTTPS instead:
155+
The manager defaults to `--insecure=true`, which uses plain HTTP. This is fine for the default mock server but may not work for real servers. Make sure to adapt this to the target if necessary. E.g. for a real BMC that uses HTTPS on port 443, set `--insecure=false` in the `Tiltfile`:
153156

154157
```python
155158
settings = {
@@ -162,42 +165,66 @@ settings = {
162165
}
163166
```
164167

165-
#### 4. Claim the server with a ServerMaintenance
168+
#### 4. Start Tilt and verify
169+
170+
Start the environment:
171+
172+
```shell
173+
make tilt-up
174+
```
175+
176+
Once the manager is running, apply the `BMCSecret` to the local Kind cluster (it is not part of the kustomize config and must be applied manually):
166177

167-
Once the `Server` resource has been discovered and is `Available`, create a `ServerMaintenance` to claim it for local development. This prevents the server from being allocated by other consumers and powers it off:
178+
A `BMCSecret` looks like:
168179

169180
```yaml
170181
apiVersion: metal.ironcore.dev/v1alpha1
171-
kind: ServerMaintenance
182+
kind: BMCSecret
172183
metadata:
173-
name: <maintenance-name>
174-
namespace: default
175-
annotations:
176-
metal.ironcore.dev/maintenance-reason: "<maintenance-name>"
177-
spec:
178-
policy: Enforced
179-
serverRef:
180-
name: <server-name>
181-
serverPower: "Off"
184+
name: <node-name>
185+
data:
186+
username: <base64-encoded-username>
187+
password: <base64-encoded-password>
182188
```
183189

184-
Apply and delete it with:
190+
> **Note:** The `username` and `password` values must be base64-encoded. You can encode them with `echo -n '<value>' | base64`.
185191

186192
```shell
187-
kubectl apply -f servermaintenance-<node-name>.yaml
188-
kubectl delete -f servermaintenance-<node-name>.yaml
193+
# Run against the local Kind cluster
194+
kubectl apply -f bmcsecret-<node-name>.yaml
195+
```
196+
197+
The metal-operator will pick up the `BMC` resource, connect to the remote hardware, and create a matching `Server` resource. Watch the resources come up:
198+
199+
```shell
200+
kubectl get bmc -w
201+
kubectl get server -w
202+
```
203+
204+
You can monitor the manager logs to verify the connection succeeds:
205+
206+
```shell
207+
kubectl logs -n metal-operator-system deployment/metal-operator-controller-manager -c manager -f
208+
```
209+
210+
To tear down the environment:
211+
212+
```shell
213+
make kind-delete
189214
```
190215

191216
#### Optional: Use the debug manager image
192217

193218
To get a shell-accessible manager image with `curl` and `ca-certificates` (useful for diagnosing BMC connectivity), switch the Tilt build target to `manager-debug`:
194219

195220
In `Tiltfile`:
221+
196222
```python
197-
docker_build('controller', '.', target = 'manager-debug')
223+
docker_build('controller', '../..', dockerfile='./Dockerfile', only=['ironcore-dev/metal-operator', 'gofish'], target = 'manager-debug')
198224
```
199225

200226
And add the corresponding stage to `Dockerfile`:
227+
201228
```dockerfile
202229
FROM debian:testing-slim AS manager-debug
203230
LABEL source_repository="https://github.com/ironcore-dev/metal-operator"

0 commit comments

Comments
 (0)