Skip to content

Commit 9f5478c

Browse files
committed
Correct generation of CRD for IntOrString type
1 parent 203239a commit 9f5478c

File tree

3 files changed

+85
-803
lines changed

3 files changed

+85
-803
lines changed

json-schema-generator/src/main/java/oracle/kubernetes/json/SchemaGenerator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,9 @@ private void generateEnumTypeIn(Map<String, Object> result, Class<? extends Enum
532532

533533
@SuppressWarnings("unchecked")
534534
private void generateTypeIn(Map<String, Object> result, Class<?> type) {
535-
if (isString(type) || type.getName().equals("io.kubernetes.client.custom.Quantity")) {
535+
if (type.getName().equals("io.kubernetes.client.custom.IntOrString")) {
536+
result.put("x-kubernetes-int-or-string", Boolean.TRUE);
537+
} else if (isString(type) || type.getName().equals("io.kubernetes.client.custom.Quantity")) {
536538
result.put(TYPE, STRING);
537539
} else if (isBoolean(type)) {
538540
result.put(TYPE, BOOLEAN);

kubernetes/crd/cluster-crd.yaml

Lines changed: 21 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: apiextensions.k8s.io/v1
55
kind: CustomResourceDefinition
66
metadata:
77
annotations:
8-
weblogic.sha256: f19085ef94808bd2579ce399e5958ea0607b8877fc2fd2dbe78151b3b240cc49
8+
weblogic.sha256: 92f4bc660f0ae071b59abb2e749d52dfa230fa4a814e11f9e5931120da8ff313
99
name: clusters.weblogic.oracle
1010
spec:
1111
group: weblogic.oracle
@@ -1246,16 +1246,7 @@ spec:
12461246
type: object
12471247
properties:
12481248
port:
1249-
type: object
1250-
properties:
1251-
intValue:
1252-
type: integer
1253-
isInt:
1254-
type: boolean
1255-
strValue:
1256-
type: string
1257-
required:
1258-
- isInt
1249+
x-kubernetes-int-or-string: true
12591250
host:
12601251
type: string
12611252
required:
@@ -1290,16 +1281,7 @@ spec:
12901281
scheme:
12911282
type: string
12921283
port:
1293-
type: object
1294-
properties:
1295-
intValue:
1296-
type: integer
1297-
isInt:
1298-
type: boolean
1299-
strValue:
1300-
type: string
1301-
required:
1302-
- isInt
1284+
x-kubernetes-int-or-string: true
13031285
host:
13041286
type: string
13051287
httpHeaders:
@@ -1407,16 +1389,7 @@ spec:
14071389
type: object
14081390
properties:
14091391
port:
1410-
type: object
1411-
properties:
1412-
intValue:
1413-
type: integer
1414-
isInt:
1415-
type: boolean
1416-
strValue:
1417-
type: string
1418-
required:
1419-
- isInt
1392+
x-kubernetes-int-or-string: true
14201393
host:
14211394
type: string
14221395
required:
@@ -1451,16 +1424,7 @@ spec:
14511424
scheme:
14521425
type: string
14531426
port:
1454-
type: object
1455-
properties:
1456-
intValue:
1457-
type: integer
1458-
isInt:
1459-
type: boolean
1460-
strValue:
1461-
type: string
1462-
required:
1463-
- isInt
1427+
x-kubernetes-int-or-string: true
14641428
host:
14651429
type: string
14661430
httpHeaders:
@@ -1588,16 +1552,7 @@ spec:
15881552
type: object
15891553
properties:
15901554
port:
1591-
type: object
1592-
properties:
1593-
intValue:
1594-
type: integer
1595-
isInt:
1596-
type: boolean
1597-
strValue:
1598-
type: string
1599-
required:
1600-
- isInt
1555+
x-kubernetes-int-or-string: true
16011556
host:
16021557
type: string
16031558
required:
@@ -1617,16 +1572,7 @@ spec:
16171572
scheme:
16181573
type: string
16191574
port:
1620-
type: object
1621-
properties:
1622-
intValue:
1623-
type: integer
1624-
isInt:
1625-
type: boolean
1626-
strValue:
1627-
type: string
1628-
required:
1629-
- isInt
1575+
x-kubernetes-int-or-string: true
16301576
host:
16311577
type: string
16321578
httpHeaders:
@@ -1650,16 +1596,7 @@ spec:
16501596
type: object
16511597
properties:
16521598
port:
1653-
type: object
1654-
properties:
1655-
intValue:
1656-
type: integer
1657-
isInt:
1658-
type: boolean
1659-
strValue:
1660-
type: string
1661-
required:
1662-
- isInt
1599+
x-kubernetes-int-or-string: true
16631600
host:
16641601
type: string
16651602
required:
@@ -1679,16 +1616,7 @@ spec:
16791616
scheme:
16801617
type: string
16811618
port:
1682-
type: object
1683-
properties:
1684-
intValue:
1685-
type: integer
1686-
isInt:
1687-
type: boolean
1688-
strValue:
1689-
type: string
1690-
required:
1691-
- isInt
1619+
x-kubernetes-int-or-string: true
16921620
host:
16931621
type: string
16941622
httpHeaders:
@@ -1722,16 +1650,7 @@ spec:
17221650
type: object
17231651
properties:
17241652
port:
1725-
type: object
1726-
properties:
1727-
intValue:
1728-
type: integer
1729-
isInt:
1730-
type: boolean
1731-
strValue:
1732-
type: string
1733-
required:
1734-
- isInt
1653+
x-kubernetes-int-or-string: true
17351654
host:
17361655
type: string
17371656
required:
@@ -1766,16 +1685,7 @@ spec:
17661685
scheme:
17671686
type: string
17681687
port:
1769-
type: object
1770-
properties:
1771-
intValue:
1772-
type: integer
1773-
isInt:
1774-
type: boolean
1775-
strValue:
1776-
type: string
1777-
required:
1778-
- isInt
1688+
x-kubernetes-int-or-string: true
17791689
host:
17801690
type: string
17811691
httpHeaders:
@@ -1853,16 +1763,7 @@ spec:
18531763
type: object
18541764
properties:
18551765
port:
1856-
type: object
1857-
properties:
1858-
intValue:
1859-
type: integer
1860-
isInt:
1861-
type: boolean
1862-
strValue:
1863-
type: string
1864-
required:
1865-
- isInt
1766+
x-kubernetes-int-or-string: true
18661767
host:
18671768
type: string
18681769
required:
@@ -1897,16 +1798,7 @@ spec:
18971798
scheme:
18981799
type: string
18991800
port:
1900-
type: object
1901-
properties:
1902-
intValue:
1903-
type: integer
1904-
isInt:
1905-
type: boolean
1906-
strValue:
1907-
type: string
1908-
required:
1909-
- isInt
1801+
x-kubernetes-int-or-string: true
19101802
host:
19111803
type: string
19121804
httpHeaders:
@@ -2014,16 +1906,7 @@ spec:
20141906
type: object
20151907
properties:
20161908
port:
2017-
type: object
2018-
properties:
2019-
intValue:
2020-
type: integer
2021-
isInt:
2022-
type: boolean
2023-
strValue:
2024-
type: string
2025-
required:
2026-
- isInt
1909+
x-kubernetes-int-or-string: true
20271910
host:
20281911
type: string
20291912
required:
@@ -2058,16 +1941,7 @@ spec:
20581941
scheme:
20591942
type: string
20601943
port:
2061-
type: object
2062-
properties:
2063-
intValue:
2064-
type: integer
2065-
isInt:
2066-
type: boolean
2067-
strValue:
2068-
type: string
2069-
required:
2070-
- isInt
1944+
x-kubernetes-int-or-string: true
20711945
host:
20721946
type: string
20731947
httpHeaders:
@@ -2195,16 +2069,7 @@ spec:
21952069
type: object
21962070
properties:
21972071
port:
2198-
type: object
2199-
properties:
2200-
intValue:
2201-
type: integer
2202-
isInt:
2203-
type: boolean
2204-
strValue:
2205-
type: string
2206-
required:
2207-
- isInt
2072+
x-kubernetes-int-or-string: true
22082073
host:
22092074
type: string
22102075
required:
@@ -2224,16 +2089,7 @@ spec:
22242089
scheme:
22252090
type: string
22262091
port:
2227-
type: object
2228-
properties:
2229-
intValue:
2230-
type: integer
2231-
isInt:
2232-
type: boolean
2233-
strValue:
2234-
type: string
2235-
required:
2236-
- isInt
2092+
x-kubernetes-int-or-string: true
22372093
host:
22382094
type: string
22392095
httpHeaders:
@@ -2257,16 +2113,7 @@ spec:
22572113
type: object
22582114
properties:
22592115
port:
2260-
type: object
2261-
properties:
2262-
intValue:
2263-
type: integer
2264-
isInt:
2265-
type: boolean
2266-
strValue:
2267-
type: string
2268-
required:
2269-
- isInt
2116+
x-kubernetes-int-or-string: true
22702117
host:
22712118
type: string
22722119
required:
@@ -2286,16 +2133,7 @@ spec:
22862133
scheme:
22872134
type: string
22882135
port:
2289-
type: object
2290-
properties:
2291-
intValue:
2292-
type: integer
2293-
isInt:
2294-
type: boolean
2295-
strValue:
2296-
type: string
2297-
required:
2298-
- isInt
2136+
x-kubernetes-int-or-string: true
22992137
host:
23002138
type: string
23012139
httpHeaders:
@@ -2329,16 +2167,7 @@ spec:
23292167
type: object
23302168
properties:
23312169
port:
2332-
type: object
2333-
properties:
2334-
intValue:
2335-
type: integer
2336-
isInt:
2337-
type: boolean
2338-
strValue:
2339-
type: string
2340-
required:
2341-
- isInt
2170+
x-kubernetes-int-or-string: true
23422171
host:
23432172
type: string
23442173
required:
@@ -2373,16 +2202,7 @@ spec:
23732202
scheme:
23742203
type: string
23752204
port:
2376-
type: object
2377-
properties:
2378-
intValue:
2379-
type: integer
2380-
isInt:
2381-
type: boolean
2382-
strValue:
2383-
type: string
2384-
required:
2385-
- isInt
2205+
x-kubernetes-int-or-string: true
23862206
host:
23872207
type: string
23882208
httpHeaders:

0 commit comments

Comments
 (0)