During the virtual Open Infra Summit in October 2020. BigdataStack partner RedHat presented the session titled "K8s controller and CRD patterns in Python - kuryr-kubernetes case study".
Kuryr and the adaption of Kubernetes models
Red Hat points us to the latest developments mentioned at the conference and specifically highlights this article on AT&T, Verizon 5G Deployments Boost OpenStack Work
which dedicates a couple of paragraphs on Kuryr and the adoption of Kubernetes models (CRDs):
“The biggest move was the release of Victoria, which is the 22nd OpenStack release. Victoria builds on the previous Ussuri launch with more than 20,000 code changes that include native integration with Kubernetes and more support for diverse infrastructure deployments.
The Kubernetes integration is on the back of the Kuryr container networking plugin. It acts as the link that delivers the OpenStack networking into containers. Kuryr now has support for customer resource definitions (CRDs) that remove the need for it to use annotations to store data about OpenStack objects in the Kubernetes API.
“Kuryr has adopted this as the way that it passes information back and forth between the underlying infrastructure that a Kubernetes cluster may be running on and the Kubernetes environment itself,” explained OSF Executive Director Jonathan Bryce, in a press briefing. “This is great because it brings the two systems closer together using the native components on each side.”
Kuryr and the adoption of Kubernetes models in BigDataStack
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 the 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 developers and what are the best practices.
The Kuryr-Kuberneres has been used in the first testbed of BigDataStack to improve the network performance.