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

internal/: use operator-registry's PackageManifest type #1900

Merged

Conversation

estroz
Copy link
Member

@estroz estroz commented Sep 10, 2019

Description of the change: use operator-registry's PackageManifest type over OLM's.

Motivation for the change: OLM's PackageManifest type is used for display purposes, while operator-registry's is used for (un)marshalling package manifests.

@estroz estroz added the area/dependency Issues or PRs related to dependency changes label Sep 10, 2019
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 10, 2019
)

func ValidatePackageManifest(pm *olmregistry.PackageManifest) error {
func ValidatePackageManifest(pm *registry.PackageManifest) error {
Copy link
Contributor

@camilamacedo86 camilamacedo86 Sep 11, 2019

Choose a reason for hiding this comment

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

Are we duplicating the impl of the OLM object struct? Should not be better we use the object from OLM in order to keep the impl centralized there? If something in this struct changed then will not be required replicated the same impl for here?

Copy link
Member

Choose a reason for hiding this comment

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

This is covered in the PR description I think:

OLM's PackageManifest type is used for display purposes, while operator-registry's is used for (un)marshalling package manifests.

Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT about we add comments in the code in order to make clear this diff purposes? Something that could help to avoid the same happened again( i mean the olmregistry.PackageManifest be used instead of registry.PackageManifest)

{Name: "foo", CurrentCSVName: "bar"},
}
pm := &olmregistry.PackageManifest{
pm := &registry.PackageManifest{
Copy link
Contributor

Choose a reason for hiding this comment

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

It shows not be the same object impl here:

Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT about changing the name in SDK to reflect more why it is required here and make clear that both are not the same struct/object?

Copy link
Member

Choose a reason for hiding this comment

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

IMO, our PackageManifest struct name is the best name to use since it follows the same pattern as structs for other scaffolded files. It's package path makes it clear enough (to me at least) what its intended purpose is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @joelanford,

I understand why would you prefer keeping the same name. Just to clarifies, I was just wondering if we could make it more clear in order to avoid the same mistake that this Pr has the goal of a fix happened again.

Shows that it is very susceptible to face the same mistake, I mean another dev at any moment use one struct when would like to use another one since the SDK project is importing OLM at the end the dev will face 2 objects with the same name but with different purposes which shows be reducing the manutence ability.

Copy link
Member

Choose a reason for hiding this comment

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

I see your point, but in this particular case, I don't think it's a concern because:

  • its in a scaffold directory tree making its purpose and use fairly clear
  • its internal, so it can only be imported in other SDK packages
  • its fields are different than the OLM and operator-registry versions of these structs, another indication that it has a different purpose.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is ok. Tks for share your inputs as well.

Copy link
Member

@joelanford joelanford 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-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 11, 2019
@estroz
Copy link
Member Author

estroz commented Sep 11, 2019

/test e2e-aws-helm
/test e2e-aws-go
/test e2e-aws-subcommand

@estroz estroz merged commit c084b57 into operator-framework:master Sep 12, 2019
@estroz estroz deleted the olm-update-type-packagemanifest branch September 12, 2019 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dependency Issues or PRs related to dependency changes lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants