Skip to content

Refactor BIOSSettings reconciler#554

Merged
Nuckal777 merged 5 commits intomainfrom
enh/biossettings
Dec 12, 2025
Merged

Refactor BIOSSettings reconciler#554
Nuckal777 merged 5 commits intomainfrom
enh/biossettings

Conversation

@afritzler
Copy link
Member

@afritzler afritzler commented Dec 8, 2025

Proposed Changes

  • Refactor BIOSSettings reconciler
  • Harmonize logging and error handling and messages
  • Factor our common helper methods
  • Improve watch setup by adding indexing fields

Copy link
Contributor

@Nuckal777 Nuckal777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, just some nitpicks.

for _, settings := range biosSettings.Spec.SettingsFlow {

duplicateName := make([]string, 0, len(settings.Spec.SettingsFlow))
duplicateSettingsNames := make([]string, 0, len(settings.Spec.SettingsFlow))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The given capacity here makes no sense. The map tracks settings, which a part of a single flow item.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

server *metalv1alpha1.Server,
) (pendingSettings redfish.SettingsAttributes, err error) {
pendingSettings, err = bmcClient.GetBiosPendingAttributeValues(ctx, server.Spec.SystemURI)
pendingSettings, err := bmcClient.GetBiosPendingAttributeValues(ctx, server.Spec.SystemURI)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the result of this function call be returned directly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment on lines +871 to +873
if len(pendingSettingsDiff) > 0 {
log.V(1).Info("Difference between the pending settings and that of required", "SettingsDiff", pendingSettingsDiff)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same check and log line happen 5 lines below. Please deduplicate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Comment on lines 1061 to 1063
func (r *BIOSSettingsReconciler) isServerInMaintenance(log logr.Logger, settings *metalv1alpha1.BIOSSettings, server *metalv1alpha1.Server) bool {
if settings.Spec.ServerMaintenanceRef == nil {
return true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming that the absence of a maintenance ref means that the server is in maintenance looks suspicious.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm yeah 🦭 I guess when the ref is nil that means false.

@afritzler
Copy link
Member Author

Thanks @Nuckal777 for the review! I addressed the issues mentioned above.

@afritzler afritzler requested a review from a team as a code owner December 12, 2025 11:58
@Nuckal777 Nuckal777 merged commit 209effe into main Dec 12, 2025
14 of 15 checks passed
@Nuckal777 Nuckal777 deleted the enh/biossettings branch December 12, 2025 12:41
@github-project-automation github-project-automation bot moved this to Done in Roadmap Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change area/metal-automation documentation Improvements or additions to documentation enhancement New feature or request size/XXL

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants