-
Notifications
You must be signed in to change notification settings - Fork 40.2k
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
Added informer to third-party-resources example of client-go #45263
Conversation
Hi @MikeSpreitzer. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: MikeSpreitzer Assign the PR to them by writing
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@k8s-bot ok to test |
It looks like something went wrong with dependencies, but I am mystified. |
Run ./hack/update-bazel.sh? |
"syscall" | ||
"time" | ||
|
||
"github.com/golang/glog" |
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 update on BUILD for new package?
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.
Is this something that ./hack/update-bazel.sh
would update?
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.
As feiskyer suggested, run ./hack/update-bazel.sh
; it will help to update staging/src/k8s.io/client-go/examples/third-party-resources/BUILD
.
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 for the clue. I am not familiar with bazel and that script; where would I go to learn what they do?
I tried that command, and it failed as follows. What does it mean and what can I do about it?
mjs10:kubernetes mspreitz$ ./hack/update-bazel.sh
F0503 13:04:03.982558 3351 gazel.go:60] err walking generated: openapi-gen path outside of kubernetes: github.com/MikeSpreitzer/kubernetes/cmd/libs/go2idl/client-gen/test_apis/testgroup/v1
@@ -165,3 +186,87 @@ func configureClient(config *rest.Config) { | |||
metav1.AddToGroupVersion(scheme.Scheme, groupversion) | |||
schemeBuilder.AddToScheme(scheme.Scheme) | |||
} | |||
|
|||
func watch(client *rest.RESTClient) { |
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 kind of think this should be in it's own file, and exported in case folks crib.
Factored, hopefully as @timothysc suggested. |
But the same two tests fail and the update-bazel script still fails. Can anybody help?
|
@MikeSpreitzer, here's the output on my laptop; when running
|
@MikeSpreitzer , BTW, please do not use symbol link, |
@k82cn Thanks for trying to help, but I do not understand. The output you showed is not from running the update-bazel script, it looks more like
|
I wonder if my dependency problems are a consequence of the fact that I am developing under my own fork's location under $GOPATH rather than
|
And now, for some reason, the update-bazel script is failing in a new way this morning:
|
@MikeSpreitzer , here's it path in my laptop:
|
Yes, switching the location on my laptop to On reviewing it, I see that https://github.com/kubernetes/community/blob/master/contributors/devel/development.md#workflow does specifically say to use that location. However, I used to be able to work in |
Why was the latest Jenkins verification NOT done against the latest commit? What is going wrong in the latest Jenkins Bazel Build? It complains
I see that this PR does indeed add |
/assign @lavalamp |
Oh, it seems that the Jenkins Verification build was just slow to arrive. Now it has successfully run on the latest commit. The only outstanding mystery is the complaint from the Jenkins Bazel Build. |
Demonstrates how to list and watch third party objects (i.e., objects of a Kind defined by a ThirdPartyResource). This makes a tiny contribution towards client-go issue kubernetes#128
My latest change replaced use of |
@caesarxuchao Thanks for the heads up. Yes, it is a duplicate request, and I prefer mine, as it provides more details, as well as contains a code cleanup. @MikeSpreitzer Do you mind taking a look at the PR #45463, which solves the same problem? What do you think? |
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.
@MikeSpreitzer Please see the comments.
Also, please take a look at the #45463 as they solve the same problem.
@@ -69,6 +73,7 @@ func main() { | |||
if err != nil { | |||
panic(err) | |||
} | |||
kind_created_here = true |
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.
In my PR I have added a sleep instead of passing this flag: https://github.com/kubernetes/kubernetes/pull/45463/files#diff-eb875333b11b3ab1e7e6fdb35d1bc09dR75
While sleeping could look hacky, I think it's okay for the example (with the appropriate comment, of course), and it doesn't require to run the example twice.
In your case the first run of example will always fail.
if kind_created_here { | ||
glog.Infoln("Probably because of delay issue noted in https://github.com/kubernetes/features/issues/95 ...") | ||
} | ||
glog.Fatalf("Unable to create example1 --- request=%#v, result=%#v, err=%#v", req, result, 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.
I don't like that you are mixing fmt.Print() with glog.
The original example was only using fmt, so it would be better to stick with it, or replacing fmt with glog everywhere.
// resyncPeriod | ||
// Every resyncPeriod, all resources in the cache will retrigger events. | ||
// Set to 0 to disable the resync. | ||
time.Second*60, |
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.
As previously suggested by @caesarxuchao in #43027 (comment), resyncPeriod should be set to 0 instead.
@MikeSpreitzer should this PR be closed as duplicate now? #45463 is merged into master. |
@MikeSpreitzer PR needs rebase |
Closing. Thank you @nilebox @MikeSpreitzer. |
What this PR does / why we need it:
Demonstrates how to list and watch third party objects (i.e., objects
of a Kind defined by a ThirdPartyResource).
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged):This makes a small contribution toward kubernetes/client-go#128
Special notes for your reviewer:
Release note: