Skip to content

Commit c6bbc1e

Browse files
improve documentation for biosSettings
1 parent ad462f2 commit c6bbc1e

File tree

12 files changed

+215
-231
lines changed

12 files changed

+215
-231
lines changed

api/v1alpha1/biossettings_types.go

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ import (
88
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
99
)
1010

11-
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
12-
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
13-
1411
// BIOSSettingsSpec defines the desired state of BIOSSettings.
1512
type BIOSSettingsSpec struct {
16-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
17-
// Important: Run "make" to regenerate code after modifying this file
13+
// Version contains software (eg: BIOS, BMC) version this settings applies to
14+
// +required
15+
Version string `json:"version"`
1816

19-
// BIOSSettings specifies the BIOS settings for the selected serverRef or serverSelector.
20-
BIOSSettings Settings `json:"biosSettings,omitempty"`
17+
// SettingsMap contains software (eg: BIOS, BMC) settings as map
18+
// +optional
19+
SettingsMap map[string]string `json:"settings,omitempty"`
2120

2221
// ServerRef is a reference to a specific server to apply bios setting on.
2322
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="serverRef is immutable"
@@ -30,27 +29,17 @@ type BIOSSettingsSpec struct {
3029
ServerMaintenanceRef *corev1.ObjectReference `json:"serverMaintenanceRef,omitempty"`
3130
}
3231

33-
type Settings struct {
34-
// Version contains BIOS version this settings applies to
35-
// +required
36-
Version string `json:"version"`
37-
38-
// SettingsMap contains bios settings as map
39-
// +optional
40-
SettingsMap map[string]string `json:"settings,omitempty"`
41-
}
42-
4332
// BIOSSettingsState specifies the current state of the BIOS maintenance.
4433
type BIOSSettingsState string
4534

4635
const (
47-
// BIOSSettingsStatePending specifies that the server bios is in setting update path.
36+
// BIOSSettingsStatePending specifies that the bios setting maintenance is waiting
4837
BIOSSettingsStatePending BIOSSettingsState = "Pending"
49-
// BIOSSettingsStateInProgress specifies that the server bios is in setting update path.
38+
// BIOSSettingsStateInProgress specifies that the BIOSSetting Controller is updating the settings
5039
BIOSSettingsStateInProgress BIOSSettingsState = "InProgress"
51-
// BIOSSettingsStateApplied specifies that the server bios maintenance has been completed.
40+
// BIOSSettingsStateApplied specifies that the bios setting maintenance has been completed.
5241
BIOSSettingsStateApplied BIOSSettingsState = "Applied"
53-
// BIOSSettingsStateFailed specifies that the server maintenance has failed.
42+
// BIOSSettingsStateFailed specifies that the bios setting maintenance has failed.
5443
BIOSSettingsStateFailed BIOSSettingsState = "Failed"
5544
)
5645

@@ -61,9 +50,9 @@ const (
6150
BIOSSettingUpdateWaitOnServerRebootPowerOff BIOSSettingUpdateState = "WaitOnServerRebootPowerOff"
6251
// BIOSSettingUpdateWaitOnServerRebootPowerOn specifies that the bios setting state is waiting on server to turn on during Reboot.
6352
BIOSSettingUpdateWaitOnServerRebootPowerOn BIOSSettingUpdateState = "WaitOnServerRebootPowerOn"
64-
// BIOSSettingUpdateStateIssue specifies that the bios new setting was posted to RedFish
53+
// BIOSSettingUpdateStateIssue specifies that the bios new setting was posted to server's RedFish API
6554
BIOSSettingUpdateStateIssue BIOSSettingUpdateState = "IssueSettingUpdate"
66-
// BIOSSettingUpdateStateVerification specifies that the bios setting has been completed.
55+
// BIOSSettingUpdateStateVerification specifies that the bios setting is beening verified.
6756
BIOSSettingUpdateStateVerification BIOSSettingUpdateState = "VerifySettingUpdate"
6857
)
6958

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 7 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bmc/redfish.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,7 @@ func (r *RedfishBMC) GetEntityFromUri(uri string, client common.Client, entity a
343343
if err != nil {
344344
return err
345345
}
346-
347-
err = json.Unmarshal(RespRawBody, &entity)
348-
if err != nil {
349-
return err
350-
}
351-
return nil
346+
return json.Unmarshal(RespRawBody, &entity)
352347
}
353348

354349
// SetBiosAttributesOnReset sets given bios attributes.

bmc/redfish_local.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func (r *RedfishLocalBMC) SetBiosAttributesOnReset(
106106
defaultMockedBIOSSetting = map[string]map[string]any{}
107107
}
108108

109+
pendingMockedBIOSSetting = map[string]map[string]any{}
109110
for key, attrData := range attributes {
110111
if AttributesData, ok := defaultMockedBIOSSetting[key]; ok {
111112
if reboot, ok := AttributesData["reboot"]; ok && !reboot.(bool) {

cmd/manager/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,13 @@ func main() { // nolint: gocyclo
378378
setupLog.Error(err, "unable to create controller", "controller", "BIOSSettings")
379379
os.Exit(1)
380380
}
381+
// nolint:goconst
382+
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
383+
if err = webhookmetalv1alpha1.SetupBIOSSettingsWebhookWithManager(mgr); err != nil {
384+
setupLog.Error(err, "unable to create webhook", "webhook", "BIOSSettings")
385+
os.Exit(1)
386+
}
387+
}
381388
//+kubebuilder:scaffold:builder
382389

383390
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {

config/crd/bases/metal.ironcore.dev_biossettings.yaml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,6 @@ spec:
5252
spec:
5353
description: BIOSSettingsSpec defines the desired state of BIOSSettings.
5454
properties:
55-
biosSettings:
56-
description: BIOSSettings specifies the BIOS settings for the selected
57-
serverRef or serverSelector.
58-
properties:
59-
settings:
60-
additionalProperties:
61-
type: string
62-
description: SettingsMap contains bios settings as map
63-
type: object
64-
version:
65-
description: Version contains BIOS version this settings applies
66-
to
67-
type: string
68-
required:
69-
- version
70-
type: object
7155
serverMaintenancePolicy:
7256
description: ServerMaintenancePolicy is maintenance policy to be enforced
7357
on the server.
@@ -134,6 +118,18 @@ spec:
134118
x-kubernetes-validations:
135119
- message: serverRef is immutable
136120
rule: self == oldSelf
121+
settings:
122+
additionalProperties:
123+
type: string
124+
description: 'SettingsMap contains software (eg: BIOS, BMC) settings
125+
as map'
126+
type: object
127+
version:
128+
description: 'Version contains software (eg: BIOS, BMC) version this
129+
settings applies to'
130+
type: string
131+
required:
132+
- version
137133
type: object
138134
status:
139135
description: BIOSSettingsStatus defines the observed state of BIOSSettings.

config/samples/metal_v1alpha1_biossettings.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ metadata:
88
spec:
99
serverRef:
1010
name: endpoint-sample-system-0
11-
biosSettings:
12-
version: 2.10.2
13-
settings:
14-
PxeDev1EnDis: Enabled
15-
ServerMaintenancePolicyTemplate: OwnerApproval
11+
version: 2.10.2
12+
settings:
13+
PxeDev1EnDis: Enabled
14+
serverMaintenancePolicy: OwnerApproval

dist/chart/templates/crd/metal.ironcore.dev_biossettings.yaml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,6 @@ spec:
5858
spec:
5959
description: BIOSSettingsSpec defines the desired state of BIOSSettings.
6060
properties:
61-
biosSettings:
62-
description: BIOSSettings specifies the BIOS settings for the selected
63-
serverRef or serverSelector.
64-
properties:
65-
settings:
66-
additionalProperties:
67-
type: string
68-
description: SettingsMap contains bios settings as map
69-
type: object
70-
version:
71-
description: Version contains BIOS version this settings applies
72-
to
73-
type: string
74-
required:
75-
- version
76-
type: object
7761
serverMaintenancePolicy:
7862
description: ServerMaintenancePolicy is maintenance policy to be enforced
7963
on the server.
@@ -140,6 +124,18 @@ spec:
140124
x-kubernetes-validations:
141125
- message: serverRef is immutable
142126
rule: self == oldSelf
127+
settings:
128+
additionalProperties:
129+
type: string
130+
description: 'SettingsMap contains software (eg: BIOS, BMC) settings
131+
as map'
132+
type: object
133+
version:
134+
description: 'Version contains software (eg: BIOS, BMC) version this
135+
settings applies to'
136+
type: string
137+
required:
138+
- version
143139
type: object
144140
status:
145141
description: BIOSSettingsStatus defines the observed state of BIOSSettings.

docs/api-reference/api.md

Lines changed: 36 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Resource Types:
2525
</tr>
2626
</thead>
2727
<tbody><tr><td><p>&#34;IssueSettingUpdate&#34;</p></td>
28-
<td><p>BIOSSettingUpdateStateIssue specifies that the bios new setting was posted to RedFish</p>
28+
<td><p>BIOSSettingUpdateStateIssue specifies that the bios new setting was posted to server&rsquo;s RedFish API</p>
2929
</td>
3030
</tr><tr><td><p>&#34;VerifySettingUpdate&#34;</p></td>
31-
<td><p>BIOSSettingUpdateStateVerification specifies that the bios setting has been completed.</p>
31+
<td><p>BIOSSettingUpdateStateVerification specifies that the bios setting is beening verified.</p>
3232
</td>
3333
</tr><tr><td><p>&#34;WaitOnServerRebootPowerOff&#34;</p></td>
3434
<td><p>BIOSSettingUpdateWaitOnServerRebootPowerOff specifies that the bios setting state is waiting on server to turn off during Reboot.</p>
@@ -80,15 +80,25 @@ BIOSSettingsSpec
8080
<table>
8181
<tr>
8282
<td>
83-
<code>biosSettings</code><br/>
83+
<code>version</code><br/>
8484
<em>
85-
<a href="#metal.ironcore.dev/v1alpha1.Settings">
86-
Settings
87-
</a>
85+
string
86+
</em>
87+
</td>
88+
<td>
89+
<p>Version contains software (eg: BIOS, BMC) version this settings applies to</p>
90+
</td>
91+
</tr>
92+
<tr>
93+
<td>
94+
<code>settings</code><br/>
95+
<em>
96+
map[string]string
8897
</em>
8998
</td>
9099
<td>
91-
<p>BIOSSettings specifies the BIOS settings for the selected serverRef or serverSelector.</p>
100+
<em>(Optional)</em>
101+
<p>SettingsMap contains software (eg: BIOS, BMC) settings as map</p>
92102
</td>
93103
</tr>
94104
<tr>
@@ -165,15 +175,25 @@ BIOSSettingsStatus
165175
<tbody>
166176
<tr>
167177
<td>
168-
<code>biosSettings</code><br/>
178+
<code>version</code><br/>
169179
<em>
170-
<a href="#metal.ironcore.dev/v1alpha1.Settings">
171-
Settings
172-
</a>
180+
string
181+
</em>
182+
</td>
183+
<td>
184+
<p>Version contains software (eg: BIOS, BMC) version this settings applies to</p>
185+
</td>
186+
</tr>
187+
<tr>
188+
<td>
189+
<code>settings</code><br/>
190+
<em>
191+
map[string]string
173192
</em>
174193
</td>
175194
<td>
176-
<p>BIOSSettings specifies the BIOS settings for the selected serverRef or serverSelector.</p>
195+
<em>(Optional)</em>
196+
<p>SettingsMap contains software (eg: BIOS, BMC) settings as map</p>
177197
</td>
178198
</tr>
179199
<tr>
@@ -233,16 +253,16 @@ Kubernetes core/v1.ObjectReference
233253
</tr>
234254
</thead>
235255
<tbody><tr><td><p>&#34;Applied&#34;</p></td>
236-
<td><p>BIOSSettingsStateApplied specifies that the server bios maintenance has been completed.</p>
256+
<td><p>BIOSSettingsStateApplied specifies that the bios setting maintenance has been completed.</p>
237257
</td>
238258
</tr><tr><td><p>&#34;Failed&#34;</p></td>
239-
<td><p>BIOSSettingsStateFailed specifies that the server maintenance has failed.</p>
259+
<td><p>BIOSSettingsStateFailed specifies that the bios setting maintenance has failed.</p>
240260
</td>
241261
</tr><tr><td><p>&#34;InProgress&#34;</p></td>
242-
<td><p>BIOSSettingsStateInProgress specifies that the server bios is in setting update path.</p>
262+
<td><p>BIOSSettingsStateInProgress specifies that the BIOSSetting Controller is updating the settings</p>
243263
</td>
244264
</tr><tr><td><p>&#34;Pending&#34;</p></td>
245-
<td><p>BIOSSettingsStatePending specifies that the server bios is in setting update path.</p>
265+
<td><p>BIOSSettingsStatePending specifies that the bios setting maintenance is waiting</p>
246266
</td>
247267
</tr></tbody>
248268
</table>
@@ -2854,46 +2874,6 @@ k8s.io/apimachinery/pkg/api/resource.Quantity
28542874
</tr>
28552875
</tbody>
28562876
</table>
2857-
<h3 id="metal.ironcore.dev/v1alpha1.Settings">Settings
2858-
</h3>
2859-
<p>
2860-
(<em>Appears on:</em><a href="#metal.ironcore.dev/v1alpha1.BIOSSettingsSpec">BIOSSettingsSpec</a>)
2861-
</p>
2862-
<div>
2863-
</div>
2864-
<table>
2865-
<thead>
2866-
<tr>
2867-
<th>Field</th>
2868-
<th>Description</th>
2869-
</tr>
2870-
</thead>
2871-
<tbody>
2872-
<tr>
2873-
<td>
2874-
<code>version</code><br/>
2875-
<em>
2876-
string
2877-
</em>
2878-
</td>
2879-
<td>
2880-
<p>Version contains BIOS version this settings applies to</p>
2881-
</td>
2882-
</tr>
2883-
<tr>
2884-
<td>
2885-
<code>settings</code><br/>
2886-
<em>
2887-
map[string]string
2888-
</em>
2889-
</td>
2890-
<td>
2891-
<em>(Optional)</em>
2892-
<p>SettingsMap contains bios settings as map</p>
2893-
</td>
2894-
</tr>
2895-
</tbody>
2896-
</table>
28972877
<h3 id="metal.ironcore.dev/v1alpha1.Storage">Storage
28982878
</h3>
28992879
<p>

0 commit comments

Comments
 (0)