Skip to content

Commit 35ee54d

Browse files
authored
Document how to connect a remote BMC in the Tilt dev environment (#760)
* Document how to connect a remote BMC in the Tilt dev environment * address review comments, generalize some parts * update to match rebased main
1 parent 5fce839 commit 35ee54d

1 file changed

Lines changed: 165 additions & 1 deletion

File tree

docs/development/dev_setup.md

Lines changed: 165 additions & 1 deletion
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
@@ -71,3 +72,166 @@ The local development environment can be deleted via
7172
```shell
7273
make kind-delete
7374
```
75+
76+
### Connecting a Remote BMC in the Tilt Environment
77+
78+
By default, Tilt runs against a local Redfish mock server. To point the environment at real hardware instead, apply the following changes.
79+
80+
#### Prerequisites: Ensure the BMC is not actively managed
81+
82+
Before connecting a real BMC to your local Tilt environment, make sure it is not actively reconciled by another `metal-operator` instance to avoid conflicts. Some common ways to achieve this:
83+
84+
- **ServerMaintenance**: Create a `ServerMaintenance` resource on the production cluster to claim the server and optionally power it off.
85+
- **Exclude from automation**: Remove the server from the production `metal-operator`'s scope, for example via label selectors or namespace isolation, so it is no longer reconciled.
86+
- **Decommission temporarily**: If the server is not in active use, you can power it off or disconnect it from the production cluster before testing.
87+
88+
> **Note:** Refer to your production cluster's runbooks for the appropriate procedure.
89+
90+
If you use the `ServerMaintenance` approach, apply a manifest like this on the cluster that currently owns the server:
91+
92+
```yaml
93+
apiVersion: metal.ironcore.dev/v1alpha1
94+
kind: ServerMaintenance
95+
metadata:
96+
name: <maintenance-name>
97+
namespace: default
98+
annotations:
99+
metal.ironcore.dev/maintenance-reason: '<maintenance-name>'
100+
spec:
101+
policy: Enforced
102+
serverRef:
103+
name: <server-name>
104+
serverPower: 'Off'
105+
```
106+
107+
```shell
108+
# Run against the remote cluster
109+
kubectl apply -f servermaintenance-<node-name>.yaml
110+
```
111+
112+
To release the server back when done:
113+
114+
```shell
115+
# Run against the remote cluster
116+
kubectl delete -f servermaintenance-<node-name>.yaml
117+
```
118+
119+
> **Note:** All `kubectl` commands from this point on target the **local** Kind cluster.
120+
121+
#### 1. Replace the mockup endpoint with a real BMC resource
122+
123+
Edit `config/redfish-mockup/redfish_mockup_endpoint.yaml` to define a `BMC` resource targeting the real hardware:
124+
125+
```yaml
126+
apiVersion: metal.ironcore.dev/v1alpha1
127+
kind: BMC
128+
metadata:
129+
name: <node-name>
130+
spec:
131+
bmcSecretRef:
132+
name: <node-name>
133+
hostname: <bmc-hostname>
134+
consoleProtocol:
135+
name: SSH
136+
port: 22
137+
access:
138+
ip: <bmc-ip>
139+
protocol:
140+
name: Redfish
141+
port: 443
142+
scheme: https
143+
```
144+
145+
#### 2. Create a BMCSecret with credentials
146+
147+
Create a `BMCSecret` file with credentials for the BMC:
148+
149+
```yaml
150+
apiVersion: metal.ironcore.dev/v1alpha1
151+
kind: BMCSecret
152+
metadata:
153+
name: <node-name>
154+
data:
155+
username: <base64-encoded-username>
156+
password: <base64-encoded-password>
157+
```
158+
159+
> **Note:** The `username` and `password` values must be base64-encoded. You can encode them with `echo -n '<value>' | base64`.
160+
161+
Save this as `bmcsecret-<node-name>.yaml`, but do not apply it yet.
162+
163+
#### 3. Enable HTTPS for the BMC connection
164+
165+
The `--insecure` flag is deprecated. Use `--protocol` and `--skip-cert-validation` instead.
166+
167+
For a real BMC that uses HTTPS on port 443, configure the manager to use secure HTTPS with certificate validation enabled in the `Tiltfile`:
168+
169+
```python
170+
settings = {
171+
"new_args": {
172+
"metal": [
173+
# ...
174+
"--protocol=https",
175+
"--skip-cert-validation=false",
176+
],
177+
}
178+
}
179+
```
180+
181+
#### 4. Start Tilt and verify
182+
183+
Start the environment:
184+
185+
```shell
186+
make tilt-up
187+
```
188+
189+
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):
190+
191+
```shell
192+
# Run against the local Kind cluster
193+
kubectl apply -f bmcsecret-<node-name>.yaml
194+
```
195+
196+
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:
197+
198+
```shell
199+
kubectl get bmc -w
200+
kubectl get server -w
201+
```
202+
203+
You can monitor the manager logs to verify the connection succeeds:
204+
205+
```shell
206+
kubectl logs -n metal-operator-system deployment/metal-operator-controller-manager -c manager -f
207+
```
208+
209+
To tear down the environment:
210+
211+
```shell
212+
make kind-delete
213+
```
214+
215+
#### Optional: Use the debug manager image
216+
217+
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`:
218+
219+
In `Tiltfile`:
220+
221+
```python
222+
docker_build('controller', '../..', dockerfile='./Dockerfile', only=['ironcore-dev/metal-operator', 'gofish'], target = 'manager-debug')
223+
```
224+
225+
And add the corresponding stage to `Dockerfile`:
226+
227+
```dockerfile
228+
FROM debian:testing-slim AS manager-debug
229+
LABEL source_repository="https://github.com/ironcore-dev/metal-operator"
230+
WORKDIR /
231+
COPY --from=manager-builder /workspace/manager .
232+
COPY config/manager/ignition-template.yaml /etc/metal-operator/ignition-template.yaml
233+
RUN apt-get update && apt-get install -y --no-install-recommends \
234+
ca-certificates curl && \
235+
rm -rf /var/lib/apt/lists/*
236+
ENTRYPOINT ["/manager"]
237+
```

0 commit comments

Comments
 (0)