Skip to content

Infer/Set Blank APIVersion - Bug 1982737 #2609

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

Closed
wants to merge 2 commits into from

Conversation

nsapse
Copy link
Contributor

@nsapse nsapse commented Feb 2, 2022

Description of the change:
This commit modifies creation of the CSV passed to ownerReferences by setting it to v1alpha1 (inferred from the fact that it is being used for all other purposes) in the case that it has been left blank in the original bundle.

Motivation for the change:
In previous versions of OLM is a user passed in a bundle missing an APIVersion the install plan would fail with a difficult to decipher message stating it had failed to create a service account for the metadata.ownerReferences.apiVersion: Invalid value: "": version must not be empty'. The original bug report asked for the following in response:

  1. For OPM index add to fail if an APIVersion had not been set in the bundle.

To enforce separation of concerns the proper place for this to fail is with Operator SDK Validate. This error is it is in fact caught properly by the SDK and fails at that stage as expected.

  1. For the InstallPlan to fail with a message pointing the user to an error in the bundle's CSV.

Rather than update the error message this change fixes the underlying issue preventing the InstallPlan from failing.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive

@openshift-ci
Copy link

openshift-ci bot commented Feb 2, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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-ci openshift-ci bot requested review from ecordell and joelanford February 2, 2022 16:53
@openshift-ci
Copy link

openshift-ci bot commented Feb 2, 2022

Hi @nsapse. Thanks for your PR.

I'm waiting for a operator-framework 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.

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 openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 2, 2022
@nsapse nsapse force-pushed the Bug_1982737 branch 2 times, most recently from ff66a04 to 852aa6c Compare February 2, 2022 17:11
@tylerslaton
Copy link
Contributor

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 2, 2022
This commit modifies creation of the CSV passed to ownerReferences
by setting it to v1alpha1 (inferred from the fact that it is being
used for all other purposes) in the case that it has been left blank
in the original bundle.

Signed-off-by: Noah Sapse <[email protected]>
@benluddy
Copy link
Contributor

benluddy commented Feb 7, 2022

What happens if the manifest was intended to represent a v2beta3 CSV? Say there were some new fields added -- wouldn't they have been lost during unmarshaling into the v1alpha1 struct? An error is desirable here.

@njhale
Copy link
Member

njhale commented Feb 7, 2022

/hold

Just had a long conversation with @benluddy about this and I agree that we shouldn't infer the version is v1alpha1.

I originally suggested inference on the false assumption that a bundle could be installed today w/o the CSV version field. As it turns out, most -- I really think all -- bundles that don't specify the CSV version would cause the InstallPlan to fail on the same ownerreference issue. This means backwards compatibility is no longer a problem for solutions that don't support unspecified versions.

That being said, instead of inferring the version, I think we should fail InstallPlans earlier in their execution and output a more helpful message to their status when we notice an unspecified version. We should already be doing this for resources that use the dynamic (untyped) client (so switching to that for POSTing CSV could be helpful too).

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 7, 2022
@nsapse nsapse closed this Feb 23, 2022
@nsapse
Copy link
Contributor Author

nsapse commented Feb 23, 2022

Per conversation above PR has been closed in favor of working on an alternate solution in PR#2673

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants