Skip to content

conplementAG/cops-controller

Repository files navigation

cops controller

Introduction

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

Setup

Check the instructions on the release page.

Development

For developing, we use Visual Studio Code and Telepresence (intercepting cluster workload and redirect traffic to local service).

  1. Create / update your cops cluster to the latest state. Metacontroller, which is required for this controller to work, is delivered out of the box.

  2. 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. )

  1. Deploy the custom resource definitions kubectl apply -f deployment/crds

  2. 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)

  3. 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.