-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Improve the coverage of examples #128
Comments
@caesarxuchao I can add one for |
Thanks @rmohr. Could you share what you have in mind before writing down the example? Never mind if you think writing a PR is easier. |
cc @mbohlool |
@caesarxuchao posted the inital PR, will clean and properly document it after the weekend (I had some issues compiling the latest client-go code). Let me know if you think that this example is too simplistic. |
I have a different take on how the Client Library samples should be done. I will argue that the examples should be more scenario-oriented, and not package-oriented as @caesarxuchao suggested above. I see the value of documenting what's in each package, but I would argue that it’s not necessarily something a beginner user to the library (or Kubernetes API) needs. Maybe this seems like I'm trying to target rookies more, but as authors of client libraries, we often make assumptions how much users know about the API or how it can be used. My goal is to simplify getting started experience of this library and provide pointers from www.kubernetes.io to the examples here, and create (more beginner-level) samples that make it less intimidating for others to get their hands dirty with the Kubernetes API. Here’s a quick rundown of what I have in mind for
Please provide feedback on which route is more agreeable. It’s just my opinion that we should provide real-world scenarios in In fact, I am seeking for feedback from actual 3rd party users of the API, if you know anyone, please send them my way, I'd love to listen to their experience with client-go. |
Can we start with figuring out how to eliminate permanent failures from the example suites and tests? I have an issue opened to delete some of these example suites because they have not passed once during the past 60 days. |
@fejta it looks like ci-kubernetes-e2e-gci-gce-examples and ci-kubernetes-e2e-gce-examples are regarding the examples in the |
@ahmetb the progressive layout of examples sounds great. They don't cover all the components though, like /tools/portforward or the /dynamic. I think we can put examples for these packages under "advanced tasks". |
@caesarxuchao agreed. If we can maintain a set of common and simple tasks (such as CRUD Pod) and scaffolding (e.g. sample operator) across official client libraries, there's plenty of room to document advanced aspects and patterns of each client library. |
Thanks for the clarification. Agree my comment is off topic. Please ignore. |
@ahmetb I love the idea of having code examples. It helps new people get started and lets you jump in at your own level rather than code training sites that take you from the beginning. A couple questions I have though.
|
A sample implementation of operator(controller) with TPR may help the developer to understand the client-go. |
@rothgar great questions:
|
@ahmetb We are using client-go in KubeVirt. I think the layout looks great. It pretty much covers everything which we currently use and it would have helped us to get started. I would also add an example for completely customized http clients, which integrate with the kubernetes security layers. It took me some time to figure out, how to write your own websocket client. The example I came up with is located at https://github.com/rmohr/kubernetes-custom-exec. |
I think it would also be very helpful to have an example of initiating rollbacks on deployments from client-go. I have been trying to research ways to do this for a few days now, and it's a pretty typical use case of this client so I think it'd help a lot of beginners and more advanced users alike. I'm still trying to figure it out myself but if I do I'd be happy to contribute an example. |
@jekohk please feel free to contribute the rollback operation to the crud-deployment example we have if you have time. |
@ahmetb I've updated the CRUD example to include a rollback operation, however I'm having issues getting integration tests to pass locally.
Any ideas? I've just been following the Community development guide- not sure if there some extra steps required when working under /staging directory. |
@jekohk can you open a separate issue for this? It looks like one of the dependencies broke the example. |
@jekohk it looks wrong if a client-go example requires compiling k8s.io/kubernetes. As @ahmetb suggested, let's discuss the problem in a separate issue. |
@ahmetb @caesarxuchao i've elaborated more in #303 |
@jekohk we have a retry package. we should use it where appropriate, for sure. |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. client-go/examples: Update CRUD Deployment sample **What this PR does / why we need it**: PR motivated by [#128](kubernetes/client-go#128), namely updating the CRUD example with the following: - Add new step which demonstrates rolling back deployments - Cleanup retry loop for `Update()` steps - Make `-kubeconfig` flag optional when running example (same as out-of-cluster example) - Update `README.md` to reflect changes **Special notes for your reviewer**: My first Kubernetes contribution- feedback very welcome! **Release note**: ```release-note NONE ``` /cc @ahmetb @caesarxuchao
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. client-go/examples: Update CRUD Deployment sample **What this PR does / why we need it**: PR motivated by [kubernetes#128](kubernetes#128), namely updating the CRUD example with the following: - Add new step which demonstrates rolling back deployments - Cleanup retry loop for `Update()` steps - Make `-kubeconfig` flag optional when running example (same as out-of-cluster example) - Update `README.md` to reflect changes **Special notes for your reviewer**: My first Kubernetes contribution- feedback very welcome! **Release note**: ```release-note NONE ``` /cc @ahmetb @caesarxuchao Kubernetes-commit: 1ba331ef59220c3f50246a4bfe23350de2c2f5ed
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
@ahmetb are you working on this? I'm iterating on http://using-client-go.cloudnative.sh and plan to PR when there's something substantial to share … |
@mhausenblas not actively. Happy to review more examples in line with the current ones or the bespoke list above. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Would be nice to have example for watch |
https://github.com/kubernetes/client-go/blob/master/examples/workqueue/main.go#L164-L195 is pretty exemplary |
Apart from helping users, increasing the coverage of examples can also help our CI to detect problems.
We can start with providing examples for all top-level packages, and packages in tools/:
User requested example
@lavalamp
related: #63
The text was updated successfully, but these errors were encountered: