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

[olm-cmd] Package SDK with a default version of OLM #3297

Conversation

varshaprasad96
Copy link
Member

@varshaprasad96 varshaprasad96 commented Jun 26, 2020

Description of the change:
This PR uses go-bindata to embed the default version (most recent successful release) of
OLM manifests when user does not have any preference, so that SDK need not fetch
the manifests from github everytime.
The OLM manifests in this PR have the version "v0.15.1". With every
release of SDK, olm-bindata-vX.X.X.go needs to be updated
with the most successful released version of OLM manifests.

Motivation for the change:
Packaging the most successful released version of OLM along with SDK,
so that for every install the manifests need not be fetched from GitHub. This
will also help in avoiding errors when the "latest" tagged version of OLM has some
problems after its release.

@varshaprasad96
Copy link
Member Author

@estroz @camilamacedo86 @joelanford
This PR also addresses the issue #3095 . If we intend to follow this approach, these are few other suggestions:

  1. Can we have a script during release process, which updates olm-bindata with the most successfully released version (tagged "latest") of OLM. If we decide to do so, when do we plan to update the default OLM version - only with major releases of SDK, or even minor release (if a new OLM release falls in-between).
  2. Could we include in every release note of SDK the particular version of OLM being included? (ie here)
  3. The release process may also need to be updated to include an additional step that the person performing the release should check whether the "latest" release of OLM was successful. For example, something like 0.15.0 should not be shipped with SDK.

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.

Can we include the generation of the bindata file in the normal build process? (e.g. with a new gen-bindata target that the build/* and install targets depend on)?

cmd/operator-sdk/olm/install.go Outdated Show resolved Hide resolved
internal/olm/client.go Outdated Show resolved Hide resolved
internal/olm/client.go Outdated Show resolved Hide resolved
internal/olm/manager.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jmccormick2001 jmccormick2001 left a comment

Choose a reason for hiding this comment

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

apart from Joe's comments, this tested out ok on my local dev box, seems to work...I guess the changelog fragment for this is all I can think of that might be necessary.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 2, 2020
@@ -31,8 +31,10 @@ require (
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.5.1
go.uber.org/zap v1.14.1
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not need usually add the indirect. could you please remove and run go mod tidy to check?

Copy link
Member Author

Choose a reason for hiding this comment

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

I ran go mod tidy, still they persist.

Copy link
Contributor

Choose a reason for hiding this comment

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

The go mod tidy sometimes do not remove. You can remove manually and then run go mod tidy to ensure.
You can also run go mod why golang.org/x/lint v0.0.0-20200302205851-738671d3881b. If its output contains (main module does not need package v0.0.0-20200302205851-738671d3881b) it can be removed safely.

This PR uses go-bindata to embed a default version of OLM, when
user does not have any preference, so that SDK need not fetch
the manifests from github everytime.
The OLM manifests in this PR have the version "v0.15.1". With every
release SDK the olm-bindata-vX.X.X.go intends to be updated
with the most successful released version of OLM manifests.
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 8, 2020
@varshaprasad96
Copy link
Member Author

@joelanford @camilamacedo86 @estroz Made modifications as suggested and added relevant documentation. Please have a look.

modify default OLM version and update manifests accordingly.
kind: "addition"
# Is this a breaking change?
breaking: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Why it is a breaking change? If yes, then it is missing the steps that should be used in the migration guide.

Comment on lines +68 to +69
The default version which is installed in the cluster, can be specified in the `Makefile`. The OLM manifests for the default version specified in the Makefile are pre-fetched and present inside the SDK repository as Go source code. Modifying the `OLM_VERSION` variable in Makefile and running `make olm-manifests` will update the current source code file `internal/olm/olm-bindata-x.x.x`, where `x.x.x` refers to the specified version of OLM manifests.

Copy link
Contributor

Choose a reason for hiding this comment

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

The default version which is installed in the cluster, can be specified in the Makefile

How users can specify in their project Makefile the default OLM version? It is specified in the SDK's project Makefile and shipped with its binary. Users have not the SDK Makefile.

Note that end-users have not the make olm-manifests. It can be part of the contributions guide but not of the user-guide.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, you're right. This doesn't seem to be the right place. Would it be suitable to include this in developers guide instead?

Copy link
Member

Choose a reason for hiding this comment

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

The developer guide makes sense to me.

@@ -19,7 +19,7 @@ operator-sdk olm install [flags]
-h, --help help for install
--olm-namespace string namespace where OLM is to be installed. (default "olm")
--timeout duration time to wait for the command to complete before failing (default 2m0s)
--version string version of OLM resources to install (default "latest")
--version string version of OLM resources to install; non-defaultversions are downloaded from GitHub.
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 not very clear for me.

Suggested change
--version string version of OLM resources to install; non-defaultversions are downloaded from GitHub.
--version string version of OLM resources to install. Note that, if this value is informed then the installation will be made via the manifests which are downloaded from the OLM repository E.g <add example>.

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 rather keep this short:

Suggested change
--version string version of OLM resources to install; non-defaultversions are downloaded from GitHub.
--version string version of OLM resources to install (from a Github release); if not set, a pre-packaged OLM version will be installed

Also we can set this default using the internally-set OLM version.

@@ -0,0 +1,7 @@
entries:
- description: >
Include a default version of OLM manifests with SDK. Add Makefile target to enable users to
Copy link
Contributor

Choose a reason for hiding this comment

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

The Makefile target added is SDK and the user's projects scaffolded was not changed at all. So, this description is not accurate.

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

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

the hack/lib/ is used to add libs which are valid for others scripts. E.g common.sh which is imported in other scripts and has methods which are helpers.

Otherwise, this script is used to gen/build the OLM manifests. Am I right?
So, it should not be in the /hack/lib/. IMO it would be in hack/generate and might should not better a name as generate_olm_manifests.sh?

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

See the comments.

filename="olm-bindata-"$1.go
echo $filename

function get_olm_manifests() {
Copy link
Member

Choose a reason for hiding this comment

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

This function should default to getting the latest release of OLM. If a broken OLM release occurs, we can simply not update bindata or pin to a later non-broken release.

Copy link
Member Author

Choose a reason for hiding this comment

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

@joelanford had suggested that instead of defaulting to the latest release always, it would be better if we could control the version of OLM which is going to get packaged with SDK. It would be a part of release process (an additional step) to run make olm-manifests to update the latest release we want to include after checking that it isn't broken.

@openshift-ci-robot
Copy link

@varshaprasad96: PR needs rebase.

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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 11, 2020
@varshaprasad96
Copy link
Member Author

Closing this PR in favor of #3906

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants