https://github.com/buehler/dotnet-operator-sdk
KubeOps is a kubernetes operator sdk in dotnet. Strongly inspired by kubebuilder.
https://github.com/buehler/dotnet-operator-sdk
crds dotnet kubernetes kubernetes-operator-sdk operator sdk
Last synced: about 6 hours ago
JSON representation
KubeOps is a kubernetes operator sdk in dotnet. Strongly inspired by kubebuilder.
- Host: GitHub
- URL: https://github.com/buehler/dotnet-operator-sdk
- Owner: buehler
- License: apache-2.0
- Created: 2020-05-05T15:46:43.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-04-11T06:51:33.000Z (about 1 month ago)
- Last Synced: 2025-04-13T01:59:22.873Z (about 1 month ago)
- Topics: crds, dotnet, kubernetes, kubernetes-operator-sdk, operator, sdk
- Language: C#
- Homepage: https://buehler.github.io/dotnet-operator-sdk/
- Size: 3.48 MB
- Stars: 259
- Watchers: 11
- Forks: 71
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-kubernetes-operator-resources - KubeOps - KubeOps is a kubernetes operator sdk in dotnet. Strongly inspired by kubebuilder. (Operator Frameworks)
README
# KubeOps
**Build Kubernetes Operators in .NET with Ease**
[](https://github.com/buehler/dotnet-operator-sdk/actions/workflows/dotnet-release.yml)
[](https://github.com/buehler/dotnet-operator-sdk/actions/workflows/dotnet-release.yml)
[](https://github.com/buehler/dotnet-operator-sdk/actions/workflows/security-analysis.yml)**KubeOps** is a [Kubernetes Operator](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/) SDK designed for [.NET](https://dotnet.microsoft.com/) developers. It allows you to leverage your C# skills and the rich .NET ecosystem to build powerful Kubernetes controllers that automate the management of complex applications. KubeOps simplifies operator development by providing high-level abstractions, code generators, and helper utilities.
**For comprehensive documentation, tutorials, and API references, please visit the official [KubeOps Documentation Site](https://buehler.github.io/dotnet-operator-sdk/).**
The documentation is also provided within the code itself (description of methods and classes), and each package contains a README with further information.
## Key Features
* **Define CRDs in C#:** Model your [Custom Resource Definitions (CRDs)](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/) using plain C# classes and attributes.
* **Controller Logic:** Implement reconciliation logic using the `IResourceController` interface.
* **Finalizers:** Easily add cleanup logic before resource deletion with `IResourceFinalizer`.
* **Webhooks:** Create [Admission](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/) (validating/mutating) and [Conversion](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#webhook-conversion) webhooks integrated with ASP.NET Core.
* **Code Generation:** Includes Roslyn source generators and a CLI tool (`dotnet kubeops`) to automate boilerplate code for CRDs, controllers, and RBAC rules.
* **Enhanced Kubernetes Client:** Provides convenience methods built on top of the official client library.
* **Leader Election:** Automatic handling for high-availability operator deployments.
* **Testing Support:** Provides utilities and patterns to help with unit and integration testing.## Getting Started
The quickest way to start building an operator with KubeOps is by using the CLI tool:
1. **Install the CLI:**
```bash
dotnet tool install --global KubeOps.Cli
```
*(Or `dotnet tool update --global KubeOps.Cli` to get the latest version)*2. **Create a new operator project:**
```bash
dotnet kubeops new operator MyOperator
cd MyOperator
```3. **Explore the code:** The template generates a basic operator structure with a sample custom resource, controller, and finalizer.
4. **Dive deeper:** Follow the tutorials and guides on the [KubeOps Documentation Site](https://buehler.github.io/dotnet-operator-sdk/).
## Packages
All packages target [.NET 8.0](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8/overview) and [.NET 9.0](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/overview), leveraging modern C# features. The underlying Kubernetes client library (`KubernetesClient.Official`) also follows this versioning strategy.
The SDK is designed to be modular. You can include only the packages you need:
| Package | Description | Latest Version |
|----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [KubeOps.Abstractions](./src/KubeOps.Abstractions/README.md) | Defines core interfaces, attributes (like `[KubernetesEntity]`), and base classes used across the SDK. Essential for defining your custom resources and controllers. | [](https://www.nuget.org/packages/KubeOps.Abstractions/absoluteLatest) |
| [KubeOps.Cli](./src/KubeOps.Cli/README.md) | A [.NET Tool](https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools) providing commands for scaffolding projects, generating [Custom Resource Definitions (CRDs)](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/), and more. | [](https://www.nuget.org/packages/KubeOps.Cli/absoluteLatest) |
| [KubeOps.Generator](./src/KubeOps.Generator/README.md) | Contains [Roslyn Source Generators](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview) to automate boilerplate code generation for CRDs and controllers based on your definitions. | [](https://www.nuget.org/packages/KubeOps.Generator/absoluteLatest) |
| [KubeOps.KubernetesClient](./src/KubeOps.KubernetesClient/README.md) | Provides an enhanced client for interacting with the [Kubernetes API](https://kubernetes.io/docs/reference/kubernetes-api/), built on top of the official `KubernetesClient` library. Offers convenience methods for common operator tasks. | [](https://www.nuget.org/packages/KubeOps.KubernetesClient/absoluteLatest) |
| [KubeOps.Operator](./src/KubeOps.Operator/README.md) | The main engine of the SDK. Handles reconciling resources, watching for changes, and managing the operator lifecycle. This is the primary package needed to run an operator. | [](https://www.nuget.org/packages/KubeOps.Operator/absoluteLatest) |
| [KubeOps.Operator.Web](./src/KubeOps.Operator.Web/README.md) | Integrates the operator with ASP.NET Core to expose endpoints for features like [Admission Webhooks](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/). | [](https://www.nuget.org/packages/KubeOps.Operator.Web/absoluteLatest) |
| [KubeOps.Transpiler](./src/KubeOps.Transpiler/README.md) | Utilities for converting .NET type definitions into Kubernetes YAML manifests, specifically for [CRDs](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/) and [RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) rules. | [](https://www.nuget.org/packages/KubeOps.Transpiler/absoluteLatest) |*Note: NuGet badges show the latest pre-release version.*
## Examples
You can find various example operators demonstrating different features in the [`examples/`](https://github.com/ewassef/dotnet-operator-sdk/tree/main/examples/) directory of this repository.
## Governance
KubeOps is currently maintained by [the original author/maintainer team - consider listing names or linking to GitHub profiles/team page]. We welcome community contributions and aim to foster an open and collaborative development process. As the project grows, we may establish a more formal governance structure. Decision-making primarily occurs through GitHub issues and pull requests.
## Contribution
If you want to contribute, feel free to open a pull request or write issues :-)
Please note that this project is released with a [Contributor Code of Conduct](./CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.
+
Read more about contribution (especially for setting up your local environment)
in the [CONTRIBUTING file](./CONTRIBUTING.md).In short:
- Check out the code
- Develop on KubeOps
- Use some Kubernetes to run the test operator against
- Create tests
- Build the whole solution (lint warnings will result in an error)
- Open PR## Motivation
KubeOps aims to provide a first-class experience for developing Kubernetes operators within the .NET ecosystem, offering an alternative to Go-based SDKs like Kubebuilder and Operator SDK, while embracing familiar C# patterns and tooling.
**Why choose KubeOps?**
* **Leverage your .NET Skills:** Build operators using C#, a language you already know, with access to the extensive .NET Base Class Library and NuGet ecosystem.
* **Strong Typing & IDE Support:** Benefit from compile-time checks and rich IDE features like IntelliSense and debugging.
* **Simplified Abstractions:** Focus on your reconciliation logic, not Kubernetes API boilerplate.
* **Code Generation:** Reduce manual effort with generators for CRDs, RBAC, and controller/webhook registrations.
* **Integrated Testing:** Develop unit and integration tests using familiar .NET testing frameworks.