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

Bug 1866743: api: Detect spec version to serve from Accept header #1960

Merged

Conversation

LorbusChris
Copy link
Member

- What I did
Makes the API inspect the Accept header instead of the User-Agent to
derive the Ignition config spec version it has to serve.

- How to verify it
e2e CI

- Description for the changelog
api: Derive spec version to serve from Accept header instead of User-Agent

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Thanks, this looks a lot more Accept-able to me!

pkg/server/api.go Outdated Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2020
@LorbusChris LorbusChris force-pushed the api-use-accept-header branch from 33414c4 to c2412bc Compare July 29, 2020 21:15
pkg/server/api.go Outdated Show resolved Hide resolved
@cgwalters
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 29, 2020
@LorbusChris
Copy link
Member Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

pkg/server/api.go Outdated Show resolved Hide resolved
@LorbusChris
Copy link
Member Author

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 30, 2020
@LorbusChris LorbusChris force-pushed the api-use-accept-header branch from c2412bc to 6ce51c0 Compare July 30, 2020 15:53
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 30, 2020
@LorbusChris
Copy link
Member Author

fixed the comment, needs another lgtm
/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 30, 2020
@bgilbert
Copy link
Contributor

This will work for the Accept header currently generated by Ignition, but isn't really a valid Accept parser. I don't know how much that matters to us. If third-party clients (curl scripts, etc.) will also be generating headers, they may find this parser brittle.

Proposal:

  1. split on commas,
  2. stable descending sort by q factor,
  3. pick the first acceptable application/vnd.coreos.ignition+json version from the list,
  4. if we only see unacceptable application/vnd.coreos.ignition+json versions, fail,
  5. if we don't see application/vnd.coreos.ignition+json at all, return default version.

Steps 4 and 5 violate the stated intent of the header (there's a wildcard match at the end, implying that Ignition wants to receive whatever it can get, and takes responsibility for failing if it doesn't like it), but avoid having to parse wildcards.

@LorbusChris LorbusChris force-pushed the api-use-accept-header branch from 6ce51c0 to 3ab0c77 Compare August 3, 2020 15:47
@LorbusChris
Copy link
Member Author

@bgilbert I've changed this according to your proposal. PTAL

@LorbusChris LorbusChris changed the title api: Derive spec version to serve from Accept header api: Detect spec version to serve from Accept header Aug 3, 2020
@kikisdeliveryservice
Copy link
Contributor

just adding hold as we are post FF

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 3, 2020
@LorbusChris
Copy link
Member Author

It was approved before FF, does that mean it's ok to go in? Or would it have needed the lgtm as well before?

@LorbusChris
Copy link
Member Author

/retest

@kikisdeliveryservice
Copy link
Contributor

kikisdeliveryservice commented Aug 3, 2020

It was approved before FF, does that mean it's ok to go in? Or would it have needed the lgtm as well before?

A non-BZ PR needs to be final and fully approved (approved and lgtm) by the FF deadline. This only had an approved tag and also was updated/pushed to today (the 3rd day after the deadline) and requires a review.

@LorbusChris
Copy link
Member Author

This fixes wrong but working behavior. I'll create a BZ.

@kikisdeliveryservice
Copy link
Contributor

@bgilbert @cgwalters @kikisdeliveryservice thank you for the reviews! I think I've addressed all comments, PTAL :)

looks good from my perspective @LorbusChris i'll let the others verify

just please add the BZ if you'd like the hold on this removed to merge. 😸

@cgwalters
Copy link
Member

I don't see Prow enforcing the BZs right now, so IMO let's not go through the overhead of filing a new bug - this is just a bugfix to Ignition spec 3 migration right?

@kikisdeliveryservice
Copy link
Contributor

kikisdeliveryservice commented Aug 5, 2020

I don't see Prow enforcing the BZs right now, so IMO let's not go through the overhead of filing a new bug - this is just a bugfix to Ignition spec 3 migration right?

This is not about prow, Christian already said he'd be attaching a BZ. We are asking everyone to follow the rules on this to ensure we have no problems as we have been doing every release cycle.

@LorbusChris LorbusChris changed the title api: Detect spec version to serve from Accept header Bug 1866743: api: Detect spec version to serve from Accept header Aug 6, 2020
@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. label Aug 6, 2020
@openshift-ci-robot
Copy link
Contributor

@LorbusChris: This pull request references Bugzilla bug 1866743, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1866743: api: Detect spec version to serve from Accept header

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.

@openshift-ci-robot openshift-ci-robot added the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Aug 6, 2020
@LorbusChris
Copy link
Member Author

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Aug 6, 2020
@openshift-ci-robot
Copy link
Contributor

@LorbusChris: This pull request references Bugzilla bug 1866743, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

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.

@openshift-ci-robot openshift-ci-robot removed the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Aug 6, 2020
@ashcrow
Copy link
Member

ashcrow commented Aug 6, 2020

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. and removed bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. labels Aug 6, 2020
@openshift-ci-robot
Copy link
Contributor

@ashcrow: This pull request references Bugzilla bug 1866743, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

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.

@kikisdeliveryservice
Copy link
Contributor

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 6, 2020
@bgilbert
Copy link
Contributor

bgilbert commented Aug 6, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 6, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bgilbert, cgwalters, LorbusChris

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

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@yuqi-zhang
Copy link
Contributor

LGTM as well! As a follow up PR maybe it'd be nice to have a snippet in the docs to show what an example request would look like if you were to use curl yourself.

The minimum accepted header seems to be Accept: application/vnd.coreos.ignition+json; version=2.4.0 / Accept: application/vnd.coreos.ignition+json; version=3.1.0. Is that what we'd like to document this as?

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot
Copy link
Contributor

@LorbusChris: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-metal-ipi d4da744 link /test e2e-metal-ipi
ci/prow/okd-e2e-aws d4da744 link /test okd-e2e-aws
ci/prow/e2e-ovn-step-registry d4da744 link /test e2e-ovn-step-registry

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit f9ede26 into openshift:master Aug 6, 2020
@openshift-ci-robot
Copy link
Contributor

@LorbusChris: All pull requests linked via external trackers have merged: openshift/machine-config-operator#1960. Bugzilla bug 1866743 has been moved to the MODIFIED state.

In response to this:

Bug 1866743: api: Detect spec version to serve from Accept header

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.

miabbott added a commit to miabbott/machine-config-operator that referenced this pull request Aug 11, 2020
I ran into this question while verifying openshift#1960, so let's document it
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. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants