Skip to content

Commit d02ad67

Browse files
committed
Correct generation of CRD for IntOrString type
1 parent ebd8d87 commit d02ad67

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: 6311454b6deaa86c76ae65d87f7c798e54217136f91d40dc94a0ed23c0503253
8+
weblogic.sha256: 219913ed6ac7585d8f01ef56b0c2fc84f6cf8de7907a11e1ec1391bd8e70c922
99
name: clusters.weblogic.oracle
1010
spec:
1111
group: weblogic.oracle
@@ -1273,16 +1273,7 @@ spec:
12731273
type: object
12741274
properties:
12751275
port:
1276-
type: object
1277-
properties:
1278-
intValue:
1279-
type: integer
1280-
isInt:
1281-
type: boolean
1282-
strValue:
1283-
type: string
1284-
required:
1285-
- isInt
1276+
x-kubernetes-int-or-string: true
12861277
host:
12871278
type: string
12881279
required:
@@ -1317,16 +1308,7 @@ spec:
13171308
scheme:
13181309
type: string
13191310
port:
1320-
type: object
1321-
properties:
1322-
intValue:
1323-
type: integer
1324-
isInt:
1325-
type: boolean
1326-
strValue:
1327-
type: string
1328-
required:
1329-
- isInt
1311+
x-kubernetes-int-or-string: true
13301312
host:
13311313
type: string
13321314
httpHeaders:
@@ -1434,16 +1416,7 @@ spec:
14341416
type: object
14351417
properties:
14361418
port:
1437-
type: object
1438-
properties:
1439-
intValue:
1440-
type: integer
1441-
isInt:
1442-
type: boolean
1443-
strValue:
1444-
type: string
1445-
required:
1446-
- isInt
1419+
x-kubernetes-int-or-string: true
14471420
host:
14481421
type: string
14491422
required:
@@ -1478,16 +1451,7 @@ spec:
14781451
scheme:
14791452
type: string
14801453
port:
1481-
type: object
1482-
properties:
1483-
intValue:
1484-
type: integer
1485-
isInt:
1486-
type: boolean
1487-
strValue:
1488-
type: string
1489-
required:
1490-
- isInt
1454+
x-kubernetes-int-or-string: true
14911455
host:
14921456
type: string
14931457
httpHeaders:
@@ -1615,16 +1579,7 @@ spec:
16151579
type: object
16161580
properties:
16171581
port:
1618-
type: object
1619-
properties:
1620-
intValue:
1621-
type: integer
1622-
isInt:
1623-
type: boolean
1624-
strValue:
1625-
type: string
1626-
required:
1627-
- isInt
1582+
x-kubernetes-int-or-string: true
16281583
host:
16291584
type: string
16301585
required:
@@ -1644,16 +1599,7 @@ spec:
16441599
scheme:
16451600
type: string
16461601
port:
1647-
type: object
1648-
properties:
1649-
intValue:
1650-
type: integer
1651-
isInt:
1652-
type: boolean
1653-
strValue:
1654-
type: string
1655-
required:
1656-
- isInt
1602+
x-kubernetes-int-or-string: true
16571603
host:
16581604
type: string
16591605
httpHeaders:
@@ -1677,16 +1623,7 @@ spec:
16771623
type: object
16781624
properties:
16791625
port:
1680-
type: object
1681-
properties:
1682-
intValue:
1683-
type: integer
1684-
isInt:
1685-
type: boolean
1686-
strValue:
1687-
type: string
1688-
required:
1689-
- isInt
1626+
x-kubernetes-int-or-string: true
16901627
host:
16911628
type: string
16921629
required:
@@ -1706,16 +1643,7 @@ spec:
17061643
scheme:
17071644
type: string
17081645
port:
1709-
type: object
1710-
properties:
1711-
intValue:
1712-
type: integer
1713-
isInt:
1714-
type: boolean
1715-
strValue:
1716-
type: string
1717-
required:
1718-
- isInt
1646+
x-kubernetes-int-or-string: true
17191647
host:
17201648
type: string
17211649
httpHeaders:
@@ -1749,16 +1677,7 @@ spec:
17491677
type: object
17501678
properties:
17511679
port:
1752-
type: object
1753-
properties:
1754-
intValue:
1755-
type: integer
1756-
isInt:
1757-
type: boolean
1758-
strValue:
1759-
type: string
1760-
required:
1761-
- isInt
1680+
x-kubernetes-int-or-string: true
17621681
host:
17631682
type: string
17641683
required:
@@ -1793,16 +1712,7 @@ spec:
17931712
scheme:
17941713
type: string
17951714
port:
1796-
type: object
1797-
properties:
1798-
intValue:
1799-
type: integer
1800-
isInt:
1801-
type: boolean
1802-
strValue:
1803-
type: string
1804-
required:
1805-
- isInt
1715+
x-kubernetes-int-or-string: true
18061716
host:
18071717
type: string
18081718
httpHeaders:
@@ -1880,16 +1790,7 @@ spec:
18801790
type: object
18811791
properties:
18821792
port:
1883-
type: object
1884-
properties:
1885-
intValue:
1886-
type: integer
1887-
isInt:
1888-
type: boolean
1889-
strValue:
1890-
type: string
1891-
required:
1892-
- isInt
1793+
x-kubernetes-int-or-string: true
18931794
host:
18941795
type: string
18951796
required:
@@ -1924,16 +1825,7 @@ spec:
19241825
scheme:
19251826
type: string
19261827
port:
1927-
type: object
1928-
properties:
1929-
intValue:
1930-
type: integer
1931-
isInt:
1932-
type: boolean
1933-
strValue:
1934-
type: string
1935-
required:
1936-
- isInt
1828+
x-kubernetes-int-or-string: true
19371829
host:
19381830
type: string
19391831
httpHeaders:
@@ -2041,16 +1933,7 @@ spec:
20411933
type: object
20421934
properties:
20431935
port:
2044-
type: object
2045-
properties:
2046-
intValue:
2047-
type: integer
2048-
isInt:
2049-
type: boolean
2050-
strValue:
2051-
type: string
2052-
required:
2053-
- isInt
1936+
x-kubernetes-int-or-string: true
20541937
host:
20551938
type: string
20561939
required:
@@ -2085,16 +1968,7 @@ spec:
20851968
scheme:
20861969
type: string
20871970
port:
2088-
type: object
2089-
properties:
2090-
intValue:
2091-
type: integer
2092-
isInt:
2093-
type: boolean
2094-
strValue:
2095-
type: string
2096-
required:
2097-
- isInt
1971+
x-kubernetes-int-or-string: true
20981972
host:
20991973
type: string
21001974
httpHeaders:
@@ -2222,16 +2096,7 @@ spec:
22222096
type: object
22232097
properties:
22242098
port:
2225-
type: object
2226-
properties:
2227-
intValue:
2228-
type: integer
2229-
isInt:
2230-
type: boolean
2231-
strValue:
2232-
type: string
2233-
required:
2234-
- isInt
2099+
x-kubernetes-int-or-string: true
22352100
host:
22362101
type: string
22372102
required:
@@ -2251,16 +2116,7 @@ spec:
22512116
scheme:
22522117
type: string
22532118
port:
2254-
type: object
2255-
properties:
2256-
intValue:
2257-
type: integer
2258-
isInt:
2259-
type: boolean
2260-
strValue:
2261-
type: string
2262-
required:
2263-
- isInt
2119+
x-kubernetes-int-or-string: true
22642120
host:
22652121
type: string
22662122
httpHeaders:
@@ -2284,16 +2140,7 @@ spec:
22842140
type: object
22852141
properties:
22862142
port:
2287-
type: object
2288-
properties:
2289-
intValue:
2290-
type: integer
2291-
isInt:
2292-
type: boolean
2293-
strValue:
2294-
type: string
2295-
required:
2296-
- isInt
2143+
x-kubernetes-int-or-string: true
22972144
host:
22982145
type: string
22992146
required:
@@ -2313,16 +2160,7 @@ spec:
23132160
scheme:
23142161
type: string
23152162
port:
2316-
type: object
2317-
properties:
2318-
intValue:
2319-
type: integer
2320-
isInt:
2321-
type: boolean
2322-
strValue:
2323-
type: string
2324-
required:
2325-
- isInt
2163+
x-kubernetes-int-or-string: true
23262164
host:
23272165
type: string
23282166
httpHeaders:
@@ -2356,16 +2194,7 @@ spec:
23562194
type: object
23572195
properties:
23582196
port:
2359-
type: object
2360-
properties:
2361-
intValue:
2362-
type: integer
2363-
isInt:
2364-
type: boolean
2365-
strValue:
2366-
type: string
2367-
required:
2368-
- isInt
2197+
x-kubernetes-int-or-string: true
23692198
host:
23702199
type: string
23712200
required:
@@ -2400,16 +2229,7 @@ spec:
24002229
scheme:
24012230
type: string
24022231
port:
2403-
type: object
2404-
properties:
2405-
intValue:
2406-
type: integer
2407-
isInt:
2408-
type: boolean
2409-
strValue:
2410-
type: string
2411-
required:
2412-
- isInt
2232+
x-kubernetes-int-or-string: true
24132233
host:
24142234
type: string
24152235
httpHeaders:

0 commit comments

Comments
 (0)