File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,14 @@ var TopologyMarkers = []*definitionWithHelp{
4242 WithHelp (StructType ("" ).Help ()),
4343 must (markers .MakeDefinition ("structType" , markers .DescribesType , StructType ("" ))).
4444 WithHelp (StructType ("" ).Help ()),
45+ must (markers .MakeDefinition ("k8s:listType" , markers .DescribesField , ListType ("" ))).
46+ WithHelp (ListType ("" ).Help ()),
47+ must (markers .MakeDefinition ("k8s:listType" , markers .DescribesType , ListType ("" ))).
48+ WithHelp (ListType ("" ).Help ()),
49+ must (markers .MakeDefinition ("k8s:listMapKey" , markers .DescribesField , ListMapKey ("" ))).
50+ WithHelp (ListMapKey ("" ).Help ()),
51+ must (markers .MakeDefinition ("k8s:listMapKey" , markers .DescribesType , ListMapKey ("" ))).
52+ WithHelp (ListMapKey ("" ).Help ()),
4553}
4654
4755func init () {
Original file line number Diff line number Diff line change @@ -212,9 +212,25 @@ type CronJobSpec struct {
212212 // +listMapKey=secondary
213213 AssociativeList []AssociativeType `json:"associativeList"`
214214
215+ // This tests that associative lists work using the +k8s:listType alias.
216+ // +k8s:listType=map
217+ // +k8s:listMapKey=name
218+ K8sAssociativeList []AssociativeType `json:"k8sAssociativeList"`
219+
220+ // This tests that +k8s:listType=set works.
221+ // +k8s:listType=set
222+ K8sSetList []string `json:"k8sSetList,omitempty"`
223+
224+ // This tests that +k8s:listType=atomic works.
225+ // +k8s:listType=atomic
226+ K8sAtomicList []string `json:"k8sAtomicList,omitempty"`
227+
215228 // This tests that associative lists work via a nested type.
216229 NestedAssociativeList NestedAssociativeList `json:"nestedassociativeList"`
217230
231+ // This tests that associative lists work via a nested type using the +k8s:listType alias.
232+ K8sNestedAssociativeList K8sNestedAssociativeList `json:"k8sNestedAssociativeList"`
233+
218234 // A map that allows different actors to manage different fields
219235 // +mapType=granular
220236 MapOfInfo map [string ][]byte `json:"mapOfInfo"`
@@ -555,6 +571,11 @@ type AssociativeType struct {
555571// +listMapKey=secondary
556572type NestedAssociativeList []AssociativeType
557573
574+ // +k8s:listType=map
575+ // +k8s:listMapKey=name
576+ // +k8s:listMapKey=secondary
577+ type K8sNestedAssociativeList []AssociativeType
578+
558579// +mapType=granular
559580type NestedMapOfInfo map [string ][]byte
560581
Original file line number Diff line number Diff line change @@ -9365,6 +9365,59 @@ spec:
93659365 - Forbid
93669366 - Replace
93679367 type: string
9368+ k8sAssociativeList:
9369+ description: This tests that associative lists work using the +k8s:listType
9370+ alias.
9371+ items:
9372+ properties:
9373+ foo:
9374+ type: string
9375+ name:
9376+ type: string
9377+ secondary:
9378+ type: integer
9379+ required:
9380+ - foo
9381+ - name
9382+ - secondary
9383+ type: object
9384+ type: array
9385+ x-kubernetes-list-map-keys:
9386+ - name
9387+ x-kubernetes-list-type: map
9388+ k8sAtomicList:
9389+ description: This tests that +k8s:listType=atomic works.
9390+ items:
9391+ type: string
9392+ type: array
9393+ x-kubernetes-list-type: atomic
9394+ k8sNestedAssociativeList:
9395+ description: This tests that associative lists work via a nested type
9396+ using the +k8s:listType alias.
9397+ items:
9398+ properties:
9399+ foo:
9400+ type: string
9401+ name:
9402+ type: string
9403+ secondary:
9404+ type: integer
9405+ required:
9406+ - foo
9407+ - name
9408+ - secondary
9409+ type: object
9410+ type: array
9411+ x-kubernetes-list-map-keys:
9412+ - name
9413+ - secondary
9414+ x-kubernetes-list-type: map
9415+ k8sSetList:
9416+ description: This tests that +k8s:listType=set works.
9417+ items:
9418+ type: string
9419+ type: array
9420+ x-kubernetes-list-type: set
93689421 kubernetesDefaultedEmptyMap:
93699422 additionalProperties:
93709423 type: string
@@ -9752,6 +9805,8 @@ spec:
97529805 - int32WithValidations
97539806 - intWithValidations
97549807 - jobTemplate
9808+ - k8sAssociativeList
9809+ - k8sNestedAssociativeList
97559810 - kubernetesDefaultedEmptyMap
97569811 - kubernetesDefaultedEmptyObject
97579812 - kubernetesDefaultedEmptySlice
You can’t perform that action at this time.
0 commit comments