Skip to content

Commit

Permalink
Update Good Practices
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajiyah-Salat committed May 7, 2023
1 parent 0d8f69d commit e7f2c6c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/book/src/Good Practices
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

## Why should reconciliations be idempotent?

When developing operators, the controller’s reconciliation loop needs to be idempotent. By following the [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/) we create [controllers](https://kubernetes.io/docs/concepts/architecture/controller/) that provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster. Developing idempotent solutions will allow the reconciler to correctly respond to generic or unexpected events, easily deal with application startup or upgrade. More explanation on this is available [here](https://github.com/kubernetes-sigs/controller-runtime/blob/main/FAQ.md#q-how-do-i-have-different-logic-in-my-reconciler-for-different-types-of-events-eg-create-update-delete).
When developing operators, the controller’s reconciliation loop needs to be idempotent. By following the [Operator pattern][operatorpatterns] we create [controllers][controllers] that provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster. Developing idempotent solutions will allow the reconciler to correctly respond to generic or unexpected events, easily deal with application startup or upgrade. More explanation on this is available [here](https://github.com/kubernetes-sigs/controller-runtime/blob/main/FAQ.md#q-how-do-i-have-different-logic-in-my-reconciler-for-different-types-of-events-eg-create-update-delete).

Writing reconciliation logic according to specific events, breaks the recommendation of operator pattern and goes against the design principles of [controller-runtime](controller-runtime). This may lead to unforeseen consequences, such as resources becoming stuck and requiring manual intervention.
Writing reconciliation logic according to specific events, breaks the recommendation of operator pattern and goes against the design principles of [controller-runtime][controllerruntime]. This may lead to unforeseen consequences, such as resources becoming stuck and requiring manual intervention.

## Understanding Kubernetes APIs and following API conventions

Expand All @@ -26,4 +26,6 @@ Additionally, we recommend checking the documentation on [Operator patterns][ope
[best-practice-doc]: https://sdk.operatorframework.io/docs/best-practices/
[deployimage]: https://book.kubebuilder.io/plugins/deploy-image-plugin-v1-alpha.html
[operatorpatterns]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/
[controllers]: https://kubernetes.io/docs/concepts/architecture/controller/
[controllerruntime]: https://github.com/kubernetes-sigs/controller-runtime

0 comments on commit e7f2c6c

Please sign in to comment.