Cloud Native Rejekts EU (Valencia) 2022

Shivani Singhal

Shivani Singhal is a Member of Technical Staff 3 @VMware, who has started her Kubernetes contribution since 2019. She graduated as a mentee from LFX Mentorship Program (previously known as community bridge). Currently she is actively contributing to the SIG cluster API lifecycle and working as a reviewer in Cluster API provider for AWS [CAPA]. When not glued to her laptop, she is mostly engaged in cooking stuff and with her doodle book.

The speaker's profile picture


How to write API conversions for Kubernetes CRDs?

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.