forked from rook/rook
ceph: preserve volume claim template metadata in schema
The schema generation was not generating the metadata properties under the VolumeClaimTemplate type, resulting in the properties being ignored by the api server. The preserve unknown fields tag was not working recursively on the volumeClaimTemplates since the subtypes were defined. Now we post-process the schema so we can preserve the unknown fields for the volume claim templates metadata. Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
@@ -47,6 +47,7 @@ copy_ob_obc_crds() {
|
||||
generating_crds_v1() {
|
||||
echo "Generating v1 in crds.yaml"
|
||||
"$CONTROLLER_GEN_BIN_PATH" "$CRD_OPTIONS" paths="./pkg/apis/ceph.rook.io/v1" output:crd:artifacts:config="$OLM_CATALOG_DIR"
|
||||
sed -i'' -e "s/\( *\)\(description: 'Standard object''s metadata. More info: https:\/\/git.k8s.io\/community\/contributors\/devel\/sig-architecture\/api-conventions.md#metadata'\)/\1\2\n\1x-kubernetes-preserve-unknown-fields: true/" cluster/olm/ceph/deploy/crds/ceph.rook.io_cephclusters.yaml
|
||||
}
|
||||
|
||||
generating_crds_v1alpha2() {
|
||||
@@ -75,13 +76,13 @@ build_helm_resources() {
|
||||
# add header
|
||||
echo "{{- if .Values.crds.enabled }}"
|
||||
echo "{{- if semverCompare \">=1.16.0\" .Capabilities.KubeVersion.GitVersion }}"
|
||||
|
||||
|
||||
# Add helm annotations to all CRDS and skip the first 4 lines of crds.yaml
|
||||
"$YQ_BIN_PATH" w -d'*' "$CRDS_FILE_PATH" "metadata.annotations[helm.sh/resource-policy]" keep | tail -n +5
|
||||
|
||||
|
||||
# add else
|
||||
echo "{{- else }}"
|
||||
|
||||
|
||||
# add footer
|
||||
cat "$CRDS_BEFORE_1_16_FILE_PATH"
|
||||
# DO NOT REMOVE the empty line, it is necessary
|
||||
|
||||
@@ -817,6 +817,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
@@ -971,6 +972,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
@@ -1792,6 +1794,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
@@ -2838,6 +2841,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
@@ -3003,6 +3007,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
|
||||
@@ -820,6 +820,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
@@ -974,6 +975,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
@@ -1795,6 +1797,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
@@ -2841,6 +2844,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
@@ -3006,6 +3010,7 @@ spec:
|
||||
type: string
|
||||
metadata:
|
||||
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
spec:
|
||||
description: 'Spec defines the desired characteristics of a volume requested by a pod author. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims'
|
||||
|
||||
Reference in New Issue
Block a user