Skip to content

Commit 0c985d9

Browse files
authored
Merge pull request #698 from chrischdi/pr-fix-XMapTypeFlatten-cp-0.9
🐛 Fix crd flattening for structType marker to not create duplicate entries for XMapType
2 parents c8fc4d4 + f50232a commit 0c985d9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/crd/flatten.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ func flattenAllOfInto(dst *apiext.JSONSchemaProps, src apiext.JSONSchemaProps, e
143143
dstProps.Schema = &apiext.JSONSchemaProps{}
144144
}
145145
flattenAllOfInto(dstProps.Schema, *srcProps.Schema, errRec)
146+
case "XMapType":
147+
dstField.Set(srcField)
146148
// NB(directxman12): no need to explicitly handle nullable -- false is considered to be the zero value
147149
// TODO(directxman12): src isn't necessarily the field value -- it's just the most recent allOf entry
148150
default:

pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7277,9 +7277,6 @@ spec:
72777277
description: Checks that multiply-nested maps work
72787278
type: object
72797279
nestedStructWithSeveralFields:
7280-
allOf:
7281-
- x-kubernetes-map-type: atomic
7282-
- x-kubernetes-map-type: atomic
72837280
description: A struct that can only be entirely replaced via a nested
72847281
type.
72857282
properties:
@@ -7291,6 +7288,7 @@ spec:
72917288
- bar
72927289
- foo
72937290
type: object
7291+
x-kubernetes-map-type: atomic
72947292
nestedassociativeList:
72957293
description: This tests that associative lists work via a nested type.
72967294
items:

0 commit comments

Comments
 (0)