Commit 781ded8
committed
feat(bladectl)!: add more bladectl commands (#91)
This PR introduces a comprehensive set of new subcommands to bladectl, expanding its capabilities for querying and managing compute blade state. It also includes an internal refactor to simplify interface management across the gRPC API.
* `get`
* `fan`: Returns current fan speed.
* `identify`: Indicates whether the identify mode is active.
* `stealth`: Shows if stealth mode is currently enabled.
* `status`: Prints a full blade status report.
* `temperature`: Retrieves current SoC temperature.
* `critical`: Shows whether critical mode is active.
* `power`: Reports the current power source (e.g., PoE+ or USB).
* `set`
* `stealth`: Enables stealth mode.
* `remove`
* `stealth`: Disables stealth mode.
* `describe`
* `fan`: Outputs the current fan curve configuration.
* `monitor`: plot some charts about the state of the compute-blade-agent
* **gRPC API refactor**: The gRPC service definitions previously located in `internal/api` have been folded into `internal/agent`. This eliminates redundant interface declarations and ensures that all ComputeBladeAgent implementations are directly compatible with the gRPC API.
This reduces duplication and improves long-term maintainability and clarity of the interface contract.
```bash
bladectl set fan --percent 90 --blade 1 --blade 2
bladectl unset identify --blade 1 --blade 2 --blade 3 --blade 4
bladectl set stealth --blade 1 --blade 2 --blade 3 --blade 4
bladectl get status --blade 1 --blade 2 --blade 3 --blade 4
┌───────┬─────────────┬────────────────────┬───────────────┬──────────────┬──────────┬───────────────┬──────────────┐
│ BLADE │ TEMPERATURE │ FAN SPEED OVERRIDE │ FAN SPEED │ STEALTH MODE │ IDENTIFY │ CRITICAL MODE │ POWER STATUS │
├───────┼─────────────┼────────────────────┼───────────────┼──────────────┼──────────┼───────────────┼──────────────┤
│ 1 │ 50°C │ 90% │ 5825 RPM(90%) │ Active │ Off │ Off │ poe+ │
│ 2 │ 48°C │ 90% │ 5825 RPM(90%) │ Active │ Off │ Off │ poe+ │
│ 3 │ 49°C │ Not set │ 4643 RPM(56%) │ Active │ Off │ Off │ poe+ │
│ 4 │ 49°C │ Not set │ 4774 RPM(58%) │ Active │ Off │ Off │ poe+ │
└───────┴─────────────┴────────────────────┴───────────────┴──────────────┴──────────┴───────────────┴──────────────┘
bladectl rm stealth --blade 1 --blade 2 --blade 3 --blade 4
bladectl rm fan --blade 1 --blade 2 --blade 3 --blade 4
bladectl get status --blade 1 --blade 2 --blade 3 --blade 4
┌───────┬─────────────┬────────────────────┬───────────────┬──────────────┬──────────┬───────────────┬──────────────┐
│ BLADE │ TEMPERATURE │ FAN SPEED OVERRIDE │ FAN SPEED │ STEALTH MODE │ IDENTIFY │ CRITICAL MODE │ POWER STATUS │
├───────┼─────────────┼────────────────────┼───────────────┼──────────────┼──────────┼───────────────┼──────────────┤
│ 1 │ 51°C │ Not set │ 5177 RPM(66%) │ Off │ Off │ Off │ poe+ │
│ 2 │ 49°C │ Not set │ 5177 RPM(58%) │ Off │ Off │ Off │ poe+ │
│ 3 │ 50°C │ Not set │ 4659 RPM(60%) │ Off │ Off │ Off │ poe+ │
│ 4 │ 48°C │ Not set │ 4659 RPM(54%) │ Off │ Off │ Off │ poe+ │
└───────┴─────────────┴────────────────────┴───────────────┴──────────────┴──────────┴───────────────┴──────────────┘
```
when having multiple compute-blades in your bladeconfig:
```yaml
blades:
- name: 1
blade:
server: blade-pi1:8081
cert:
certificate-authority-data: <redacted>
client-certificate-data: <redacted>
client-key-data: <redacted>
- name: 2
blade:
server: blade-pi2:8081
cert:
certificate-authority-data: <redacted>
client-certificate-data: <redacted>
client-key-data: <redacted>
- name: 3
blade:
server: blade-pi3:8081
cert:
certificate-authority-data: <redacted>
client-certificate-data: <redacted>
client-key-data: <redacted>
- name: 4
blade:
server: blade-pi4:8081
cert:
certificate-authority-data: <redacted>
client-certificate-data: <redacted>
client-key-data: <redacted>
- name: 4
blade:
server: blade-pi4:8081
cert:
certificate-authority-data: <redacted>
client-certificate-data: <redacted>
client-key-data: <redacted>
current-blade: 1
```
Fixes #4, #9 (partially), should help with #5
* test: improve unit-testing
* fix: pin github.com/warthog618/gpiod
---------
Co-authored-by: Cedric Kienzler <[email protected]>1 parent 7ec49ce commit 781ded8
File tree
41 files changed
+1936
-737
lines changed- api/bladeapi/v1alpha1
- cmd
- agent
- bladectl
- internal
- agent
- api
- pkg
- agent
- fancontroller
- hal
- ledengine
- util
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
41 files changed
+1936
-737
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
| |||
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
| 65 | + | |
56 | 66 | | |
57 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
58 | 74 | | |
59 | 75 | | |
| 76 | + | |
60 | 77 | | |
61 | 78 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
| 156 | + | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 166 | | |
178 | 167 | | |
179 | 168 | | |
| |||
190 | 179 | | |
191 | 180 | | |
192 | 181 | | |
193 | | - | |
194 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
195 | 187 | | |
196 | 188 | | |
197 | 189 | | |
| |||
218 | 210 | | |
219 | 211 | | |
220 | 212 | | |
221 | | - | |
| 213 | + | |
222 | 214 | | |
223 | 215 | | |
224 | 216 | | |
| |||
0 commit comments