Skip to content

Commit 6d11946

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

File tree

1 file changed

+137
-0
lines changed

1 file changed

+137
-0
lines changed

docs/development/dev_setup.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,140 @@ 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+
```
134+
135+
#### 2. Create a BMCSecret with credentials
136+
137+
Apply a `BMCSecret` with base64-encoded credentials for the BMC:
138+
139+
```yaml
140+
apiVersion: metal.ironcore.dev/v1alpha1
141+
kind: BMCSecret
142+
metadata:
143+
name: <node-name>
144+
data:
145+
username: <base64-encoded-username>
146+
password: <base64-encoded-password>
147+
```
148+
149+
#### 3. Disable TLS enforcement
150+
151+
In `Tiltfile`, add `--insecure=false` to the manager args so the controller does not enforce strict TLS when connecting to the BMC:
152+
153+
```python
154+
settings = {
155+
"new_args": {
156+
"metal": [
157+
# ...
158+
"--insecure=false",
159+
],
160+
}
161+
}
162+
```
163+
164+
#### 4. Claim the server with a ServerMaintenance
165+
166+
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:
167+
168+
```yaml
169+
apiVersion: metal.ironcore.dev/v1alpha1
170+
kind: ServerMaintenance
171+
metadata:
172+
name: <maintenance-name>
173+
namespace: default
174+
annotations:
175+
metal.ironcore.dev/maintenance-reason: "<maintenance-name>"
176+
spec:
177+
policy: Enforced
178+
serverRef:
179+
name: <server-name>
180+
serverPower: "Off"
181+
```
182+
183+
Apply and delete it with:
184+
185+
```shell
186+
kubectl apply -f servermaintenance-<node-name>.yaml
187+
kubectl delete -f servermaintenance-<node-name>.yaml
188+
```
189+
190+
#### Optional: Use the debug manager image
191+
192+
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`:
193+
194+
In `Tiltfile`:
195+
```python
196+
docker_build('controller', '.', target = 'manager-debug')
197+
```
198+
199+
And add the corresponding stage to `Dockerfile`:
200+
```dockerfile
201+
FROM debian:testing-slim AS manager-debug
202+
LABEL source_repository="https://github.com/ironcore-dev/metal-operator"
203+
WORKDIR /
204+
COPY --from=manager-builder /workspace/manager .
205+
COPY config/manager/ignition-template.yaml /etc/metal-operator/ignition-template.yaml
206+
RUN apt-get update && apt-get install -y --no-install-recommends \
207+
ca-certificates curl && \
208+
rm -rf /var/lib/apt/lists/*
209+
ENTRYPOINT ["/manager"]
210+
```

0 commit comments

Comments
 (0)