Documentation ¶
Overview ¶
This program removes descriptions from the input CRD yaml to reduce its size.
Why ¶
When CRD is applied via `kubectl apply -f docs/stackset_crd.yaml` (aka client-side apply) kubectl stores CRD content into the kubectl.kubernetes.io/last-applied-configuration annotation which has size limit of 262144 bytes. If the size of the annotation exceeds the limit, kubectl will fail with the following error:
The CustomResourceDefinition "stacksets.zalando.org" is invalid: metadata.annotations: Too long: must have at most 262144 bytes
See https://github.com/kubernetes/kubectl/issues/712
The CRD contains a lot of descriptions for k8s.io types and controller-gen does not allow to skip descriptions per field or per package, see https://github.com/kubernetes-sigs/controller-tools/issues/441
How ¶
It removes descriptions starting at the deepest level of the yaml tree until the size of the yaml converted to json is less than the maximum allowed annotation size.