Cloud Native Rejekts EU (Valencia) 2022

Madhur Agarwal

Madhur Agarwal is a Member of Technical Staff 3 @VMware, who was introduced to the Kubernetes world in 2019. He recently received his kubernetes-sigs membership. Over the past few months, his work has been around Cluster API and its AWS provider.

The speaker's profile picture

Sessions

05-14
11:40
30min
How to write API conversions for Kubernetes CRDs?
Madhur Agarwal, Shivani Singhal

All Kubernetes projects need to define the APIs for CRDs and the lifecycle of each API generally starts with the alpha version. The API definition evolves over time and eventually moves to a stable version. But this evolution leads to multiple releases and each release should provide support for handling multiple API versions.

API changes between versions can include addition, deletion and renaming of fields in CRDs, but while introducing these changes we need to ensure stability and backward compatibility. To support multiple versions simultaneously, we write conversion functions that are used to convert API objects from one version to another. We have auto generating tools that help to write conversions but still we need manual intervention in many cases. There is a lack of resources on this topic so a lot of developers face difficulties when dealing with conversions, especially those who are newer to this ecosystem. Due to this, API changes become a complicated and time consuming experience which makes it a prominent issue for the majority of contributors because APIs and conversions are part of almost all k8s projects.

This talk aims to explain the concepts behind conversion functions and demonstrate how to write conversions for k8s CRDs.

Gallery