Skip to content

Commit 42fdbad

Browse files
committed
Document how to connect a remote BMC in the Tilt dev environment
1 parent 616fbac commit 42fdbad

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

docs/development/dev_setup.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,141 @@ The local development environment can be deleted via
7171
```shell
7272
make kind-delete
7373
```
74+
75+
### Connecting a Remote BMC in the Tilt Environment
76+
77+
By default, Tilt runs against a local Redfish mock server. To point the environment at real hardware instead, apply the following changes.
78+
79+
#### Prerequisites: Claim the server on its origin cluster
80+
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+
83+
```yaml
84+
apiVersion: metal.ironcore.dev/v1alpha1
85+
kind: ServerMaintenance
86+
metadata:
87+
name: <maintenance-name>
88+
namespace: default
89+
annotations:
90+
metal.ironcore.dev/maintenance-reason: "<maintenance-name>"
91+
spec:
92+
policy: Enforced
93+
serverRef:
94+
name: <server-name>
95+
serverPower: "Off"
96+
```
97+
98+
```shell
99+
# Run against the remote cluster
100+
kubectl apply -f servermaintenance-<node-name>.yaml
101+
```
102+
103+
To release the server back when done:
104+
105+
```shell
106+
# Run against the remote cluster
107+
kubectl delete -f servermaintenance-<node-name>.yaml
108+
```
109+
110+
> **Note:** All `kubectl` commands from this point on target the **local** Kind cluster.
111+
112+
#### 1. Replace the mockup endpoint with a real BMC resource
113+
114+
Edit `config/redfish-mockup/redfish_mockup_endpoint.yaml` to define a `BMC` resource targeting the real hardware:
115+
116+
```yaml
117+
apiVersion: metal.ironcore.dev/v1alpha1
118+
kind: BMC
119+
metadata:
120+
name: <node-name>
121+
spec:
122+
bmcSecretRef:
123+
name: <node-name>
124+
hostname: <bmc-hostname>
125+
consoleProtocol:
126+
name: SSH
127+
port: 22
128+
access:
129+
ip: <bmc-ip>
130+
protocol:
131+
name: Redfish
132+
port: 443
133+
scheme: https
134+
```
135+
136+
#### 2. Create a BMCSecret with credentials
137+
138+
Apply a `BMCSecret` with base64-encoded credentials for the BMC:
139+
140+
```yaml
141+
apiVersion: metal.ironcore.dev/v1alpha1
142+
kind: BMCSecret
143+
metadata:
144+
name: <node-name>
145+
data:
146+
username: <base64-encoded-username>
147+
password: <base64-encoded-password>
148+
```
149+
150+
#### 3. Enable HTTPS for the BMC connection
151+
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:
153+
154+
```python
155+
settings = {
156+
"new_args": {
157+
"metal": [
158+
# ...
159+
"--insecure=false",
160+
],
161+
}
162+
}
163+
```
164+
165+
#### 4. Claim the server with a ServerMaintenance
166+
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:
168+
169+
```yaml
170+
apiVersion: metal.ironcore.dev/v1alpha1
171+
kind: ServerMaintenance
172+
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"
182+
```
183+
184+
Apply and delete it with:
185+
186+
```shell
187+
kubectl apply -f servermaintenance-<node-name>.yaml
188+
kubectl delete -f servermaintenance-<node-name>.yaml
189+
```
190+
191+
#### Optional: Use the debug manager image
192+
193+
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`:
194+
195+
In `Tiltfile`:
196+
```python
197+
docker_build('controller', '.', target = 'manager-debug')
198+
```
199+
200+
And add the corresponding stage to `Dockerfile`:
201+
```dockerfile
202+
FROM debian:testing-slim AS manager-debug
203+
LABEL source_repository="https://github.com/ironcore-dev/metal-operator"
204+
WORKDIR /
205+
COPY --from=manager-builder /workspace/manager .
206+
COPY config/manager/ignition-template.yaml /etc/metal-operator/ignition-template.yaml
207+
RUN apt-get update && apt-get install -y --no-install-recommends \
208+
ca-certificates curl && \
209+
rm -rf /var/lib/apt/lists/*
210+
ENTRYPOINT ["/manager"]
211+
```

0 commit comments

Comments
 (0)