K8s controller and CRD patterns in Python - kuryr-kubernetes case study
Channel: OpenInfra Foundation
Date: 2020-10-27

Special thanks to our 2020 Open Infrastructure Summit sponsors for making the event possible: Canonical (Ubuntu), Huawei, VEXXHOST, Cisco, Tencent Cloud, InMotion Hosting, Mirantis, Red Hat, Trilio, VanillaStack.io, and ZTE!
--

Kuryr-Kubernetes is an OpenStack project aiming at providing Neutron networking for K8s pods. In contrast to regular OpenStack projects like Nova or Cinder, Kuryr-Kubernetes behavior is driven by events happening in Kubernetes (e.g. Pod or Service being created) and not by user calling OpenStack REST API. A pattern when application acts upon events received from K8s API and adjusts environment state accordingly is called ""controller"" in K8s world. Moreover Kuryr does not use any database, but saves state of the environment in K8s itself using ""custom resources"" (sometimes called CRDs).

There are golang libraries making implementing those patterns easier, but Kuryr is (mainly) written in Python, meaning that we needed to reinvent the wheel a bit. In this presentation we'll tell you how to implement the controller pattern, what Python gotchas are there waiting for unsuspecting developer and what are the best practices.


Speakers: Michał Dulko, Maysa de Macedo Souza, Sarka Scavnicka
Track: Getting Started