Skip to content

Assume host is unavailable until inspection is done.#740

Closed
s3rj1k wants to merge 1 commit intometal3-io:masterfrom
s3rj1k:master
Closed

Assume host is unavailable until inspection is done.#740
s3rj1k wants to merge 1 commit intometal3-io:masterfrom
s3rj1k:master

Conversation

@s3rj1k
Copy link
Copy Markdown
Member

@s3rj1k s3rj1k commented Dec 7, 2020

Signed-off-by: seivanov seivanov@mirantis.com

Signed-off-by: seivanov <seivanov@mirantis.com>
@metal3-io-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: s3rj1k
To complete the pull request process, please assign maelk
You can assign the PR to them by writing /assign @maelk in a comment when ready.

The full list of commands accepted by this bot can be found 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 size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 7, 2020
@metal3-io-bot
Copy link
Copy Markdown
Contributor

Hi @s3rj1k. 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.

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Dec 7, 2020

/assign @maelk

@dhellmann
Copy link
Copy Markdown
Member

I'm not sure this is the right place to be making the decision. We probably shouldn't have that Available() method at all, since it should be up to the user of the API to decide which hosts it thinks are usable. The host has a status field now that it didn't have before, so we could change CAPM3 to look at that, like we do in CAPBM.

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Dec 7, 2020

@dhellmann Currently there is also a similar check in https://github.com/metal3-io/baremetal-operator/blob/master/apis/metal3.io/v1alpha1/baremetalhost_types.go#L744

Removing Available() can possible break integration with third-party users of BM-operator.

Can we do this check in BM-operator?

CAPM3: https://github.com/metal3-io/cluster-api-provider-metal3/blob/master/baremetal/metal3machine_manager.go#L785

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Dec 7, 2020

How about calling NeedsHardwareInspection() method from within Avaliable() method?

@dhellmann
Copy link
Copy Markdown
Member

@dhellmann Currently there is also a similar check in https://github.com/metal3-io/baremetal-operator/blob/master/apis/metal3.io/v1alpha1/baremetalhost_types.go#L744

Removing Available() can possible break integration with third-party users of BM-operator.

Can we do this check in BM-operator?

CAPM3: https://github.com/metal3-io/cluster-api-provider-metal3/blob/master/baremetal/metal3machine_manager.go#L785

What I'm proposing is that we properly separate the concerns. The Available() method is from a time when I had not thought through the implications of having the host type control when provisioning could be requested. That's not really its job, though.

We should deprecate Available() and change metal3machine_manager.go to perform all of the checks it wants. Then, if we decide CAPM3 should not provision a host until after inspection we can apply that rule there without forcing it on other consumers.

It's not clear, though, why we consider the availability of a host related to whether inspection has been performed. The baremetal-operator will just wait to provision the host if the image settings are applied before inspection.

@dhellmann
Copy link
Copy Markdown
Member

See metal3-io/cluster-api-provider-metal3#150 and #741 instead.

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Dec 7, 2020

The idea to have one single method to check in CAPM3 (or possible forks) versus multiple of aggregated methods.

It seems that providing a single method to check availability is more convenient.

@dhellmann
Copy link
Copy Markdown
Member

The idea to have one single method to check in CAPM3 (or possible forks) versus multiple of aggregated methods.

It seems that providing a single method to check availability is more convenient.

Well, you're adding a rule that I don't think we want in CAPBM, so it's not actually convenient. :-)

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Dec 7, 2020

@dhellmann Please do not close this PR before a merge of
metal3-io/cluster-api-provider-metal3#150
#741

@zaneb
Copy link
Copy Markdown
Member

zaneb commented Dec 8, 2020

The provisioning state is a far superior way of determining whether a host can be provisioned than the hardware details.
If we're going to decide for people what available means, we should expose it to the k8s API as a condition in the CRD, not as a golang function. We probably should never have implemented methods on the BareMetalHost struct.
I actually don't have a problem with just deleting those methods. It won't break anybody immediately, only when they re-vendor. I don't recall us promising anywhere that we would keep this stuff stable so that you can always re-vendor without changes, so it's fair game.

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Dec 8, 2020

@zaneb Still feels bad that there is no promise of stable API

@dhellmann
Copy link
Copy Markdown
Member

@zaneb Still feels bad that there is no promise of stable API

The API is the CRD, and that's not changing, right?

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Dec 8, 2020

@zaneb Still feels bad that there is no promise of stable API

The API is the CRD, and that's not changing, right?

API on a level of k8s indeed does not change, but on a golang level (when some one imports code) it does change.

@zaneb
Copy link
Copy Markdown
Member

zaneb commented Dec 8, 2020

@zaneb Still feels bad that there is no promise of stable API

In the golang ecosystem not even actual libraries offer stable APIs, let alone internal implementations that were never designed to be used as libraries.

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Dec 8, 2020

@zaneb Still feels bad that there is no promise of stable API

In the golang ecosystem not even actual libraries offer stable APIs, let alone internal implementations that were never designed to be used as libraries.

Well this is a matter of declaring this officially, do any of metal3 projects have this declared somewhere?
Maybe I missed something when reading docs?

Also they do say to vendor, this is ok when they do frequent tag releases.

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Dec 8, 2020

I think we should create a separate issue about tag releases and vendoring.

What do you all think?

@dhellmann @zaneb @maelk

@dhellmann
Copy link
Copy Markdown
Member

I have no problem with tagging more releases. But yes, let's discuss that elsewhere.

@s3rj1k
Copy link
Copy Markdown
Member Author

s3rj1k commented Jan 18, 2021

#740 (comment)

@s3rj1k s3rj1k closed this Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants