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

✨ update CRD if already present #696

Merged

Conversation

pires
Copy link
Contributor

@pires pires commented Nov 26, 2019

In testenv, update the CRD if it's already present on the cluster instead of failing to continue.

Fixes #342
Closes #457

@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 26, 2019
@k8s-ci-robot
Copy link
Contributor

Welcome @pires!

It looks like this is your first PR to kubernetes-sigs/controller-runtime 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/controller-runtime has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @pires. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 26, 2019
@pires pires changed the title :patch: Don't error if the CRD is already present. 🐛 Don't error if the CRD is already present. Nov 26, 2019
@pires pires changed the title 🐛 Don't error if the CRD is already present. :patch: Don't error if the CRD is already present Nov 26, 2019
@pires pires force-pushed the pires/dont_error_if_crd_present branch from a4fcb71 to 8848476 Compare November 26, 2019 16:01
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Nov 26, 2019
@pires pires changed the title :patch: Don't error if the CRD is already present 🐛 Don't error if the CRD is already present Nov 26, 2019
@k8s-ci-robot
Copy link
Contributor

@pires: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

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.

@pires pires force-pushed the pires/dont_error_if_crd_present branch from 8848476 to 913d6ed Compare November 26, 2019 16:46
pkg/envtest/crd.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 29, 2019
@pires pires force-pushed the pires/dont_error_if_crd_present branch from 913d6ed to 6848bd2 Compare November 30, 2019 14:03
Copy link
Member

@alvaroaleman alvaroaleman left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 30, 2019
@DirectXMan12
Copy link
Contributor

add a log line to this warning about it (and switch the title to say "update CRD if already present" to make it more likely that people'll notice it in the release notes), then I think we're good here.

I think it'd be fine even without, but better to provide feedback than give someone a debugging headache.

@pires pires changed the title 🐛 Don't error if the CRD is already present 🐛 update CRD if already present Dec 3, 2019
@pires pires force-pushed the pires/dont_error_if_crd_present branch from 6848bd2 to 25548b5 Compare December 3, 2019 10:13
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 3, 2019
@pires
Copy link
Contributor Author

pires commented Dec 3, 2019

Done, PTAL.

@DirectXMan12
Copy link
Contributor

did the test change disappear? I seem to recall that there was a change to the existing test here before...

otherwise lgtm

@pires
Copy link
Contributor Author

pires commented Dec 6, 2019

Rebased master onto this branch and added a couple tests. I think there were no tests before, sorry for that.

Added tests:

  • Re-install unchanged CRDs
  • Install CRD with two versions; add a new version to CRD source; install CRD with three versions; ensure first install resulted in CRD with two versions while the second install resulted in same CRD name but with three versions.

@pires pires force-pushed the pires/dont_error_if_crd_present branch from 25548b5 to 8b11cd9 Compare December 6, 2019 11:31
@pires
Copy link
Contributor Author

pires commented Dec 6, 2019

As is tradition around here, I forgot to include two new files and that's why I force-pushed. Need caffeine.

OK, I'll need help understanding why the second test fails. I tried it in many forms and haven't been able to get it to work. Also the tests usually yield different results on my side with MacOS 1.15.x, Go 1.13.5 and kind 0.6.1.

@DirectXMan12
Copy link
Contributor

As is tradition around here, I forgot to include two new files and that's why I force-pushed. Need caffeine.

heh, definitely had those days. Need a lint that checks if we've had caffeine yet for the day :-P

As for the test, did some poking around, and found the failure. It's another caffeine error :-P Commented inline.

pkg/envtest/crd.go Show resolved Hide resolved
@pires pires force-pushed the pires/dont_error_if_crd_present branch from c93b37f to d3247ac Compare December 10, 2019 15:39
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 10, 2019
@pires pires force-pushed the pires/dont_error_if_crd_present branch 2 times, most recently from 79c06b1 to a0a84b7 Compare December 10, 2019 16:05
@pires
Copy link
Contributor Author

pires commented Dec 11, 2019

Are we good @DirectXMan12?

pkg/envtest/crd.go Show resolved Hide resolved
Signed-off-by: Pires <pjpires@gmail.com>
@pires pires force-pushed the pires/dont_error_if_crd_present branch from a0a84b7 to 5fc0586 Compare January 8, 2020 10:52
@gerred
Copy link
Contributor

gerred commented Jan 10, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 10, 2020
@gerred
Copy link
Contributor

gerred commented Jan 10, 2020

/approve

@gerred
Copy link
Contributor

gerred commented Jan 10, 2020

/assign @DirectXMan12

looks like everything has been addressed - I reviewed the code and nothing else stands out. thanks @pires

@DirectXMan12
Copy link
Contributor

Added a bit more of a PR description -- in general, I prefer to see a bit of a description beyond the bugs it fixes and the title, even if it's relatively minimal.

otherwise looks good :-)

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DirectXMan12, gerred, pires

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 14, 2020
@DirectXMan12 DirectXMan12 changed the title 🐛 update CRD if already present ✨ update CRD if already present Jan 14, 2020
@DirectXMan12
Copy link
Contributor

Also, since this is a bit of a behavioral change, I've made it a feature instead of a bugfix, just to play it safe

@pires
Copy link
Contributor Author

pires commented Jan 14, 2020

/retest

@k8s-ci-robot k8s-ci-robot merged commit 0d78900 into kubernetes-sigs:master Jan 14, 2020
@pires pires deleted the pires/dont_error_if_crd_present branch January 14, 2020 11:15
DirectXMan12 pushed a commit that referenced this pull request Jan 31, 2020
🏃 Download git-lfs directly on OSX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Envtest is not idempotent when installing CRDs, an issue when UseExistingCluster=true
5 participants