Abstract
Writing a Kubernetes Operator is easy, they said, and it is: you just need to embrace the Kubernetes patterns and the provided code-base. Nobody shared it, so I decided to sum up all the ups and downs I faced during the development phase of my first open-sourced Kubernetes operator. Capsule is an open-source Operator that leverages Kubernetes multi-tenancy capabilities, providing a new abstraction layer named Tenant that allows to group several Namespaces under the same roof. During my development journey, I had the pleasure to bang my head against the wall and find out some best practices that could help you out writing your first Operator: no need to try to reinvent the wheel, the way is the Operator Pattern and the useful packages provided by the official code-base that sometimes aren't so promoted in the hello-world examples. I'll provide a brief Kubernetes overview to help out your understanding of the context, with the goal of Capsule and the challenges I faced while writing the reconciliation loops for the resources that Operator aims to manage.