∞ Introduction :
Process that watches the k8s API for events and take action such as create/update/delete k8s components.
You can call it a kind of workflow management;
∞ Framework to use :
Operator-sdk recommended
Build on top of Kubebuilder
∞ Best practices :
Evolve carefully the APIs
Perform validation
Make sure to recover from any error
∞ Custom ressource definitions :
CR is the state of your machine
Use different tools as OpenAPIv3 schemas and webhooks
Separate code for create,update and delete
Use K8s events (nice integration with ArgoCD)
∞ Testing
Move code to libraries to test outside the operator
Attach a debugger to the tests
Unit test your functions
Run integration tests against services only when needed
Recommend API mocking
Use minikube,k3d or kind only when necessary for integration tests
∞ Monitoring
Use kube-state-metrics (easy to add/extend metrics) visible in Promotheus/Grafana
Good to provide insights to your users
Credit to Squer Solutions, Riccardo Capraro