Adding a required field to a live CRD
WHAT IT TESTS: CRD schema evolution. OUTLINE: don't make it required immediately; add it optional with a default, introduce a new version with conversion, migrate existing objects, then tighten.
WHAT IT TESTS: whether you can evolve a CRD schema safely. ANSWER OUTLINE: do not add the field as required in the existing version, since stored objects lacking it would fail validation. Instead add it as optional, ideally with a default so the API server backfills it, or introduce a new CRD version with a conversion webhook, migrate existing objects, then make the field required only in the newer version. Keep old versions served during transition. RED FLAG: marking the field required immediately and breaking all stored resources.
Read the original → interview
- #kubernetes
- #crd
- #versioning
- #schema-migration
- #conversion-webhook
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.