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

operator-sdk cleanup: remove packagemanifests, add generic command #3644

Merged
merged 17 commits into from
Aug 5, 2020

Conversation

joelanford
Copy link
Member

@joelanford joelanford commented Aug 4, 2020

Description of the change:

  • Removes operator-sdk cleanup packagemanifests <packageManifestsDir>
  • Adds operator-sdk cleanup <packageName>
  • Updates operator-sdk run packagemanifests to include owner reference on catalog source resources

Motivation for the change:
Simplify cleanup command to work with arbitrary installation methods (e.g. run packagemanifests and the upcoming run bundle)

Checklist

If the pull request includes user-facing changes, extra documentation is required:

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 4, 2020
@joelanford joelanford mentioned this pull request Aug 4, 2020
92 tasks
internal/operator/config.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
Comment on lines +30 to +31
operator "github.com/operator-framework/operator-sdk/internal/olm/operator"
operator2 "github.com/operator-framework/operator-sdk/internal/operator"
Copy link
Member Author

Choose a reason for hiding this comment

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

There's some related work going on with run bundle in the github.com/operator-framework/operator-sdk/internal/operator package.

The thought is to do the new run design in the new package, and once that's mostly there we can port the existing run packagemanifests code (mainly the registry setup) into that package.

See #3626

@joelanford joelanford changed the title WIP operator-sdk cleanup: remove packagemanifests, add generic command operator-sdk cleanup: remove packagemanifests, add generic command Aug 5, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 5, 2020
Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

Structurally looks fine, mostly nits/fixes.

internal/cmd/operator-sdk/cleanup/cmd.go Outdated Show resolved Hide resolved
internal/operator/config.go Show resolved Hide resolved
internal/operator/uninstall.go Outdated Show resolved Hide resolved
internal/operator/uninstall.go Outdated Show resolved Hide resolved

By("destroying the deployed package manifests-formatted operator")
cleanupPkgManCmd := exec.Command(tc.BinaryName, "cleanup", projectName,
"--timeout", "4m")
Copy link
Member

Choose a reason for hiding this comment

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

Follow-up: helm's e2e tests should be using the test namespace, and run/cleanup should have --namespace=<tc.Kubectl.Namespace> in their command args.

@@ -14,7 +14,7 @@

// Modified from https://github.com/kubernetes-sigs/kubebuilder/tree/39224f0/test/e2e/v3

package e2e
package e2e_test

import (
"testing"
Copy link
Contributor

@camilamacedo86 camilamacedo86 Aug 5, 2020

Choose a reason for hiding this comment

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

Replace:

func TestE2E(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Operator SDK e2e suite")
}

With:

// TestE2EGo ensures the Helm projects built with the Go tool by using its binary.
func TestE2EGo(t *testing.T) {
	if testing.Short() {
		t.Skip("skipping Operator SDK E2E Go Suite testing in short mode")
	}
	RegisterFailHandler(Fail)
	RunSpecs(t, "E2EGo Suite")
}

Otherwise, the test will be called in the target make test-unit

Copy link
Member

Choose a reason for hiding this comment

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

make test-unit skips the entire test package with go list ./... | grep -v -E 'github.com/operator-framework/operator-sdk/test/'.

Copy link
Contributor

Choose a reason for hiding this comment

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

HI @estroz and @joelanford,

IMO we must implement solutions idempotent for the tests which means that they should not rely on the Travis or make targets. So, if a developer run go tests ../... in the project it should call the tests that should be executed and finish with success what will not occur in this case.

However, it is addressed in the PR: https://github.com/operator-framework/operator-sdk/pull/3499/files

Copy link
Contributor

@camilamacedo86 camilamacedo86 Aug 14, 2020

Choose a reason for hiding this comment

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

Otherwise, if we do not force as to follow up this kind of path then it contributes to the scenario where is not possible run the tests outside of the Travis (locally).

Copy link
Member

@estroz estroz 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 Aug 5, 2020
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 5, 2020
Copy link
Member

@jmrodri jmrodri 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 Aug 5, 2020
@joelanford joelanford merged commit 13198cf into operator-framework:master Aug 5, 2020
@joelanford joelanford deleted the refactor-cleanup branch August 5, 2020 20:55
@@ -44,6 +44,8 @@ var (
isOLMManagedBySuite = true
// kubectx stores the k8s context from where the tests are running
kubectx string
// projectName is the name of the test project
projectName string
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 that we can use tc.TestSuffix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants