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

Envtest is not idempotent when installing CRDs, an issue when UseExistingCluster=true #342

Closed
teddyking opened this issue Feb 27, 2019 · 10 comments · Fixed by #696
Closed
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.

Comments

@teddyking
Copy link

We want to use envtest against an existing cluster and are having issues when installing CRDs. Envtest will fail on the second running of the tests because the CRDs already exist in the cluster. This is only an issue when using an existing cluster because normally envtest starts a new control plane each time.

Example setup we want to use:

		testEnv = &envtest.Environment{
			CRDDirectoryPaths:  []string{filepath.Join("..", "config", "crds")},
			UseExistingCluster: true,
		}

And error we get:

Expected error:
      <*errors.StatusError | 0xc00012a2d0>: {
          ErrStatus: {
              TypeMeta: {Kind: "", APIVersion: ""},
              ListMeta: {SelfLink: "", ResourceVersion: "", Continue: ""},
              Status: "Failure",
              Message: "customresourcedefinitions.apiextensions.k8s.io \"mycrd.meep.io\" already exists",
              Reason: "AlreadyExists",
              Details: {
                  Name: "mycrd.meep.io",
                  Group: "apiextensions.k8s.io",
                  Kind: "customresourcedefinitions",
                  UID: "",
                  Causes: nil,
                  RetryAfterSeconds: 0,
              },
              Code: 409,
          },
      }
      customresourcedefinitions.apiextensions.k8s.io "mycrd.meep.io" already exists
  not to have occurred

Is it possible to have envtest reinstall CRDs on every run rather than fail?

Thanks
Ed & @Samze & @ablease

@DirectXMan12
Copy link
Contributor

Probably, it should clean up the CRDs at the end, but replacing is also an option. Would you be willing to submit a PR for it?

@DirectXMan12
Copy link
Contributor

/kind feature
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Feb 27, 2019
@teddyking
Copy link
Author

Great! Yeah we'd be happy to PR this in, we'll try to get something opened in the next few days.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 29, 2019
@DirectXMan12
Copy link
Contributor

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 31, 2019
@DirectXMan12
Copy link
Contributor

will be fixed by #453

@DirectXMan12
Copy link
Contributor

or by #457

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 29, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 28, 2019
@DirectXMan12
Copy link
Contributor

/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Sep 30, 2019
pires added a commit to pires/controller-runtime that referenced this issue Nov 26, 2019
Fixes kubernetes-sigs#342
Refs kubernetes-sigs#457

Signed-off-by: Pires <pjpires@gmail.com>
pires added a commit to pires/controller-runtime that referenced this issue Nov 26, 2019
Fixes kubernetes-sigs#342
Closes kubernetes-sigs#457

Signed-off-by: Pires <pjpires@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants