File tree Expand file tree Collapse file tree 3 files changed +98
-3
lines changed Expand file tree Collapse file tree 3 files changed +98
-3
lines changed Original file line number Diff line number Diff line change @@ -643,3 +643,58 @@ spec:
643
643
assert .Equal (t , kubernetesapi .DefaultOpenAPI , openapi .GetSchemaVersion ())
644
644
})
645
645
}
646
+
647
+ // Tett for issue #5878
648
+ func TestCustomOpenApiFieldWithoutMergePatchExtension (t * testing.T ) {
649
+ runOpenApiTest (t , func (t * testing.T ) {
650
+ t .Helper ()
651
+ th := kusttest_test .MakeHarness (t )
652
+ writeTestSchema (th , "./" )
653
+ th .WriteF ("yetanothercrd_base.yaml" , `
654
+ apiVersion: example.com/v1alpha1
655
+ kind: MyCRD
656
+ metadata:
657
+ name: service
658
+ spec:
659
+ custom:
660
+ objects:
661
+ - name: foo
662
+ value: foo
663
+ - name: bar
664
+ value: bar
665
+ ` )
666
+ th .WriteF ("yetanothercrd_patch.yaml" , `
667
+ apiVersion: example.com/v1alpha1
668
+ kind: MyCRD
669
+ metadata:
670
+ name: service
671
+ spec:
672
+ custom:
673
+ objects:
674
+ - name: bar
675
+ value: patched
676
+ ` )
677
+ th .WriteK ("." , `
678
+ resources:
679
+ - yetanothercrd_base.yaml
680
+ openapi:
681
+ path: mycrd_schema.json
682
+ patches:
683
+ - path: yetanothercrd_patch.yaml
684
+ ` )
685
+ m := th .Run ("." , th .MakeDefaultOptions ())
686
+ th .AssertActualEqualsExpected (m , `
687
+ apiVersion: example.com/v1alpha1
688
+ kind: MyCRD
689
+ metadata:
690
+ name: service
691
+ spec:
692
+ custom:
693
+ objects:
694
+ - name: foo
695
+ value: foo
696
+ - name: bar
697
+ value: patched
698
+ ` )
699
+ })
700
+ }
Original file line number Diff line number Diff line change 15
15
"properties" : {
16
16
"template" : {
17
17
"$ref" : " #/definitions/io.k8s.api.core.v1.PodTemplateSpec"
18
+ },
19
+ "custom" : {
20
+ "$ref" : " #/definitions/com.example.v1alpha1.CustomSpec"
18
21
}
19
22
},
20
23
"type" : " object"
21
24
},
22
25
"status" : {
23
- "properties" : {
26
+ "properties" : {
24
27
"success" : {
25
28
"type" : " boolean"
26
29
}
89
92
"type" : " string"
90
93
},
91
94
"ports" : {
92
- "items" : {
95
+ "items" : {
93
96
"$ref" : " #/definitions/io.k8s.api.core.v1.ContainerPort"
94
97
},
95
98
"type" : " array" ,
105
108
"type" : " object"
106
109
},
107
110
"io.k8s.api.core.v1.ContainerPort" : {
108
- "properties" : {
111
+ "properties" : {
109
112
"containerPort" : {
110
113
"format" : " int32" ,
111
114
"type" : " integer"
118
121
}
119
122
},
120
123
"type" : " object"
124
+ },
125
+ "com.example.v1alpha1.CustomSpec" : {
126
+ "properties" : {
127
+ "objects" : {
128
+ "items" : {
129
+ "properties" : {
130
+ "name" : {
131
+ "type" : " string"
132
+ },
133
+ "value" : {
134
+ "type" : " string"
135
+ }
136
+ }
137
+ },
138
+ "type" : " array" ,
139
+ "x-kubernetes-list-map-keys" : [
140
+ " name"
141
+ ],
142
+ "x-kubernetes-list-type" : " map"
143
+ }
144
+ }
121
145
}
122
146
}
123
147
}
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ definitions:
11
11
properties :
12
12
template :
13
13
" $ref " : " #/definitions/io.k8s.api.core.v1.PodTemplateSpec"
14
+ custom :
15
+ " $ref " : " #/definitions/com.example.v1alpha1.CustomSpec"
14
16
type : object
15
17
status :
16
18
properties :
@@ -70,9 +72,23 @@ definitions:
70
72
io.k8s.api.core.v1.ContainerPort :
71
73
properties :
72
74
containerPort :
75
+ format : int32
73
76
type : integer
74
77
name :
75
78
type : string
76
79
protocol :
77
80
type : string
78
81
type : object
82
+ com.example.v1alpha1.CustomSpec :
83
+ properties :
84
+ objects :
85
+ items :
86
+ properties :
87
+ name :
88
+ type : string
89
+ value :
90
+ type : string
91
+ type : array
92
+ x-kubernetes-list-map-keys :
93
+ - name
94
+ x-kubernetes-list-type : map
You can’t perform that action at this time.
0 commit comments