Skip to content

Commit 8d597f7

Browse files
update variable name as review comments suggested
1 parent 9c6a959 commit 8d597f7

File tree

5 files changed

+28
-22
lines changed

5 files changed

+28
-22
lines changed

api/v1alpha1/constants.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const (
2727

2828
// OperationSkipBootConfiguration indicates which boot configuration operation should be skipped.
2929
OperationSkipBootConfiguration = "metal.ironcore.dev/operation-skip-boot-configuration"
30-
// OperationBootConfigurationSkip skips the boot configuration if set to this value.
31-
OperationBootConfigurationSkip = "skip"
30+
// SkipBootConfiguration skips the boot configuration if set to this value.
31+
SkipBootConfiguration = "skip"
3232
// OperationAnnotationForceReset forces a reset before next operation
3333
OperationAnnotationForceReset = "ForceReset"
3434
)

api/v1alpha1/servermaintenance_types.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ type ServerBootConfigurationTemplate struct {
2424
Name string `json:"name"`
2525

2626
// BootType specifies the type of boot configuration.
27-
// It can be either "Oneoff" or "Persistent". If not specified, it defaults to "Persistent".
27+
// It can be either "OneOff" or "Persistent". If not specified, it defaults to "Persistent".
2828
// "Persistent" will set the configuration reboot the server before setting the server to the desired power state mentioned in spec.
2929
//
30-
// "Oneoff" will set the configuration to boot once. next boot-up will boot into default boot order.
30+
// "OneOff" will set the configuration to boot once. next boot-up will boot into default boot order.
3131
// if power state mentioned in spec is "PowerOn", server will be powered on and will boot into the configuration.
3232
// if power state is "PowerOff", server will be powered off and will boot into the configuration on next power on.
3333
//
34-
// +kubebuilder:validation:Enum=Oneoff;Persistent
34+
// +kubebuilder:validation:Enum=OneOff;Persistent
3535
// +optional
3636
// +kubebuilder:default=Persistent
37-
Boottype BootType `json:"bootType,omitempty"`
37+
BootType BootType `json:"bootType,omitempty"`
3838

3939
// Parameters specify the parameters to be used for rendering the boot configuration.
4040
// +required
@@ -45,7 +45,7 @@ type BootType string
4545

4646
const (
4747
// BootTypeOneOff indicates that the server should boot into this configuration one time.
48-
BootTypeOneOff BootType = "Oneoff"
48+
BootTypeOneOff BootType = "OneOff"
4949
// BootTypePersistent indicates that the server should boot into this configuration continuously.
5050
BootTypePersistent BootType = "Persistent"
5151
)
@@ -84,7 +84,9 @@ type ServerMaintenanceStatus struct {
8484
// State specifies the current state of the server maintenance.
8585
State ServerMaintenanceState `json:"state,omitempty"`
8686

87-
// BootOrder specifies the boot order of the server before maintenance.
87+
// BootOrderStatus specifies the boot order of the server before maintenance.
88+
// is used to store the boot order of server before it is changed for maintenance.
89+
// used only with BootType Persistent.
8890
// +optional
8991
BootOrderStatus *ServerMaintenanceBootOrder `json:"bootOrderStatus,omitempty"`
9092
}

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ spec:
7070
default: Persistent
7171
description: |-
7272
BootType specifies the type of boot configuration.
73-
It can be either "Oneoff" or "Persistent". If not specified, it defaults to "Persistent".
73+
It can be either "OneOff" or "Persistent". If not specified, it defaults to "Persistent".
7474
"Persistent" will set the configuration reboot the server before setting the server to the desired power state mentioned in spec.
7575
76-
"Oneoff" will set the configuration to boot once. next boot-up will boot into default boot order.
76+
"OneOff" will set the configuration to boot once. next boot-up will boot into default boot order.
7777
if power state mentioned in spec is "PowerOn", server will be powered on and will boot into the configuration.
7878
if power state is "PowerOff", server will be powered off and will boot into the configuration on next power on.
7979
enum:
80-
- Oneoff
80+
- OneOff
8181
- Persistent
8282
type: string
8383
name:
@@ -156,8 +156,10 @@ spec:
156156
description: ServerMaintenanceStatus defines the observed state of a ServerMaintenance
157157
properties:
158158
bootOrderStatus:
159-
description: BootOrder specifies the boot order of the server before
160-
maintenance.
159+
description: |-
160+
BootOrderStatus specifies the boot order of the server before maintenance.
161+
is used to store the boot order of server before it is changed for maintenance.
162+
used only with BootType Persistent.
161163
properties:
162164
defaultBootOrder:
163165
description: DefaultBootOrder specifies the default boot order

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ spec:
7676
default: Persistent
7777
description: |-
7878
BootType specifies the type of boot configuration.
79-
It can be either "Oneoff" or "Persistent". If not specified, it defaults to "Persistent".
79+
It can be either "OneOff" or "Persistent". If not specified, it defaults to "Persistent".
8080
"Persistent" will set the configuration reboot the server before setting the server to the desired power state mentioned in spec.
8181
82-
"Oneoff" will set the configuration to boot once. next boot-up will boot into default boot order.
82+
"OneOff" will set the configuration to boot once. next boot-up will boot into default boot order.
8383
if power state mentioned in spec is "PowerOn", server will be powered on and will boot into the configuration.
8484
if power state is "PowerOff", server will be powered off and will boot into the configuration on next power on.
8585
enum:
86-
- Oneoff
86+
- OneOff
8787
- Persistent
8888
type: string
8989
name:
@@ -162,8 +162,10 @@ spec:
162162
description: ServerMaintenanceStatus defines the observed state of a ServerMaintenance
163163
properties:
164164
bootOrderStatus:
165-
description: BootOrder specifies the boot order of the server before
166-
maintenance.
165+
description: |-
166+
BootOrderStatus specifies the boot order of the server before maintenance.
167+
is used to store the boot order of server before it is changed for maintenance.
168+
used only with BootType Persistent.
167169
properties:
168170
defaultBootOrder:
169171
description: DefaultBootOrder specifies the default boot order

internal/controller/servermaintenance_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (r *ServerMaintenanceReconciler) handlePrepareMaintenanceState(ctx context.
215215
// implication of skipping is that the server will still continue to run the OS during Maintenance
216216
// might be subjected to reboots
217217
val, found := serverMaintenance.GetAnnotations()[metalv1alpha1.OperationSkipBootConfiguration]
218-
if config == nil && (!found || val != metalv1alpha1.OperationBootConfigurationSkip) {
218+
if config == nil && (!found || val != metalv1alpha1.SkipBootConfiguration) {
219219
log.V(1).Info("No ServerBootConfigurationTemplate boot configuration", "Server", server.Name)
220220
_, err = r.patchMaintenanceState(ctx, serverMaintenance, metalv1alpha1.ServerMaintenanceStateFailed)
221221
return ctrl.Result{}, err
@@ -445,7 +445,7 @@ func (r *ServerMaintenanceReconciler) configureBootOrder(ctx context.Context, lo
445445
}
446446
defer bmcClient.Logout()
447447

448-
switch maintenance.Spec.ServerBootConfigurationTemplate.Boottype {
448+
switch maintenance.Spec.ServerBootConfigurationTemplate.BootType {
449449
case metalv1alpha1.BootTypeOneOff:
450450
// note: with this option, the next server boot up will enter pxe boot.
451451
// if Maintenance Spec.ServerPower is PowerOn, server will be powered on and will boot into pxe
@@ -531,7 +531,7 @@ func (r *ServerMaintenanceReconciler) configureBootOrder(ctx context.Context, lo
531531
}
532532
log.V(1).Info("Configured boot order for server",
533533
"Server", server.Name,
534-
"BootType", maintenance.Spec.ServerBootConfigurationTemplate.Boottype,
534+
"BootType", maintenance.Spec.ServerBootConfigurationTemplate.BootType,
535535
"BootOrder", bootOrderChanged)
536536
// save the current boot order to revert back after maintenance
537537
status := &metalv1alpha1.ServerMaintenanceBootOrder{
@@ -558,7 +558,7 @@ func (r *ServerMaintenanceReconciler) configureBootOrder(ctx context.Context, lo
558558
log.V(1).Info("wait for boot order to be set on server", "Server", server.Name)
559559
return true, nil
560560
default:
561-
return false, fmt.Errorf("unknown boot type: %s", maintenance.Spec.ServerBootConfigurationTemplate.Boottype)
561+
return false, fmt.Errorf("unknown boot type: %s", maintenance.Spec.ServerBootConfigurationTemplate.BootType)
562562
}
563563
}
564564

0 commit comments

Comments
 (0)