Skip to content

Commit e2087ee

Browse files
authored
Merge pull request #360 from kmodules/intstr
🐛 Update known_types to add x-kubernetes-int-or-string for intStr
2 parents ae6b39a + 863f62a commit e2087ee

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

pkg/crd/known_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ var KnownPackages = map[string]PackageOverride{
7777

7878
"k8s.io/apimachinery/pkg/util/intstr": func(p *Parser, pkg *loader.Package) {
7979
p.Schemata[TypeIdent{Name: "IntOrString", Package: pkg}] = apiext.JSONSchemaProps{
80+
XIntOrString: true,
8081
AnyOf: []apiext.JSONSchemaProps{
81-
{Type: "string"},
8282
{Type: "integer"},
83+
{Type: "string"},
8384
},
8485
}
8586
// No point in calling AddPackage, this is the sole inhabitant

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

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,12 +1258,13 @@ spec:
12581258
type: string
12591259
port:
12601260
anyOf:
1261-
- type: string
12621261
- type: integer
1262+
- type: string
12631263
description: Name or number of the
12641264
port to access on the container.
12651265
Number must be in the range 1
12661266
to 65535. Name must be an IANA_SVC_NAME.
1267+
x-kubernetes-int-or-string: true
12671268
scheme:
12681269
description: Scheme to use for connecting
12691270
to the host. Defaults to HTTP.
@@ -1284,12 +1285,13 @@ spec:
12841285
type: string
12851286
port:
12861287
anyOf:
1287-
- type: string
12881288
- type: integer
1289+
- type: string
12891290
description: Number or name of the
12901291
port to access on the container.
12911292
Number must be in the range 1
12921293
to 65535. Name must be an IANA_SVC_NAME.
1294+
x-kubernetes-int-or-string: true
12931295
required:
12941296
- port
12951297
type: object
@@ -1373,12 +1375,13 @@ spec:
13731375
type: string
13741376
port:
13751377
anyOf:
1376-
- type: string
13771378
- type: integer
1379+
- type: string
13781380
description: Name or number of the
13791381
port to access on the container.
13801382
Number must be in the range 1
13811383
to 65535. Name must be an IANA_SVC_NAME.
1384+
x-kubernetes-int-or-string: true
13821385
scheme:
13831386
description: Scheme to use for connecting
13841387
to the host. Defaults to HTTP.
@@ -1399,12 +1402,13 @@ spec:
13991402
type: string
14001403
port:
14011404
anyOf:
1402-
- type: string
14031405
- type: integer
1406+
- type: string
14041407
description: Number or name of the
14051408
port to access on the container.
14061409
Number must be in the range 1
14071410
to 65535. Name must be an IANA_SVC_NAME.
1411+
x-kubernetes-int-or-string: true
14081412
required:
14091413
- port
14101414
type: object
@@ -1481,12 +1485,13 @@ spec:
14811485
type: string
14821486
port:
14831487
anyOf:
1484-
- type: string
14851488
- type: integer
1489+
- type: string
14861490
description: Name or number of the port
14871491
to access on the container. Number
14881492
must be in the range 1 to 65535. Name
14891493
must be an IANA_SVC_NAME.
1494+
x-kubernetes-int-or-string: true
14901495
scheme:
14911496
description: Scheme to use for connecting
14921497
to the host. Defaults to HTTP.
@@ -1525,12 +1530,13 @@ spec:
15251530
type: string
15261531
port:
15271532
anyOf:
1528-
- type: string
15291533
- type: integer
1534+
- type: string
15301535
description: Number or name of the port
15311536
to access on the container. Number
15321537
must be in the range 1 to 65535. Name
15331538
must be an IANA_SVC_NAME.
1539+
x-kubernetes-int-or-string: true
15341540
required:
15351541
- port
15361542
type: object
@@ -1668,12 +1674,13 @@ spec:
16681674
type: string
16691675
port:
16701676
anyOf:
1671-
- type: string
16721677
- type: integer
1678+
- type: string
16731679
description: Name or number of the port
16741680
to access on the container. Number
16751681
must be in the range 1 to 65535. Name
16761682
must be an IANA_SVC_NAME.
1683+
x-kubernetes-int-or-string: true
16771684
scheme:
16781685
description: Scheme to use for connecting
16791686
to the host. Defaults to HTTP.
@@ -1712,12 +1719,13 @@ spec:
17121719
type: string
17131720
port:
17141721
anyOf:
1715-
- type: string
17161722
- type: integer
1723+
- type: string
17171724
description: Number or name of the port
17181725
to access on the container. Number
17191726
must be in the range 1 to 65535. Name
17201727
must be an IANA_SVC_NAME.
1728+
x-kubernetes-int-or-string: true
17211729
required:
17221730
- port
17231731
type: object
@@ -2443,12 +2451,13 @@ spec:
24432451
type: string
24442452
port:
24452453
anyOf:
2446-
- type: string
24472454
- type: integer
2455+
- type: string
24482456
description: Name or number of the
24492457
port to access on the container.
24502458
Number must be in the range 1
24512459
to 65535. Name must be an IANA_SVC_NAME.
2460+
x-kubernetes-int-or-string: true
24522461
scheme:
24532462
description: Scheme to use for connecting
24542463
to the host. Defaults to HTTP.
@@ -2469,12 +2478,13 @@ spec:
24692478
type: string
24702479
port:
24712480
anyOf:
2472-
- type: string
24732481
- type: integer
2482+
- type: string
24742483
description: Number or name of the
24752484
port to access on the container.
24762485
Number must be in the range 1
24772486
to 65535. Name must be an IANA_SVC_NAME.
2487+
x-kubernetes-int-or-string: true
24782488
required:
24792489
- port
24802490
type: object
@@ -2558,12 +2568,13 @@ spec:
25582568
type: string
25592569
port:
25602570
anyOf:
2561-
- type: string
25622571
- type: integer
2572+
- type: string
25632573
description: Name or number of the
25642574
port to access on the container.
25652575
Number must be in the range 1
25662576
to 65535. Name must be an IANA_SVC_NAME.
2577+
x-kubernetes-int-or-string: true
25672578
scheme:
25682579
description: Scheme to use for connecting
25692580
to the host. Defaults to HTTP.
@@ -2584,12 +2595,13 @@ spec:
25842595
type: string
25852596
port:
25862597
anyOf:
2587-
- type: string
25882598
- type: integer
2599+
- type: string
25892600
description: Number or name of the
25902601
port to access on the container.
25912602
Number must be in the range 1
25922603
to 65535. Name must be an IANA_SVC_NAME.
2604+
x-kubernetes-int-or-string: true
25932605
required:
25942606
- port
25952607
type: object
@@ -2666,12 +2678,13 @@ spec:
26662678
type: string
26672679
port:
26682680
anyOf:
2669-
- type: string
26702681
- type: integer
2682+
- type: string
26712683
description: Name or number of the port
26722684
to access on the container. Number
26732685
must be in the range 1 to 65535. Name
26742686
must be an IANA_SVC_NAME.
2687+
x-kubernetes-int-or-string: true
26752688
scheme:
26762689
description: Scheme to use for connecting
26772690
to the host. Defaults to HTTP.
@@ -2710,12 +2723,13 @@ spec:
27102723
type: string
27112724
port:
27122725
anyOf:
2713-
- type: string
27142726
- type: integer
2727+
- type: string
27152728
description: Number or name of the port
27162729
to access on the container. Number
27172730
must be in the range 1 to 65535. Name
27182731
must be an IANA_SVC_NAME.
2732+
x-kubernetes-int-or-string: true
27192733
required:
27202734
- port
27212735
type: object
@@ -2853,12 +2867,13 @@ spec:
28532867
type: string
28542868
port:
28552869
anyOf:
2856-
- type: string
28572870
- type: integer
2871+
- type: string
28582872
description: Name or number of the port
28592873
to access on the container. Number
28602874
must be in the range 1 to 65535. Name
28612875
must be an IANA_SVC_NAME.
2876+
x-kubernetes-int-or-string: true
28622877
scheme:
28632878
description: Scheme to use for connecting
28642879
to the host. Defaults to HTTP.
@@ -2897,12 +2912,13 @@ spec:
28972912
type: string
28982913
port:
28992914
anyOf:
2900-
- type: string
29012915
- type: integer
2916+
- type: string
29022917
description: Number or name of the port
29032918
to access on the container. Number
29042919
must be in the range 1 to 65535. Name
29052920
must be an IANA_SVC_NAME.
2921+
x-kubernetes-int-or-string: true
29062922
required:
29072923
- port
29082924
type: object

0 commit comments

Comments
 (0)