-
Notifications
You must be signed in to change notification settings - Fork 305
Initial port of cache functions from java client #665
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
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. |
Welcome @ddieruf! |
Thanks for the PR could you please move codes to |
@tg123 understood. It's distributed as a single package. Can you provide a little guidance on your alternate approach? I keep running into cyclical ref errors. By the way, my motivation behind this design is to follow the Java client. I am happy to adjust things but wanted to keep their patterns as much as possible. |
We definitely had feedback in the Java library that some users wanted a "simple" package w/o all of the extra informer stuff, which was the motivation for multiple packages. I suspect that there will be similar feedback in this project, so I'm supportive of having a "simple" client and an "extended" package that depends on that client. @tg123 you know more about dotnet packaging than I do, are there concerns with this approach? |
A few small comments, but this looks like a great start to me, thank you for getting it going! |
It really makes sense to keep this separate fr the core client. They are not required and just add overhead to some. |
+1 for multiple packages it is better to have multiple extend packages. searched cross some related issues about multiple package: the first time we were discussing about separate packages is inside #102 i believe for compatibility reason, I prefer a multiple package migrating plan and not removing features from main package suddenly. |
Forgive me if I am missing something obvious but I am not seeing how I can include the
The The Solution Idea:
Could I add the following step in the workflow to distribute the - name: dotnet pack
run: dotnet pack -c Release util/src/KubernetesClient.Util -o pkg --include-symbols |
I agree w/ @tg123 that we should definitely not remove anything from the main library, as it will definitely break existing users. I had missed that we were removing things from the library? I thought we were just adding the Informer logic as an |
This is 100% addition. I didn't change anything in the core client. |
@ddieruf seems I am misleading my idea about after some test and planning, we should have confident to push new @brendandburns nothing removed in this PR, I am thinking about the roadmap to migrate to multiple nuget package |
@tg123 thank you for the clarification. I see you are thinking about a bigger picture than what I was. I totally understand the name planning. If you all are confident that this PR is ok, I am going to continue on to the next. Upcoming PRs:
|
This PR looks fine to me, CI/CD is failing though, and I want @tg123 to confirm it's ok too. |
@tg123 and @brendandburns I am seeking a little advice on how to proceed... As I get into Cache.Controller and Cache.SharedProcessor they utilize Java's ThreadPoolExecutor and ScheduledExecutorServices. The internals of these two classes are definitely achievable in C# but are going to make the PR considerably larger. If you are not familiar with the executor services they introduce the ability to control background threads (pool sizes, queues, workers, etc). Also they give you options like scheduling recurring processes. C# of course has Task and TaskFactory abilities. As an alternate solution, I could couple those with things like Semaphore and Threading.Timer to create a smaller less versatile version of executors (notably, I probably wouldn't build the notion of workers as ThreadPoolExecutor has). A third option would be to convert the things that Controller and SharedProcessor are meant to manage into tasks but this will offer even less fine-grain thread control. Also, this will deviate the code base considerably from Java. So keeping things in-sync will be more of a challenge. I haven't spent much time getting deep into Rx but if I was a betting man (which I am), I would say this is an inflection point. What are your thoughts about all this? Have I maybe missed another option? |
@ddieruf I feel like we should get this PR in with it's current scope and discuss the next steps in either an issue or another PR? I think incremental progress will help us get to the right place. I don't think we have to perfectly follow the Java implementation if it doesn't make sense. |
In short: Per my experience, I am quite into C#'s async/await or Task design. you do not have to worry about anything like threadpool, .net runtime will take care of it, and the only thing is to Task in C# is something, not sure if you are familiar with, much like Go's goroutine. you may want to take a look at Wather's https://github.com/kubernetes-client/csharp/blob/master/src/KubernetesClient/Watcher.cs#L100 loop |
@brendandburns we can use my open original issue to chat. @tg123 thank you for the thoughts. I would never claim to be an expert with C# tasks but have been using them for some time. Your direction makes sense. Since we aren't concerned about drifting away from the patterns Java is using, I'll get something going. |
What can I do to help get this PR moved along? Anything I am missing? |
I'm ready to merge this, assuming that @tg123 is ok with it and we have any packaging concerns straightened out. |
@tg123 I'm going to merge this in 2 days if there are no further comments. 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.
could you please move util/src/KubernetesClient .Util to src/KubernetesClient .Util ?
@brendanburns in current PR, no new nuget will be published, which means no KubernetesClient .Util
on nuget.org
do you feel ok to add it to nuget.org?
I suggest to move the new code directly to KubernetesClient before we know how to do the multiple nugets (keep single nuget for a while)
@@ -0,0 +1,2 @@ | |||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> |
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.
should be ignore by git
@tg123 as I mentioned before whatever works for publishing. If it's one package or multiple. I have just about completed everything and I can safely say there is a lot of code coming. I have not changed a single file in the client, so it's a very clean separation. Cache, informers, and all the supporting classes are quite a bit to add to the original project. Again, I will go with whatever you feel is best. |
@ddieruf can you just drop the folders into KubernetesClient project? |
Will do |
@tg123 it is done. Moved everything into the client project :) |
/LGTM |
/lgtm One test flaked, I re-ran it, hopefully it passes this time. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, ddieruf 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 |
On the road to informers, this is the first step. Cache is a core component of informers as it stores state of objects. This is a direct port from
master
in kubernetes-client/java.