(fix) make regex for resources more strict (#1072)
* make regex for resources more strict * Update validation docs * Review feedback
This commit is contained in:
@@ -15,8 +15,8 @@ Accepted formats are:
|
|||||||
- Float (eg. `0.5`) - This means half hyperthread
|
- Float (eg. `0.5`) - This means half hyperthread
|
||||||
- Milicpu (eg. `500m`) This means also half hyperthread
|
- Milicpu (eg. `500m`) This means also half hyperthread
|
||||||
|
|
||||||
Regex used to match those: `^([0-9]+)(\.[0-9]?|m?)$`
|
Regex used to match those: `^(?!^0(\.0|m|)$)([0-9]+)(\.[0-9]|m?)$`
|
||||||
You can try live [here](https://regex101.com/r/pFoJTx/1)
|
You can try live [here](https://regex101.com/r/WxComc/1)
|
||||||
More detailed info can be found [here](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu)
|
More detailed info can be found [here](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu)
|
||||||
|
|
||||||
__`Memory RAM`__
|
__`Memory RAM`__
|
||||||
@@ -27,8 +27,8 @@ Accepted formats are:
|
|||||||
- Plain integer (eg. `134217728`) - This means 128Megabyte of RAM
|
- Plain integer (eg. `134217728`) - This means 128Megabyte of RAM
|
||||||
- As an exponent format (eg. `134e6`) This means ~128Megabyte of RAM
|
- As an exponent format (eg. `134e6`) This means ~128Megabyte of RAM
|
||||||
|
|
||||||
Regex uesd to match those: `^([0-9.]+)([EPTGMK]i?|[EPTGMK]?|e[0-9]+)$`
|
Regex uesd to match those: `^(?!^0(e[0-9]|[EPTGMK]i?|)$)([0-9]+)(|[EPTGMK]i?|e[0-9]+)$`
|
||||||
You can try live [here](https://regex101.com/r/TUkZhN/1)
|
You can try live [here](https://regex101.com/r/LyDc6u/1)
|
||||||
More detailed info can be found [here](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory)
|
More detailed info can be found [here](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,13 @@
|
|||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: "4000m"
|
default: "4000m"
|
||||||
valid_chars: '^([0-9]+)(\.[0-9]?|m?)$'
|
valid_chars: '^(?!^0(\.0|m|)$)([0-9]+)(\.[0-9]|m?)$'
|
||||||
- variable: memory
|
- variable: memory
|
||||||
label: "Memory RAM"
|
label: "Memory RAM"
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: "8Gi"
|
default: "8Gi"
|
||||||
valid_chars: '^([0-9.]+)([EPTGMK]i?|[EPTGMK]?|e[0-9]+)$'
|
valid_chars: '^(?!^0(e[0-9]|[EPTGMK]i?|)$)([0-9]+)(|[EPTGMK]i?|e[0-9]+)$'
|
||||||
- variable: requests
|
- variable: requests
|
||||||
label: "Advanced Request minimum resources required"
|
label: "Advanced Request minimum resources required"
|
||||||
schema:
|
schema:
|
||||||
@@ -31,10 +31,10 @@
|
|||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: "10m"
|
default: "10m"
|
||||||
valid_chars: '^([0-9]+)(\.[0-9]?|m?)$'
|
valid_chars: '^(?!^0(\.0|m|)$)([0-9]+)(\.[0-9]|m?)$'
|
||||||
- variable: memory
|
- variable: memory
|
||||||
label: "Memory RAM"
|
label: "Memory RAM"
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
default: "50Mi"
|
default: "50Mi"
|
||||||
valid_chars: '^([0-9.]+)([EPTGMK]i?|[EPTGMK]?|e[0-9]+)$'
|
valid_chars: '^(?!^0(e[0-9]|[EPTGMK]i?|)$)([0-9]+)(|[EPTGMK]i?|e[0-9]+)$'
|
||||||
|
|||||||
Reference in New Issue
Block a user