🚀 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.
- Language: Golang
- Framework: Kubebuilder
- Kubernetes Cluster 🌐
- kubectl ⌨️
- Golang 🐹
- Kubebuilder 🏗️
- Docker 🐳
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.
-
Clone the project
git clone https://github.com/SaharshPatel24/clusterscan-controller.git
-
Go to the project directory
cd clusterscan-controller
-
Install dependencies
go mod tidy
-
Run Kubernetes cluster locally
minikube start
-
Create Custom Resource
-
Run the Controller
make run
-
Apply Custom Resource
In a second terminal, apply the custom resource to the controller using
kubectl apply -f /path/to/custom-resource