config/crds/kustomization.yaml (10 lines of code) (raw):
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This kustomization.yaml is not intended to be run by itself.
# It will be copied by the `manifests` Makefile target
# and the copied file will be edited to add CRDs as resources dynamically.
# The patch is to specifically set spec.preserveUnknownFields: false
# for compatibility with apiextensions.k8s.io/v1 CRDs. See more details
# here: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#field-pruning
# The reason that we have to use kustomize to patch this change is because
# go-yaml library will marshal CRD structs to bytes with spec.preserveUnknownFields field omitted
# because it has the golang default value `false` for bool type.
patches:
- patch: |-
- op: add
path: /spec/preserveUnknownFields
value: false
target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
name: ".*"