This repository will house the components for Venom, a basic Kubernetes operator.
In kubernetes, controllers are reconciliation loops which keep track of the state of your cluster, and modify it when required. Each controller tries to move the current state of your cluster closer to the desired state.
Controllers are basically trackers of a resource type. These types have a spec field which define their desired state.
A kuberentes operator is a pattern which consists of a kubernetes controller, and some custom resource definitions. It basically is a controller with some extra domain specific knowledge.
The Venom operator defines a resource called ClusterScan. For the time being, it is designed to run a custom kuberntes job with the specified spec, but it can be designed further.
A one-off ClusterScan reesource can be created using a similar manifest as given below:
apiVersion: poison.venom.gule-gulzar.com/v1
kind: ClusterScan
metadata:
name: clusterscan-one-off
spec:
jobTemplate:
spec:
template:
spec:
containers:
- image: busybox
name: testjob
restartPolicy: Never
A recurring ClusterScan reesource can be created using a similar manifest as given below:
apiVersion: poison.venom.gule-gulzar.com/v1
kind: ClusterScan
metadata:
name: clusterscan-cron
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- image: busybox
name: testjob
restartPolicy: Never
jobRetentionTime: 5
Since Venom is still under development, it can be deployed from source using the following steps:
- You need access to a kubernetes cluster. The following commands automatically use the current context in your
kubeconfig
file. - Run
make install
command to install the CRDs into the cluster. - Run
make run
command to start the controller locally. - Use kustomize to deploy sample resources for ClusterScan resource, defined in config/samples/ of this repository.
kubectl apply -k config/samples
Instead of make run
, the deployed image for the operator from docker hub can also be used