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

add support for handling plain+v0 bundle types #242

Merged

Conversation

everettraven
Copy link
Contributor

@everettraven everettraven commented May 31, 2023

Description

  • Adds logic for differentiating between plain+v0 and registry+v1 bundle formats and configuring the proper provisionerClassName for the Bundle template in the BundleDeployment.Spec.Template field.

  • Adds unit tests where necessary

  • Adds e2e tests for installing a plain+v0 bundle

  • Adds a plain+v0 bundle to the testdata catalog

  • resolves Support installation of different bundle formats #238

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 31, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 2, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 6, 2023
@everettraven everettraven force-pushed the feature/plain-bundle-support branch 2 times, most recently from a7ee2fa to 5eb8b1e Compare June 6, 2023 15:38
@everettraven everettraven marked this pull request as ready for review June 6, 2023 15:38
@everettraven everettraven changed the title WIP: add support for handling multiple bundle types add support for handling plain+v0 bundle types Jun 6, 2023
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 6, 2023
@@ -245,12 +255,13 @@ func (r *OperatorReconciler) getBundleEntityFromSolution(solution *solver.Soluti
return nil, fmt.Errorf("entity for package %q not found in solution", packageName)
}

func (r *OperatorReconciler) generateExpectedBundleDeployment(o operatorsv1alpha1.Operator, bundlePath string) *unstructured.Unstructured {
func (r *OperatorReconciler) generateExpectedBundleDeployment(o operatorsv1alpha1.Operator, bundlePath string, bundleProvisioner string) *unstructured.Unstructured {
// We use unstructured here to avoid problems of serializing default values when sending patches to the apiserver.
Copy link
Member

Choose a reason for hiding this comment

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

This isn't new code for this PR but ... why not use SSA?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it does here:

return r.Client.Patch(ctx, desiredBundleDeployment, client.Apply, client.ForceOwnership, client.FieldOwner("operator-controller"))
Although I could be misunderstanding this patch call as doing SSA and it isn't. This generateExpectedBundleDeployment is generating an unstructured.Unstructured to use for that patch request. I'd be curious to see if it is worth it to create applyconfigurations for the rukpak APIs to improve the creation of the patch information here

Copy link
Member

Choose a reason for hiding this comment

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

I'd be curious to see if it is worth it to create applyconfigurations for the rukpak APIs to improve the creation of the patch information here

We updated the generators upstream so you should get those free with newer codegen tools. I do think the apply you linked will be SSA - and the defaults worries from this block should be obviated.

Copy link
Member

Choose a reason for hiding this comment

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

Watching this closely :) kubernetes-sigs/controller-tools#818

internal/controllers/operator_controller_test.go Outdated Show resolved Hide resolved
test/e2e/install_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@anik120 anik120 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 8, 2023
Comment on lines +72 to +73
err = c.List(ctx, pList)
g.Expect(err).ToNot(HaveOccurred())
Copy link
Member

Choose a reason for hiding this comment

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

For anything that just returns an error, I find this is shorter/easier to parse:

Suggested change
err = c.List(ctx, pList)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(c.List(ctx, pList)).To(Succeed())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, missed some: 7f4c1bf

Comment on lines 39 to 41
relatedImages:
- name: ""
image: ""
Copy link
Member

Choose a reason for hiding this comment

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

We could remove this if we merge #259 first.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 8, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 8, 2023

New changes are detected. LGTM label has been removed.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 8, 2023
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 8, 2023
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
})
})
})
When("an invalid semver is provided that bypasses the regex validation", func() {
Copy link
Member

Choose a reason for hiding this comment

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

This may have been missed in the merge. I moved this in #257.

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
@joelanford joelanford merged commit 098778e into operator-framework:main Jun 8, 2023
awgreene pushed a commit to awgreene/operator-controller that referenced this pull request Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support installation of different bundle formats
5 participants