This is the Kubernetes Controller implementation for Conplement CoreOps specific Kubernetes extensions. Can be seen as a backend to the companion project copsctl
This project is "based" on metacontroller and written in C#, mainly for three reasons:
- Metacontroller is the simplest custom controller approach in Kubernetes, and offers easy parent / child resource tracking
- Metacontroller integrates with "business" code via webhooks, which leaves us free to select any language for the implementation
- Azure Dev Spaces, an excelent tool for development / debugging in Kubernetes, works at the moment the best with C#
- Telepresence an excelent tool for development / debugging controller within Kubernetes
Check the instructions on the release page.
For developing, we use Visual Studio Code and Telepresence (intercepting cluster workload and redirect traffic to local service).
-
Create / update your cops cluster to the latest state. Metacontroller, which is required for this controller to work, is delivered out of the box.
-
Install / setup telepresence in your cluster
telepresence helm install
to install telepresence
telepresence intercept cops-controller -n coreops-cops-controller --port 5000:80
intercept the cops-controller service
Make sure you are running a version of cops-controller locally listing to port 5000 ( see 5. )
-
Deploy the custom resource definitions
kubectl apply -f deployment/crds
-
Install / setup Visual Studio Code with following extensions:
- C#
- Docker
- NuGet Package Manager
Also, you might have issues with C# and .NET Core unless you install the dotnet core build tools as well: OmniSharp/omnisharp-roslyn#1311 (comment)
-
Run
donet restore
/dotnet build
and you are ready to go.
Hints on development:
- When running inside Kubernetes, follow both metacontroller and this container logs. Metacontroller logs can be reached via
kubectl logs metacontroller-0 -n metacontroller -f
or a similar command.