Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

root device hints #495

Merged
merged 4 commits into from
Jun 2, 2020
Merged

Conversation

dhellmann
Copy link
Member

@dhellmann dhellmann commented Apr 29, 2020

This supercedes #442

Add a new field spec.rootDeviceHints to the API with sub-fields for different types of hints based on what Ironic supports today.

Add a new field status.rootDeviceHints to record the values used when provisioning the host.

Change the Provisioner API to return the new public struct with the more detailed device hints so that the values in the hard-coded profiles can be stored directly in the new status field.

If the user does not provide explicit hints, use the values from the profile.

Implements https://github.com/metal3-io/metal3-docs/blob/master/design/user-defined-root-device-hints.md

@metal3-io-bot metal3-io-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 29, 2020
@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dhellmann

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

The pull request process is described here

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 29, 2020
@mikkosest
Copy link
Contributor

Looks good, I guess unit test updates in the same PR?

@dhellmann
Copy link
Member Author

Looks good, I guess unit test updates in the same PR?

Yes, we'll want that.

Given some of the other work I did last week on #434 I think we're going to want to add these new features to the next API version (v1alpha2 or v1beta1) after we have the CI fixes like #504 in place.

@maelk
Copy link
Member

maelk commented May 5, 2020

This should be backward compatible, no ? we should be able to add it without waiting for the next version. I am not sure I get the reason for postponing it.

@dhellmann
Copy link
Member Author

This should be backward compatible, no ? we should be able to add it without waiting for the next version. I am not sure I get the reason for postponing it.

The validation for updating the CRD is broken. I think we should prioritize fixing that over extending the API further so that when we do work on the API changes we can trust that we're making all of the necessary changes. That doesn't necessarily assume waiting for the next API version, but since I plan to do that right away as part of fixing the current issue (see #434 for the todo list) I don't think the wait will be very long.

@maelk
Copy link
Member

maelk commented May 6, 2020

ok, that's good! thank you

@derekhiggins
Copy link
Member

I posted this in the other PR but not sure if anybody saw it

I've pushed up a related PR for masters to the installer repository
openshift/installer#3348

It suggests a simpler roothint pass through approach, would it be worth considering and allowing ironic to do the validation?

I'm worried this functionality will need to be duplicated(in the installer and in ironic itself) for provisioning master nodes is that the case? and if so could we just passthrough of the json to ironic?

@dhellmann
Copy link
Member Author

I posted this in the other PR but not sure if anybody saw it

I've pushed up a related PR for masters to the installer repository
openshift/installer#3348
It suggests a simpler roothint pass through approach, would it be worth considering and allowing ironic to do the validation?

I'm worried this functionality will need to be duplicated(in the installer and in ironic itself) for provisioning master nodes is that the case? and if so could we just passthrough of the json to ironic?

Yes, the OpenShift installer is going to need to do its own thing. We should talk about that over on that PR, since it's not really relevant to metal3 upstream.

@dhellmann dhellmann changed the title WIP: root device hints root device hints May 29, 2020
@metal3-io-bot metal3-io-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 29, 2020
@dhellmann
Copy link
Member Author

/test-integration

@dhellmann dhellmann requested a review from yrobla May 29, 2020 16:06
pkg/provisioner/ironic/ironic.go Outdated Show resolved Hide resolved
pkg/controller/baremetalhost/baremetalhost_controller.go Outdated Show resolved Hide resolved
pkg/apis/metal3/v1alpha1/baremetalhost_types.go Outdated Show resolved Hide resolved
@dhellmann dhellmann force-pushed the root-device-hints branch 2 times, most recently from 530c040 to df37555 Compare May 29, 2020 18:57
Copy link
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.

Looks basically good

pkg/controller/baremetalhost/baremetalhost_controller.go Outdated Show resolved Hide resolved
pkg/controller/baremetalhost/baremetalhost_controller.go Outdated Show resolved Hide resolved
pkg/controller/baremetalhost/baremetalhost_controller.go Outdated Show resolved Hide resolved
Add a new field spec.rootDeviceHints to the API with sub-fields for
different types of hints based on what Ironic supports today.

Add a new field status.rootDeviceHints to record the values used when
provisioning the host.

Change the Provisioner API to return the new public struct with the
more detailed device hints so that the values in the hard-coded
profiles can be stored directly in the new status field.

If the user does not provide explicit hints, use the values from the
profile.

Implements https://github.com/metal3-io/metal3-docs/blob/master/design/user-defined-root-device-hints.md

Co-Authored-By: Mika Koskimaki <mika.koskimaki@est.tech>
Co-Authored-By: Doug Hellmann <dhellmann@redhat.com>
Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
@maelk
Copy link
Member

maelk commented Jun 1, 2020

/test-integration

@maelk
Copy link
Member

maelk commented Jun 1, 2020

that looks good to me

@dhellmann
Copy link
Member Author

I need to update the API docs.

/hold

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 1, 2020
@dhellmann
Copy link
Member Author

/hold cancel

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 1, 2020
@dhellmann
Copy link
Member Author

/test-integration

Add a missing reference to the hardwareProfile in the spec section so
that we can include a deprecation warning.

Add missing fields in the provisioning status section so that we can
extend it with the root device hints field.

Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
@dhellmann
Copy link
Member Author

/test-integration

type: string
sizeGigabytes:
description: Size of the device in Gigabytes
type: integer
Copy link
Member

Choose a reason for hiding this comment

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

In ironic this may include an operator, like ">= 4". I think it makes sense to support it here as well, wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

What is the default behavior if only a number is provided?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should have minSizeGigabytes and maxSizeGigabytes.
I agree it's a bit hard on the user forcing them to guess the exact integral number of gigabytes that the disk size will be rounded to.

Copy link
Member

Choose a reason for hiding this comment

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

Strict equality (yeah, not exactly convenient).

Copy link
Member Author

Choose a reason for hiding this comment

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

Having 2 fields makes sense. That's more in line with what we've done in other similar APIs where we don't want to embed expressions in fields.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not clear that we can support both min and max at the same time. I have renamed the field to MinSizeGigabytes and updated the behavior to always include >= in the value sent to ironic. If we can have an expression with both >= and <= then we can add a MaxSizeGigabytes field as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

This also raises the question of what operators we should be assuming for the other fields. And whether we need to allow variations.

Copy link
Member Author

Choose a reason for hiding this comment

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

The latest version sets an explicit operator for each value we pass to ironic and does not allow the operators to be modified.

Copy link
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.

I agree with Dmitry's comment, but other than that this looks ready to go.

type: string
sizeGigabytes:
description: Size of the device in Gigabytes
type: integer
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should have minSizeGigabytes and maxSizeGigabytes.
I agree it's a bit hard on the user forcing them to guess the exact integral number of gigabytes that the disk size will be rounded to.

The default for ironic is to treat the value as an exact match, but we
want to use it as a minimum value. Rename the field and update the
code that produces the map to send to the ironic API to always add the
'>=' operator.

Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
@dhellmann
Copy link
Member Author

/test-integration

Instead of relying on ironic's default behavior, pass explicit
operators with each hint.

Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
@dhellmann
Copy link
Member Author

/test-integration

Copy link
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

SerialNumber string `json:"serialNumber,omitempty"`

// The minimum size of the device in Gigabytes.
MinSizeGigabytes int `json:"minSizeGigabytes,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that omitempty does anything unless this is a pointer.
Because it's MinSize it doesn't matter that the default is 0 though, so maybe we don't care.

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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants