-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Prompt to install CRD when Kind no found #129
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
Conversation
pkg/source/source.go
Outdated
return err | ||
switch err.(type) { | ||
case *meta.NoKindMatchError: | ||
return fmt.Errorf("must install CRD %v before calling Start", err.(*meta.NoKindMatchError).GroupKind) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use %s
here instead to get it pretty-printed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
They are the same output.
looks good, please squash the commits together |
b32eec8
to
05e5ab2
Compare
@DirectXMan12 Done. |
one last thing before merge -- this message could potentially be confusing if the resource isn't a CRD, so we might want to change the wording a bit. Also, we lose the ability to have users inspect the error themselves, which probably isn't the most useful, but might be worth considering... Maybe we can just wrap the error so that people can still check, but provide our own error message? |
b1ecf6a
to
cd4ab3c
Compare
@DirectXMan12
PTAL, thanks. |
@droot @pwittrock @mengqiy we should decide if we want something like In the mean time, if we want to move this forward, we might just want to log a warning at |
Gopkg.lock
Outdated
@@ -3,96 +3,75 @@ | |||
|
|||
[[projects]] | |||
branch = "default" | |||
digest = "1:24df057f15e7a09e75c1241cbe6f6590fd3eac9804f1110b02efade3214f042d" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bet you were using an older version of dep.
Please upgrade it and rerun it, it should not remove these digest
lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mengqiy You are right.
before:
$ dep version
dep:
version : devel
build date :
git hash :
go version : go1.10.3
go compiler : gc
platform : darwin/amd64
after upgrade:
$ dep version
dep:
version : v0.5.0
build date : 2018-07-26
git hash : 224a564
go version : go1.10.3
go compiler : gc
platform : darwin/amd64
features : ImportDuringSolve=false
Gopkg.toml
Outdated
@@ -20,6 +20,7 @@ required = ["sigs.k8s.io/testing_frameworks/integration", | |||
"github.com/go-openapi/spec", | |||
"k8s.io/kube-openapi/pkg/common", | |||
"k8s.io/apiextensions-apiserver", | |||
"github.com/pkg/errors", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please make it well indented :)
@DirectXMan12 I don't think it's a bad idea. What is your concern if we introduce this into our codebase? |
@interma It seems you still have a conflict in |
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. I understand the commands that are listed here. |
Yes, @mengqiy Thanks for your review. |
/check-cla |
42f8b4f
to
63d0bbb
Compare
@mengqiy @DirectXMan12 @droot |
@interma change is looking good except the introduction of errors pkg. Not super sure in introducing errors pkg. One thing I have observed with errors pkg is, you need to have a consistent scheme for wrapping, otherwise you end up with weird looking msg at the top of the stack. For ex. whether to include pkg-name at the start "controller:", not repeating "error" in the content (can cause stuttering) etc. I would suggest if we can make this change without introducing errors pkg, it will be easier to move forward. Since in this case, the caller program pretty much exits if they are unable to setup the watches, we are even fine with logging at error level instead warning. /cc @DirectXMan12 |
Thanks for your review. @droot |
agree with @droot |
Thanks @DirectXMan12 @droot |
Sorry I wasn't clear about the change: |
@droot got it. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit, otherwise good to go.
pkg/source/source.go
Outdated
@@ -80,6 +84,11 @@ func (ks *Kind) Start(handler handler.EventHandler, queue workqueue.RateLimiting | |||
// Lookup the Informer from the Cache and add an EventHandler which populates the Queue | |||
i, err := ks.cache.GetInformer(ks.Type) | |||
if err != nil { | |||
switch err.(type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to for the one item switch here --
if kindMatchErr, ok := err.(*meta.NoKindMatchError); ok {
log.Error(err, /* rest of message goes here */)
}
return err
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
1f4f6fd
to
919948d
Compare
@DirectXMan12 @droot There's a very small PR, but thanks you guys for helping me improve the code! |
/approve thanks for your contribution, and for your patience! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DirectXMan12, interma 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 |
Prompt to install CRD when Kind no found
Add / Update GitBook *Test* and *Docs* chapters
Fix: kubernetes-sigs/kubebuilder#337
New output:
Thanks for the review.