krkn-operator
The krkn-operator provides a way to run krkn chaos test scenarios in various predefined deployment configurations.
Use
Create a benchmark CRD, choosing one of the predefined scenarios of krkn-hub, i.e.:
apiVersion: perf.chaos.io/v1
kind: Benchmark
metadata:
name: benchmark-sample
spec:
scenario: pod-scenarios
$ kubectl apply -f config/samples/perf_v1_benchmark.yaml
benchmark.perf.chaos.io/benchmark-sample created
$ kubectl get benchmark
NAME AGE
benchmark-sample 7s
Getting Started
You’ll need a Kubernetes cluster to run against. You can use kind to get a local cluster for testing, or run against a remote cluster.
Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info
shows).
Running on the cluster
- Deploy the controller to the cluster:
make deploy IMG=quay.io/jcastillolema/krkn-operator:0.0.1
- Verify that the krkn-operator is up and running:
$ kubectl get po -n krkn-operator-system
NAME READY STATUS RESTARTS AGE
krkn-operator-controller-manager-b8585c7cb-88xjh 2/2 Running 0 18m
- Install instances of Custom Resources:
kubectl apply -f config/samples/perf_v1_benchmark.yaml
Uninstall CRDs
To delete the CRDs from the cluster:
make uninstall
Undeploy controller
Undeploy the controller from the cluster:
make undeploy
Contributing
How it works
This project aims to follow the Kubernetes Operator pattern.
It uses Controllers,
which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.
Test It Out
- Install the CRDs into the cluster:
make install
- Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
make run
NOTE: You can also run this in one step by running: make install run
Modifying the API definitions
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
make manifests
NOTE: Run make --help
for more information on all potential make
targets
More information can be found via the Kubebuilder Documentation