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 KEP-19 by distinguishing between app and operator version #1257

Merged
merged 6 commits into from
Jan 10, 2020

Conversation

nfnt
Copy link
Member

@nfnt nfnt commented Jan 9, 2020

What this PR does / why we need it:
The app version of an operator package is taken into account using operations that apply to packages. E.g., when installing a package, a user is able to provide a specific app version to install. To further distinguish app version and operator version, the 'version' field in operator packages and the package index has been renamed to 'operatorVersion'.
Package version resolution has been updated to take the app version into account; operator packages are first sorted by app version, then sorted by operator version. Furthermore, the app version is added to the package tarball name to avoid conflicts.

Notes for reviewers:
Most of the changes update the existing tests and their test data. Functional changes are:

  • Update CLI commands to have app-version and operator-version flags
  • Update package resolvers to take app version into account
  • Update the tarball writer and repo index to include app version in tarball names
  • Update the PackageVersions struct to be sorted first by app version, then by operator version

The app version of an operator package is taken into account using operations that apply to packages. E.g., when installing a package, a user is able to provide a specific app version to install. To further distinguish app version and operator version, the 'version' field in operator packages and the package index has been renamed to 'operatorVersion'.
Package version resolution has been updated to take the app version into account; operator packages are first sorted by app version, then sorted by operator version. Furthermore, the app version is added to the package tarball name to avoid conflicts.
@nfnt nfnt added the kep/19 label Jan 9, 2020
@nfnt nfnt self-assigned this Jan 9, 2020
@nfnt nfnt marked this pull request as ready for review January 9, 2020 09:46
@nfnt
Copy link
Member Author

nfnt commented Jan 9, 2020

The part of the E2E test that tests the current operators repository is expected to fail because the repository needs to be updated to reflect that version has been renamed to operatorVersion.

Copy link
Contributor

@zen-dog zen-dog left a comment

Choose a reason for hiding this comment

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

Aside from a few nits, my only point would be using _ vs. - in url/tarbal names. Though not strictly necessary, we should make our lives easier and use _ since - can be part of SemVer.

pkg/kudoctl/cmd/package_list_plans.go Outdated Show resolved Hide resolved
pkg/kudoctl/cmd/package_list_plans.go Outdated Show resolved Hide resolved
pkg/kudoctl/cmd/upgrade.go Outdated Show resolved Hide resolved
pkg/kudoctl/cmd/upgrade.go Outdated Show resolved Hide resolved
pkg/kudoctl/packages/resolver/resolver.go Outdated Show resolved Hide resolved
pkg/kudoctl/packages/writer/writer_tar.go Outdated Show resolved Hide resolved
pkg/kudoctl/util/repo/index.go Outdated Show resolved Hide resolved
pkg/kudoctl/util/repo/index.go Show resolved Hide resolved
pkg/kudoctl/util/repo/index.go Outdated Show resolved Hide resolved
Jan Schlicht and others added 2 commits January 9, 2020 12:31
Co-Authored-By: Aleksey Dukhovniy <adukhovniy@mesosphere.io>
@nfnt nfnt requested a review from zen-dog January 9, 2020 11:50
Copy link
Contributor

@zen-dog zen-dog left a comment

Choose a reason for hiding this comment

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

Lgtm!

  ________
< Ship it! >
  --------
         \   ^__^ 
          \  (oo)\_______
             (__)\       )\/\
                 ||----w |
                 ||     ||

Copy link
Member

@kensipe kensipe left a comment

Choose a reason for hiding this comment

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

we have to fix the issue with - vs _ before it this can be merged

pkg/kudoctl/packages/writer/writer_tar.go Show resolved Hide resolved
return versionX.LessThan(versionY)
}

return appVersionX.LessThan(appVersionY)
Copy link
Member

Choose a reason for hiding this comment

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

I feel we should have a number of tests around this. This is more complex than it was originally.

Copy link
Member

Choose a reason for hiding this comment

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

I still feel this is true... but approving with the assumption that it will happen or will have an issue created to do it.

Copy link
Member Author

@nfnt nfnt Jan 10, 2020

Choose a reason for hiding this comment

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

I added some additional test cases to TestParseIndexFile in index_test.go. But looking at it again, it doesn't test this particular code path. I'll add more entries to the test index to make sure that every case is covered. Looked at it again, all cases are covered, this particular line it tested by

	assert.Equal(t, "2.3.0", index.Entries["kafka"][0].AppVersion, "kafka app version")
	assert.Equal(t, "0.2.0", index.Entries["kafka"][0].OperatorVersion, "kafka operator version")
	assert.Equal(t, "2.2.1", index.Entries["kafka"][1].AppVersion, "kafka app version")
	assert.Equal(t, "0.2.0", index.Entries["kafka"][1].OperatorVersion, "kafka operator version")

in TestParseIndexFile.

@kensipe
Copy link
Member

kensipe commented Jan 9, 2020

locally TestAddContainers failed in integration-tests

@kensipe
Copy link
Member

kensipe commented Jan 9, 2020

this resulted in a package named Package created: /Users/kensipe/repo/cassandra-3.11.4_.tgz :(

@kensipe
Copy link
Member

kensipe commented Jan 9, 2020

it's the operators fault! on it.

Signed-off-by: Ken Sipe <kensipe@gmail.com>
Copy link
Member

@kensipe kensipe left a comment

Choose a reason for hiding this comment

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

looks good in general.. nice work!

I would love to see more tests around packageversion equality.

Created new 0.10.0 repo... not all the operators serialize. We need to talk about what will be in the repo. It is understandable that older versions with older formats remain (in that long term that is what we want). however the older kudo can't read the newer index and the new kudo can read the older operator formats. They need to be pruned.

List of what didn't make it:

  • flink 0.1.0
  • flink-demo 0.1.1
  • kafka 0.1.0, 0.1.2, 0.2.0
  • zookeeper 0.1.0

What is there needs to have the operator version incremented... but as mentioned, the older version doesn't make sense to continue to include IMO. We can talk about it.

new repo: https://kudo-repository.storage.googleapis.com/0.10.0

@nfnt
Copy link
Member Author

nfnt commented Jan 10, 2020

Thanks @kensipe for taking care of providing a new repository!
Is there a branch for this in the operators repo? Asking because the e2e tests currently check out master of operators and tests the operators. As the operator definitions aren't compatible with the changes of this PR, the E2E tests currently fail. Do you plan to update the operators repo once this PR has landed?

@nfnt nfnt force-pushed the nfnt/kep19-impl branch 2 times, most recently from 13f496f to 494dbc6 Compare January 10, 2020 16:11
@kensipe
Copy link
Member

kensipe commented Jan 10, 2020

e2e test failing due to out of sync operator repo. fixed with kudobuilder/operators#184

rerunning tests after merge

@kensipe kensipe merged commit d2310b1 into master Jan 10, 2020
@kensipe kensipe deleted the nfnt/kep19-impl branch January 10, 2020 17:46
ANeumann82 pushed a commit that referenced this pull request Feb 13, 2020
…1257)

The app version of an operator package is taken into account using operations that apply to packages. E.g., when installing a package, a user is able to provide a specific app version to install. To further distinguish app version and operator version, the 'version' field in operator packages and the package index has been renamed to 'operatorVersion'.
Package version resolution has been updated to take the app version into account; operator packages are first sorted by app version, then sorted by operator version. Furthermore, the app version is added to the package tarball name to avoid conflicts.

Co-authored-by: Aleksey Dukhovniy <adukhovniy@mesosphere.io>
Co-authored-by: Ken Sipe <kensipe@gmail.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants