-
Notifications
You must be signed in to change notification settings - Fork 33
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
Project direction / contributions #121
Comments
Hi - thanks for the reminder, I’ve been meaning to give this project some attention (my current job doesn’t deal with K8s at all so it’s kinda fallen off the radar a bit). I’ve only just woken up, so let me have a coffee and then I’ll read this fully and do my best to answer these questions 🙂 |
Looking through the code it actually seems like there is a DynamicClient, but it's weird that it's not using a generics interface and instead relies on kind/api version being parameters. IMO those things are fundamentally type information and if you already have a class structure that represents it, this is just metadata for that type. Those things should ideally be hidden from the user as they are more of serialization metadata then actual data. Also, it's highly desirable to make it seamless to the user to convert between different versions of resources (as you may wanna support multiple at the same time without having to explicitly fill out two nearly identical model structures). This was implemented in kubernetes-client/csharp#420 to allow direct casting between all versions of the same Kind, which opens up a path to dynamically select an appropriate version based on what the server is expecting. Seems like this was partially tackled in DynamicClient, but IMO should apply to everything. |
I’ve tried using generics for the clients, but the problem is that the APIs for various resource types are subtly inconsistent. Some of them will return the resource state when calling a given operation, whereas others just return a And third-party APIs don’t have to follow the rules at all unfortunately. Still, I’m open to anyone’s efforts to find a consistent or sufficiently-flexible way to handle these scenarios that doesn’t compromise the client’s ergonomics :) |
BTW, I'm most definitely open to collaboration / contributions! Basically, as long as the ergonomics (or more generally the developer experience) are preserved or enhanced I'm up for pretty much anything :) Going to go and get a coffee shortly, then will come and re-read this (it's Saturday and it's been a busy week so it may take me a little while to get back up to speed). |
OK, question by question:
|
First a slightly offtopic question for @macsux - Do you have any links to implementing kubernetes operators in .NET? I don't need to do that right now but I've looked around a few times and haven't really found much info. FWIW, I chose this project over the "official" one for a few reasons:
I'll also say I've had bad experiences in the past with projects that try to provide clients for many different programming languages and dotnet isn't viewed as a critical one. Where the APIs look crooked and things don't get fixed "because we code generate that." The kubernetes client seems to have good dotnet developers on it and the code isn't bad, so this is more about explaining my bias than pointing out a fault in that project. All that said, I agree that consolidating efforts is good and you make some good points in general. If there's anything I can do to help, I'm happy to join whatever efforts we feel make sense. |
I'm currently working towards building the necessary building blocks to allows this to happen. While it started as a desire to build controllers with .NET, it morphed a little into a broader initiative. We're building a framework that will offer LINQ abstraction over "live query", allowing you not only to get the current state of resources but to synchronize and respond to changes to the result set of the query over time. This is equivalent to informers in for Kubernetes. When it's released it will include provider for Kubernetes. This will be made as part of Steeltoe. This will make writing controller loops super simple and let us expand into higher-level functional operators with ease. You should be able to try it out over the coming weeks. I'm mainly building many of these blocks for myself as I have many ideas for controllers/operators in .NET space. In regards to the official client, I've been actively contributing to it, but I do agree there are issues. I personally disagree with the approach of both projects:
Both projects tend to lack from lack of contributors. If there were 20+ ACTIVE contributors to the official client then a better case could be made to sacrifice some automation for better API. Alas, that is not the case - both libraries suffer from low number of maintainers. Having said that being part of Kubernetes SIG definitely puts a significant momentum behind the official client, even though from where I'm standing it's codebase is inferior from that of KubeClient. There are a bunch of PRs I submitted against the official client to add support for installing CRDs, generic client, and some other things. I would LOVE to work on towards getting to a point where if KubeClient models AND clients can be autogenerated to follow the same pattern already in this library instead of ugly mess that AutoReset generates. If this is achieved, there's a case to be made that it aligns with the official project's philosophy, and should be integrated into it. While I love this codebase here, an architect in me would be very nervous to take on dependency with a single part-time contributor. I think going forward my contributions are gonna be split between official client and Steeltoe. Steeltoe has a team of full-time engineers from VMWare and a rigid release structure. |
I've recently been doing a lot of work building out building blocks for .NET Kubernetes integration, with the goal of providing the right components to create Kubernetes aware apps, creation of controllers, operators, and .net specific k8s automation. A lot of this work has been contributed to the official KubernetesClient and is currently hanging as open PRs (about 10k LOC total).
A lot of the code that is in there is actually abstract enough to be made easily compatible with both projects, which I may want to do. I'm finding that the structure of this project is definitely easier for the developer given it's hand-coded nature, but also introduces more overhead from a maintenance perspective to stay up to date with Kubernetes.
I have a few questions on general project philosophy and direction
KubernetesClient Generic methods kubernetes-client/csharp#412
Looking at them, there can be a generic version created for most objects and manually extended where necessary. This would obviously lead to less maintenance, while still allowing nice organization.
The text was updated successfully, but these errors were encountered: