Skip to content

Add new CRDs for BIOS configuration#901

Merged
metal3-io-bot merged 1 commit intometal3-io:masterfrom
bfournie:firmwaresettings
Jul 13, 2021
Merged

Add new CRDs for BIOS configuration#901
metal3-io-bot merged 1 commit intometal3-io:masterfrom
bfournie:firmwaresettings

Conversation

@bfournie
Copy link
Copy Markdown
Member

@bfournie bfournie commented May 31, 2021

Add a new CRD for the HostFirmwareSettings for BIOS configuration as described in the spec - metal3-io/metal3-docs#173. A new CRD is necessary since its not practical to include the number of settings in BareMetalHost.
In addition a CRD is added for the FirmwareSchema used to provide a schema for setting the firmware values.

@metal3-io-bot metal3-io-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 31, 2021
@metal3-io-bot
Copy link
Copy Markdown
Contributor

Hi @bfournie. Thanks for your PR.

I'm waiting for a metal3-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@metal3-io-bot metal3-io-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 31, 2021
@bfournie bfournie force-pushed the firmwaresettings branch from e1c67be to 3f1e24d Compare May 31, 2021 17:57
@stbenjam
Copy link
Copy Markdown
Member

stbenjam commented Jun 1, 2021

/ok-to-test

@metal3-io-bot metal3-io-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 1, 2021
@bfournie bfournie force-pushed the firmwaresettings branch from 3f1e24d to 4d738ef Compare June 1, 2021 13:49
Copy link
Copy Markdown
Member

@zaneb zaneb left a comment

Choose a reason for hiding this comment

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

Note that you might need the patch from #892 to properly generate all of the files.

Comment thread config/samples/metal3.io_v1alpha1_hostfirmwaresettings.yaml Outdated
Comment thread apis/metal3.io/v1alpha1/hostfirmwaresettings_types.go Outdated
Comment thread apis/metal3.io/v1alpha1/hostfirmwaresettings_types.go Outdated
Comment thread apis/metal3.io/v1alpha1/hostfirmwaresettings_types.go Outdated
@metal3-io-bot metal3-io-bot added the needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. label Jun 7, 2021
@metal3-io-bot metal3-io-bot removed the needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. label Jun 14, 2021
@metal3-io-bot metal3-io-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 16, 2021
@bfournie bfournie changed the title Add new CRD for BIOS configuration Add new CRDs for BIOS configuration Jun 16, 2021
@elfosardo
Copy link
Copy Markdown
Member

/test-integration

@elfosardo
Copy link
Copy Markdown
Member

/lgtm

@metal3-io-bot
Copy link
Copy Markdown
Contributor

@elfosardo: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@bfournie bfournie force-pushed the firmwaresettings branch 4 times, most recently from 9afde93 to a6b9b66 Compare June 28, 2021 12:42
Comment thread apis/metal3.io/v1alpha1/firmwareschema_types.go Outdated

// The count of the number of times this schema is used by
// a HostFirmwareSettings resource
ReferenceCount int `json:"referenceCount" required:"true"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If there's a reason to have a Status it would probably be just for this. You can't write the Status atomically with creating (or updating) the resource though, so I suspect this would also do better in the Spec.
TBH I'm not entirely convinced a reference count is the best way to manage cleanup, but I'm withholding judgement on that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure can move this to Spec.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've been reading up on Garbage Collection in k8s, and I think we should be able to use the owner references to manage this automatically (saves a lot of work implementing this in the controller). You can have multiple owner references, which I didn't know before. (Only one of these can be marked as a 'controller', which is what we do for Secrets so that's what confused me. However, we don't need to do that here.)

So it's safe to ditch this field.

Comment thread apis/metal3.io/v1alpha1/hostfirmwaresettings_types.go Outdated
FirmwareSchema *SchemaReference `json:"schema,omitempty"`

// Settings are the actual firmware settings stored as name/value pairs
// +patchStrategy=merge
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is more important on the Spec than the Status.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

As per the doc, the Settings in the Status would contain all the settings read from Ironic and, upon reading, the BMO would copy these settings to the Spec but only include those that do not have the "ReadOnly" or "Unique" set in the FirmwareSchema for this setting. The Values in the Spec could then be easily updated by the user without having to change/write the Names. The BMO can compare the spec values to the expected values in the Status and only send the differences to clean steps. So with that design we'd need Settings in both places.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I meant the +patchStrategy=merge :)

Comment thread apis/metal3.io/v1alpha1/hostfirmwaresettings_types.go Outdated
@bfournie bfournie force-pushed the firmwaresettings branch 2 times, most recently from db13966 to 59df014 Compare July 2, 2021 17:23
@bfournie
Copy link
Copy Markdown
Member Author

bfournie commented Jul 3, 2021

/test-integration

@bfournie bfournie force-pushed the firmwaresettings branch from 59df014 to 0b67ebb Compare July 7, 2021 17:41
@bfournie
Copy link
Copy Markdown
Member Author

bfournie commented Jul 7, 2021

/test-integration

2 similar comments
@elfosardo
Copy link
Copy Markdown
Member

/test-integration

@bfournie
Copy link
Copy Markdown
Member Author

bfournie commented Jul 8, 2021

/test-integration

Copy link
Copy Markdown
Member

@zaneb zaneb left a comment

Choose a reason for hiding this comment

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

This looks basically good. Couple of very minor things inline.

Comment thread apis/metal3.io/v1alpha1/firmwareschema_types.go Outdated
Comment thread apis/metal3.io/v1alpha1/hostfirmwaresettings_types.go Outdated
@bfournie bfournie force-pushed the firmwaresettings branch from 0b67ebb to 9712791 Compare July 9, 2021 15:33
@metal3-io-bot metal3-io-bot added the needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. label Jul 9, 2021
@bfournie bfournie force-pushed the firmwaresettings branch from 9712791 to 9e08275 Compare July 9, 2021 15:42
@metal3-io-bot metal3-io-bot removed the needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. label Jul 9, 2021
Add a new CRD for the FirmwareSettings for BIOS configuration as described
in the spec - metal3-io/metal3-docs#173. A new
CRD is necessary since its not practical to include the number of settings
in BareMetalHost.
@bfournie bfournie force-pushed the firmwaresettings branch from 9e08275 to a425cf1 Compare July 9, 2021 15:47
@bfournie
Copy link
Copy Markdown
Member Author

bfournie commented Jul 9, 2021

/test-integration

Copy link
Copy Markdown
Member

@zaneb zaneb left a comment

Choose a reason for hiding this comment

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

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 10, 2021
Copy link
Copy Markdown
Member

@dtantsur dtantsur left a comment

Choose a reason for hiding this comment

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

/approve

Looks good to me, but please consider fixing my comments in a follow-up.

type SettingSchema struct {

// The type of setting.
// +kubebuilder:validation:Enum=Enumeration;String;Integer;Boolean;Password
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we expect to support non-Redfish implementation? If yes, we cannot add this validation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, for non-redfish types there will be no BIOS registry data returned and therefore no schema, so no validations can be done on the settings. I will note this in the CRD.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well, other drivers may decide to implement schema as well.

return false
}

if schema.ReadOnly != nil && *schema.ReadOnly == true {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if we need any logging in this function. Otherwise debugging can be challenging.

Or can we maybe return an error instead and log it somewhere at the caller place?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point about the debugging, I will add more granular debugging to help determine error in settings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Changed CheckSettingIsValid() in #938 to return an error which is now logged.

@metal3-io-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dtantsur, elfosardo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 13, 2021
@metal3-io-bot metal3-io-bot merged commit f56cd18 into metal3-io:master Jul 13, 2021
@bfournie bfournie deleted the firmwaresettings branch January 6, 2022 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants