engineerd / kubecontroller-csharp Goto Github PK
View Code? Open in Web Editor NEWLightweight Kubernetes controller for CRDs
Home Page: https://radu-matei.com/blog/kubernetes-controller-csharp/
Lightweight Kubernetes controller for CRDs
Home Page: https://radu-matei.com/blog/kubernetes-controller-csharp/
Hi there Radu,
The first time I tried creating a controller was by inspecting this sample and then learning all the taxonomy here along the way. The next step up of course was the kubebuilder.
What you have demonstrated here instead, is extremely wonderful to conceptualise and much easier to get productive. What are your thoughts on all the facilities in client-go and how they may or may not be accounted (or needed ?) in what you have demonstrated here via kubecontroller-csharp. You mentioned:
It is intended to show you how to get started writing your own controller for CRDs in C#, and it is not suited for production purposes.
Are the concerns in the above related to general producitonising code with appropriate logging, error handling etc ? Or are you also referring to the additional facilities in client-go
? Thanks for your advice.
Right now you have to declare your CRD in a YAML file to use it with the Kubernetes API, as well as manually create an instance of CustomResourceDefinition
when creating the controller.
It would be very helpful to parse the YAML / JSON file that declares the custom resource and use that directly with the controller.
radu:kubecontroller-csharp$ dotnet run --project KubeController.Sample/
Unhandled Exception: System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException: Connection refused
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at k8s.WatcherDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Rest.RetryDelegatingHandler.<>c__DisplayClass11_0.<<SendAsync>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Rest.RetryDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at k8s.Kubernetes.ListNamespacedCustomObjectWithHttpMessagesAsync(String group, String version, String namespaceParameter, String plural, String fieldSelector, String labelSelector, String resourceVersion, Nullable`1 timeoutSeconds, Nullable`1 watch, String pretty, Dictionary`2 customHeaders, CancellationToken cancellationToken)
at Engineerd.KubeController.Controller`1.StartAsync(CancellationToken token) in /mnt/c/projects/go/src/github.com/engineerd/kubecontroller-csharp/KubeController/Controller.cs:line 29
at Engineerd.KubeController.Sample.Program.Main() in /mnt/c/projects/go/src/github.com/engineerd/kubecontroller-csharp/KubeController.Sample/Program.cs:line 30
at Engineerd.KubeController.Sample.Program.<Main>()
Hi there Radu,
Firstly let me say this is very interesting and thank you for sharing. I've created the CRD and the sample CR in the project. Creating new Example
resources or deleting them doesn't seem to generate any event or output when running:
dotnet run KubeController.Sample/
How can I see output for the events generated ? Thanks again for sharing and would appreciate any guidance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.