GithubHelp home page GithubHelp logo

engineerd / kubecontroller-csharp Goto Github PK

View Code? Open in Web Editor NEW
38.0 38.0 9.0 7 KB

Lightweight Kubernetes controller for CRDs

Home Page: https://radu-matei.com/blog/kubernetes-controller-csharp/

C# 100.00%
dotnet kubernetes

kubecontroller-csharp's People

Contributors

radu-matei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kubecontroller-csharp's Issues

Reflector, Informer etc

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.

Create `CustomResourceDefinition` at runtime based on file definition

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.

Exception thrown by ListNamespacedCustomObjectWithHttpMessagesAsync

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>()

Running sample provides no output ?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.