Skip to content

Commit f6c370c

Browse files
committed
Updated regex to account for exponentials and SI values
Signed-off-by: Arjun Naik <[email protected]>
1 parent 5c28250 commit f6c370c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pkg/crd/known_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ var KnownPackages = map[string]PackageOverride{
6060
{Type: "integer"},
6161
{Type: "string"},
6262
},
63-
Pattern: "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
63+
Pattern: "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
6464
}
6565
// No point in calling AddPackage, this is the sole inhabitant
6666
},

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ spec:
11091109
description: Specifies the output
11101110
format of the exposed resources,
11111111
defaults to "1"
1112-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1112+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
11131113
x-kubernetes-int-or-string: true
11141114
resource:
11151115
description: 'Required: resource
@@ -1774,7 +1774,7 @@ spec:
17741774
anyOf:
17751775
- type: integer
17761776
- type: string
1777-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1777+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
17781778
x-kubernetes-int-or-string: true
17791779
description: 'Limits describes the maximum
17801780
amount of compute resources allowed. More
@@ -1785,7 +1785,7 @@ spec:
17851785
anyOf:
17861786
- type: integer
17871787
- type: string
1788-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1788+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
17891789
x-kubernetes-int-or-string: true
17901790
description: 'Requests describes the minimum
17911791
amount of compute resources required.
@@ -2318,7 +2318,7 @@ spec:
23182318
description: Specifies the output
23192319
format of the exposed resources,
23202320
defaults to "1"
2321-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
2321+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
23222322
x-kubernetes-int-or-string: true
23232323
resource:
23242324
description: 'Required: resource
@@ -2983,7 +2983,7 @@ spec:
29832983
anyOf:
29842984
- type: integer
29852985
- type: string
2986-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
2986+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
29872987
x-kubernetes-int-or-string: true
29882988
description: 'Limits describes the maximum
29892989
amount of compute resources allowed. More
@@ -2994,7 +2994,7 @@ spec:
29942994
anyOf:
29952995
- type: integer
29962996
- type: string
2997-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
2997+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
29982998
x-kubernetes-int-or-string: true
29992999
description: 'Requests describes the minimum
30003000
amount of compute resources required.
@@ -3959,7 +3959,7 @@ spec:
39593959
description: Specifies the output
39603960
format of the exposed resources,
39613961
defaults to "1"
3962-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
3962+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
39633963
x-kubernetes-int-or-string: true
39643964
resource:
39653965
description: 'Required: resource
@@ -3999,7 +3999,7 @@ spec:
39993999
a pod. The default is nil which means
40004000
that the limit is undefined. More info:
40014001
http://kubernetes.io/docs/user-guide/volumes#emptydir'
4002-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
4002+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
40034003
x-kubernetes-int-or-string: true
40044004
type: object
40054005
fc:
@@ -4563,7 +4563,7 @@ spec:
45634563
the output format
45644564
of the exposed resources,
45654565
defaults to "1"
4566-
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTIE]i)|[mkMGTPE]|((\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
4566+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
45674567
x-kubernetes-int-or-string: true
45684568
resource:
45694569
description: 'Required:

0 commit comments

Comments
 (0)