Skip to content

Bump operator-registry dependency#2662

Closed
kevinrizza wants to merge 1 commit intooperator-framework:masterfrom
kevinrizza:update-operator-bundle-generate
Closed

Bump operator-registry dependency#2662
kevinrizza wants to merge 1 commit intooperator-framework:masterfrom
kevinrizza:update-operator-bundle-generate

Conversation

@kevinrizza
Copy link
Member

Description of the change:

*Update operator-registry dependency to 1.6.0
*Adds fix for generated dockerfiles
*Adds optional output-directory parameter

Motivation for the change:

Include fixes for operator-sdk bundle create

@Bowenislandsong
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2020
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 that it is not passing in the CI because the go.mod and .go.sum are not updated properly.
See; https://travis-ci.org/github/operator-framework/operator-sdk/jobs/663172166#L969
Note that you need to update the testdata framework too .

So, I'd recommend to you:

  • Run go mod tidy
  • Then, you need to exec the script ./hack/generate/gen-test-framework.sh to update it.

@kevinrizza kevinrizza force-pushed the update-operator-bundle-generate branch from 5a41d35 to da66ed5 Compare March 16, 2020 19:20
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2020
CHANGELOG.md Outdated
- Upgrade the Helm dependency version from `v3.0.1` to `v3.0.2`. ([#2621](https://github.com/operator-framework/operator-sdk/pull/2621))
- Changed the scaffolded `serveCRMetrics` to use the namespaces informed in the environment variable `WATCH_NAMESPACE` in the MultiNamespace scenario. ([#2603](https://github.com/operator-framework/operator-sdk/pull/2603))
- Improve skip metrics logs when running the operator locally in order to make clear the information for Helm based operators. ([#2603](https://github.com/operator-framework/operator-sdk/pull/2603))
- Bumped operator-registry dependency version to `v1.6.0` to update `bundle create` behavior. Includes adding new optional `output-dir` flag to specify a result bundle directory.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please update it as follows?

In the changes section:

- Upgrade the `operator-registry` dependency version from ` v1.5.7`to `v1.6.0` to update `bundle create` behaviour. ([#2662](https://github.com/operator-framework/operator-sdk/pull/2662)) 

In the add section:

- Add the new flag `output-dir` to the command `operator-sdk bundle create`. ([#2662](https://github.com/operator-framework/operator-sdk/pull/2662)) 

@kevinrizza kevinrizza force-pushed the update-operator-bundle-generate branch from da66ed5 to cd72770 Compare March 16, 2020 19:37
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.

I did not test it locally, would really be great we have tests implemented for it.
But it shows ok for me. @hasbro17 @estroz, wdyt?

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2020
@@ -96,7 +96,7 @@ $ operator-sdk bundle create \
defer cleanup()
Copy link
Member

Choose a reason for hiding this comment

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

These cleanup funcs assume the generated files are present in c.directory. You'll have to set the correct cleanup dir in c.cleanupFuncs():

func (c bundleCmd) cleanupFuncs() (fs []func()) {
	dir := c.outputDir
	if dir == "" {
		dir = c.directory
	}
	metaDir := filepath.Join(dir, bundle.MetadataDir)
	dockerFile := filepath.Join(dir, bundle.DockerFile)
	...
}

Copy link
Member Author

Choose a reason for hiding this comment

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

@estroz ah. so, the explicit purpose of --output-dir is to end up with a generated directory as output so that you don't have to keep generating them everytime you build. annotations.yaml is sort of supposed to be a long lived file that you can edit yourself manually.

It seems like --generate-only and --output-dir being set are either interchangeable (but with a specific dir set) OR passing the output-dir while also building would result in the files living around after you build.

IMO though it seems weird to me to generate and throw these files away all the time, given that OLM's packaging format is at some point probably going to want you to drive other stuff in the metadata/ folder (ex. https://github.com/operator-framework/enhancements/blob/master/enhancements/operator-dependency-resolution.md#dependency-specification). I had assumed that we treated the bundle command as a "run once to scaffold things" rather than something that should default to deleting stuff afterwards. Maybe we should sync up on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Also this change renames the index.Dockerfile and throws it in the same working directory as the context of where you're running the command. so if we end up wanting to clean it up, we will need to delete that file too.

@jmrodri
Copy link
Member

jmrodri commented Mar 20, 2020

@kevinrizza this is still waiting on @estroz comment to be addressed: https://github.com/operator-framework/operator-sdk/pull/2662/files#r394514725

@kevinrizza kevinrizza force-pushed the update-operator-bundle-generate branch from cd72770 to d1e7009 Compare March 23, 2020 17:39
@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm Indicates that a PR is ready to be merged. labels Mar 23, 2020
CHANGELOG.md Outdated
- Upgrade the Helm dependency version from `v3.0.1` to `v3.0.2`. ([#2621](https://github.com/operator-framework/operator-sdk/pull/2621))
- Changed the scaffolded `serveCRMetrics` to use the namespaces informed in the environment variable `WATCH_NAMESPACE` in the MultiNamespace scenario. ([#2603](https://github.com/operator-framework/operator-sdk/pull/2603))
- Improve skip metrics logs when running the operator locally in order to make clear the information for Helm based operators. ([#2603](https://github.com/operator-framework/operator-sdk/pull/2603))
- Upgrade the `operator-registry` dependency version from `v1.5.7`to `v1.6.0` to update `bundle create` behaviour. ([#2662](https://github.com/operator-framework/operator-sdk/pull/2662))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we not bump v1.6.1 already?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could but that version is a kube version bump and doesn't directly affect the registry dependency at all. I would prefer to generate a followup pr for that, especially given the context of this PR and the purpose of the discussion around it

@kevinrizza kevinrizza force-pushed the update-operator-bundle-generate branch from d1e7009 to 3bbc7cd Compare March 23, 2020 17:45
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 23, 2020
@kevinrizza
Copy link
Member Author

@jmrodri @estroz updated, ptal

@jmrodri
Copy link
Member

jmrodri commented Mar 24, 2020

@kevinrizza you've been hit by the CHANGELOG.md conflict :( please rebase

*Update operator-registry dependency to 1.6.0
*Adds fix for generated dockerfiles
*Adds optional output-directory parameter
*Update cleanup funcs to handle new structure
@kevinrizza kevinrizza force-pushed the update-operator-bundle-generate branch from 3bbc7cd to cbcdc13 Compare March 24, 2020 19:27
@kevinrizza
Copy link
Member Author

Rebased, ptal :)

if manifestDir == "" {
manifestDir = c.directory
}
absManifestDir, _ := filepath.Abs(manifestDir)
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be abs? If so import log "github.com/sirupsen/logrus" above and add:

Suggested change
absManifestDir, _ := filepath.Abs(manifestDir)
absManifestDir, err := filepath.Abs(manifestDir)
if err != nil {
log.Fatal(err)
}

metaDir := filepath.Join(manifestParent, bundle.MetadataDir)
metaExists := isExist(metaDir)

workingDir, _ := os.Getwd()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
workingDir, _ := os.Getwd()
workingDir, err := os.Getwd()
if err != nil {
log.Fatal(err)
}

@kevinrizza
Copy link
Member Author

Closing in favor of #2714 which includes the commit in this pr

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.

6 participants