diff --git a/slides/k8s/crd.md b/slides/k8s/crd.md index b5bab7e0..be468413 100644 --- a/slides/k8s/crd.md +++ b/slides/k8s/crd.md @@ -24,6 +24,32 @@ --- +## A bit of history + +Things related to Custom Resource Definitions: + +- Kubernetes 1.??: `apiextensions.k8s.io/v1beta1` introduced + +- Kubernetes 1.16: `apiextensions.k8s.io/v1` introduced + +- Kubernetes 1.22: `apiextensions.k8s.io/v1beta1` [removed][changes-in-122] + +- Kubernetes 1.25: [CEL validation rules available in beta][crd-validation-rules-beta] + +- Kubernetes 1.28: [validation ratcheting][validation-ratcheting] in [alpha][feature-gates] + +- Kubernetes 1.29: [CEL validation rules available in GA][cel-validation-rules] + +- Kubernetes 1.30: [validation ratcheting][validation-ratcheting] in [beta][feature-gates]; enabled by default + +[crd-validation-rules-beta]: https://kubernetes.io/blog/2022/09/23/crd-validation-rules-beta/ +[cel-validation-rules]: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#validation-rules +[validation-ratcheting]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/4008-crd-ratcheting +[feature-gates]: https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#feature-gates-for-alpha-or-beta-features +[changes-in-122]: https://kubernetes.io/blog/2021/07/14/upcoming-changes-in-kubernetes-1-22/ + +--- + ## First slice of pizza ```yaml @@ -42,8 +68,6 @@ (a few optional things become mandatory, see [this guide](https://kubernetes.io/docs/reference/using-api/deprecation-guide/#customresourcedefinition-v122) for details) -- `apiextensions.k8s.io/v1beta1` is available since Kubernetes 1.16 - --- ## Second slice of pizza @@ -96,9 +120,9 @@ The YAML below defines a resource using the CRD that we just created: kind: Pizza apiVersion: container.training/v1alpha1 metadata: - name: napolitana + name: hawaiian spec: - toppings: [ mozzarella ] + toppings: [ cheese, ham, pineapple ] ``` .lab[ @@ -114,11 +138,7 @@ spec: ## Type validation -- Older versions of Kubernetes will accept our pizza definition as is - -- Newer versions, however, will issue warnings about unknown fields - - (and if we use `--validate=false`, these fields will simply be dropped) +- Recent versions of Kubernetes will issue errors about unknown fields - We need to improve our OpenAPI schema @@ -126,6 +146,28 @@ spec: --- +## Creating a bland pizza + +- Let's try to create a pizza anyway! + +.lab[ + +- Only provide the most basic YAML manifest: + ```bash + kubectl create -f- <