-
Notifications
You must be signed in to change notification settings - Fork 290
🌱 Add validation in webhook for live-iso #2625
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
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @nerok. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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-sigs/prow repository. |
|
/ok-to-test |
tuminoid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! Some minor comments left.
internal/webhooks/metal3.io/v1alpha1/baremetalhost_validation.go
Outdated
Show resolved
Hide resolved
| if image != nil && | ||
| image.DiskFormat != nil && | ||
| *image.DiskFormat == "live-iso" && | ||
| !strings.Contains(strings.Split(bmcAddress, "://")[0], "virtualmedia") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use something like hasPrefix("redfish-virtualmedia://") , seems more robust?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a list somewhere over prefixes? because I found these in the docs:
- redfish-virtualmedia://
- idrac-virtualmedia://
- ilo5-virtualmedia://
- ilo4-virtualmedia://
and all of there can also have +http or +https.
I can probably use hasPrefix instead yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can make it work cleanly, sure, but if it gets complicated, then the current one is fine as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think another look at this improved it a lot.
Still got the "contains", but I believe the right way there would be to add SupportsVirtualmedia() to the BMCs, and call those.
I could give that a go, but it is a bit outside of the scope of this PR, and I'm uncertain if we would actually need it anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this iteration.
bd5c79c to
33cb3ba
Compare
tuminoid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/cc @zaneb @elfosardo @dtantsur
| errs = append(errs, fmt.Errorf("BMC driver %s does not support secure boot", bmcAccess.Type())) | ||
| } | ||
|
|
||
| if s.Image != nil && s.Image.DiskFormat != nil && *s.Image.DiskFormat == "live-iso" && !strings.Contains(bmcAccess.Type(), "virtualmedia") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's safe to make this assumption about the driver name.
I would expect that in practice bmcAccess.SupportsISOPreprovisioningImage() corresponds to exactly what we want to know. @dtantsur can you confirm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That worked locally atleast, pushed it up in a new version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
The one where this gives a different answer is the UEFI HTTP driver, but I am not good enough at tracing the code through ironic to say one way or the other there whether live-iso should be allowed there. (If I had to guess though, I'd say yes and that this version is correct.)
Signed-off-by: Didrik Frimann Barroso Koren <[email protected]>
33cb3ba to
0384268
Compare
| errs = append(errs, fmt.Errorf("BMC driver %s does not support secure boot", bmcAccess.Type())) | ||
| } | ||
|
|
||
| if s.Image != nil && s.Image.DiskFormat != nil && *s.Image.DiskFormat == "live-iso" && !bmcAccess.SupportsISOPreprovisioningImage() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tried this, and people complained. The thing is: technically you can boot an ISO over iPXE. It does not work with all ISO's, but apparently does work with some.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I understanding you correct in that we shouldn't have this validation at all? Or is there a part of this validation that could be valuable? If not we should ensure it is documented, and I would think a test would be nice to ensure we don't break anything at a later point?
|
PR needs rebase. DetailsInstructions 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-sigs/prow repository. |
What this PR does / why we need it:
Add a validation for live-iso to require a bmc protocol (that is the part in the address before "://") which includes "virtualmedia", which seems to be what the requirement for live-isos are according to the docs: https://book.metal3.io/bmo/live-iso
This relates to #855