Skip to content

A basic kubernetes controller that reconciles a ClusterScan custom resource. It supports both one-off and recurring executions

Notifications You must be signed in to change notification settings

SaharshPatel24/clusterscan-controller

Repository files navigation

Kubernetes Controller for ClusterScan Custom Resource

🚀 This repository contains an implementation of a basic Kubernetes controller designed to reconcile a custom resource called ClusterScan. The primary objective of this controller is to facilitate the management of arbitrary jobs within a Kubernetes cluster and record their execution results.

Tech Stack

  • Language: Golang
  • Framework: Kubebuilder

Prerequisites

  • Kubernetes Cluster 🌐
  • kubectl ⌨️
  • Golang 🐹
  • Kubebuilder 🏗️
  • Docker 🐳

Features

Custom Resource Definition (CRD): Defines the structure of ClusterScan, allowing users to create instances of this resource.

Reconciliation: The controller continuously monitors the state of ClusterScans and ensures that the desired state matches the actual state by creating Jobs and/or CronJobs as necessary.

Support for One-off and Recurring Executions: ClusterScans can specify either one-off executions or recurring executions using CronJobs, providing flexibility for various use cases.

Run Locally

  1. Clone the project

    git clone https://github.com/SaharshPatel24/clusterscan-controller.git
  2. Go to the project directory

    cd clusterscan-controller
  3. Install dependencies

    go mod tidy
  4. Run Kubernetes cluster locally

    minikube start
  5. Create Custom Resource

    • Create a custom resource according to the custom resource definition available here..
    • For a sample custom resource, refer to this file.
  6. Run the Controller

    make run
  7. Apply Custom Resource

    In a second terminal, apply the custom resource to the controller using

    kubectl apply -f /path/to/custom-resource

About

A basic kubernetes controller that reconciles a ClusterScan custom resource. It supports both one-off and recurring executions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages