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

✨ Implement API version negotiation #1435

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

dtantsur
Copy link
Member

@dtantsur dtantsur commented Nov 7, 2023

Rather than bumping the microversion every time we need new features,
we will keep the baseline version and try to negotiate a higher version
in the provisioner. The new AvailableFeatures object provides
information about the supported features.

Includes:

In preparation for the future microversion negotiation handling:
1) Remove the unnecessary ironicDependenciesChecker abstraction.
   It probably made more sense when Inspector was used explicitly.
2) Change tests to make Ready the default state (and NotReady
   an explicit override for the few tests that need it).
Rather than bumping the microversion every time we need new features,
we will keep the baseline version and try to negotiate a higher version
in the provisioner. The new AvailableFeatures object provides
information about the supported features.
@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 7, 2023
@dtantsur
Copy link
Member Author

dtantsur commented Nov 8, 2023

/test-centos-e2e-integration-main
/test-ubuntu-integration-main

@tuminoid
Copy link
Member

/cc @lentzi90 @kashifest

Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

Exciting! 🤩

// NOTE: Some versions of Ironic inspector returns 404 for /v1/ but 200 for /v1,
// which seems to be the default behavior for Flask. Remove the trailing slash
// from the client endpoint.
endpoint := strings.TrimSuffix(client.Endpoint, "/")
Copy link
Member

Choose a reason for hiding this comment

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

Is it certain that removing this will not cause any issues? Could there be users relying on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

From the Ironic's perspective, these URLs are identical (inspector did have this bug at some point). What scenario do you have in mind?

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 just wondering why this was here to begin with and why it would be safe to remove it now. Sounds like the answer to the first question is that inspector had a bug. Then the question remains, can we be certain that no user is running a version of inspector that is affected?
I guess this is old enough that anyone still using an affected inspector would be out of support anyway :)

Copy link
Member Author

Choose a reason for hiding this comment

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

BMO no longer accesses Inspector directly, so it does not matter which version a user is running. It's between Ironic and Inspector now.

Copy link
Member

Choose a reason for hiding this comment

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

Right! I forgot about that!
Nothing to see here, move along 😄

Copy link
Member

@iurygregory iurygregory left a comment

Choose a reason for hiding this comment

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

In general lgtm, left a comment regarding one function name.

logger.Info("supported Ironic API features",
"maxVersion", fmt.Sprintf("1.%d", af.MaxVersion),
"chosenVersion", af.ChooseMicroversion(),
"firmwareUpgrades", af.HasFirmwareUpgrades())
Copy link
Member

Choose a reason for hiding this comment

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

Maybe rename to HasFirmwareUpdates ?- since the interface can be used to upgrade and downgrade firmware

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking that the log messages would read like .. "supported Ironic API features ... firmwareUpgrades = true". WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

I think this could me miss interpreted (they would think they can only use to Upgrade firmware, if they had to downgrade maybe they would do manually before using BMO? Updates make more sense I think..)

Copy link
Member Author

Choose a reason for hiding this comment

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

Feel free to adjust the namings in your patch to make them consistent with what you propose.

Copy link
Member

Choose a reason for hiding this comment

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

Awesome! Tks @dtantsur

Copy link
Member

@lentzi90 lentzi90 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 Nov 20, 2023
@honza
Copy link
Member

honza commented Nov 20, 2023

/approve

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: honza

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 20, 2023
@tuminoid
Copy link
Member

/retest

2 similar comments
@lentzi90
Copy link
Member

/retest

@lentzi90
Copy link
Member

/retest

@metal3-io-bot metal3-io-bot merged commit 5d71e71 into metal3-io:main Nov 21, 2023
13 checks passed
@dtantsur dtantsur deleted the negotiation branch November 21, 2023 11:18
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants