Skip to content

Commit

Permalink
feat: mangle regex.match system module function (#88)
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy authored Mar 18, 2024
1 parent 7a52907 commit fba48bd
Show file tree
Hide file tree
Showing 14 changed files with 922 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""
import regex
import k8s.apimachinery.pkg.apis.meta.v1
regex_match = regex.match


schema ContainerizedWorkload:
Expand Down Expand Up @@ -149,7 +150,7 @@ schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0EnvItems0:


check:
regex.match(str(name), r"^[-_a-zA-Z0-9]+$")
regex_match(str(name), r"^[-_a-zA-Z0-9]+$")


schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0LivenessProbe:
Expand Down Expand Up @@ -285,7 +286,7 @@ schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0PortsItems0:


check:
regex.match(str(name), r"^[a-z]+$")
regex_match(str(name), r"^[a-z]+$")


schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0ReadiessProbe:
Expand Down
2 changes: 1 addition & 1 deletion pkg/kube_resource/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func crdObj2CrdInternal(crdObj runtime.Object) (*apiextensions.CustomResourceDef
case *apiextensions.CustomResourceDefinition:
crd = crdObj.(*apiextensions.CustomResourceDefinition)
default:
return nil, errors.New(fmt.Sprintf("unknown crd object type %v", crdObj.GetObjectKind()))
return nil, fmt.Errorf("unknown crd object type %v", crdObj.GetObjectKind())
}

if !CRDContainsValidation(crd) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""
import regex
import k8s.apimachinery.pkg.apis.meta.v1
regex_match = regex.match


schema EC2NodeClass:
Expand Down Expand Up @@ -124,7 +125,7 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpecAmiSelectorTermsItems0:


check:
regex.match(str(id), r"ami-[0-9a-z]+") if id
regex_match(str(id), r"ami-[0-9a-z]+") if id


schema KarpenterK8sAwsV1beta1EC2NodeClassSpecBlockDeviceMappingsItems0:
Expand Down Expand Up @@ -202,8 +203,8 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpecBlockDeviceMappingsItems0Ebs:


check:
regex.match(str(volumeSize), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if volumeSize
regex.match(str(volumeSize), r"^((?:[1-9][0-9]{0,3}|[1-4][0-9]{4}|[5][0-8][0-9]{3}|59000)Gi|(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-3][0-9]{3}|64000)G|([1-9]||[1-5][0-7]|58)Ti|([1-9]||[1-5][0-9]|6[0-3]|64)T)$") if volumeSize
regex_match(str(volumeSize), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if volumeSize
regex_match(str(volumeSize), r"^((?:[1-9][0-9]{0,3}|[1-4][0-9]{4}|[5][0-8][0-9]{3}|59000)Gi|(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-3][0-9]{3}|64000)G|([1-9]||[1-5][0-7]|58)Ti|([1-9]||[1-5][0-9]|6[0-3]|64)T)$") if volumeSize


schema KarpenterK8sAwsV1beta1EC2NodeClassSpecMetadataOptions:
Expand Down Expand Up @@ -265,7 +266,7 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpecSecurityGroupSelectorTermsItems0:


check:
regex.match(str(id), r"sg-[0-9a-z]+") if id
regex_match(str(id), r"sg-[0-9a-z]+") if id


schema KarpenterK8sAwsV1beta1EC2NodeClassSpecSubnetSelectorTermsItems0:
Expand All @@ -287,7 +288,7 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpecSubnetSelectorTermsItems0:


check:
regex.match(str(id), r"subnet-[0-9a-z]+") if id
regex_match(str(id), r"subnet-[0-9a-z]+") if id


schema KarpenterK8sAwsV1beta1EC2NodeClassStatus:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""
import regex
import k8s.apimachinery.pkg.apis.meta.v1
regex_match = regex.match


schema VMAgent:
Expand Down Expand Up @@ -371,8 +372,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpec:


check:
regex.match(str(scrapeInterval), r"[0-9]+(ms|s|m|h)") if scrapeInterval
regex.match(str(scrapeTimeout), r"[0-9]+(ms|s|m|h)") if scrapeTimeout
regex_match(str(scrapeInterval), r"[0-9]+(ms|s|m|h)") if scrapeInterval
regex_match(str(scrapeTimeout), r"[0-9]+(ms|s|m|h)") if scrapeTimeout


schema OperatorVictoriametricsComV1beta1VMAgentSpecAPIServerConfig:
Expand Down Expand Up @@ -878,8 +879,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecClaimTemplatesItems0SpecResou


check:
all _, limits in limits {regex.match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
all _, requests in requests {regex.match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
all _, limits in limits {regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
all _, requests in requests {regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests


schema OperatorVictoriametricsComV1beta1VMAgentSpecClaimTemplatesItems0SpecSelector:
Expand Down Expand Up @@ -957,8 +958,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecClaimTemplatesItems0Status:


check:
all _, allocatedResources in allocatedResources {regex.match(str(allocatedResources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if allocatedResources } if allocatedResources
all _, capacity in capacity {regex.match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
all _, allocatedResources in allocatedResources {regex_match(str(allocatedResources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if allocatedResources } if allocatedResources
all _, capacity in capacity {regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity


schema OperatorVictoriametricsComV1beta1VMAgentSpecClaimTemplatesItems0StatusConditionsItems0:
Expand Down Expand Up @@ -995,7 +996,7 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecClaimTemplatesItems0StatusCon
$type: str


schema [any]:
schema OperatorVictoriametricsComV1beta1VMAgentSpecDNSConfig:
"""
Specifies the DNS parameters of a pod. Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy.

Expand Down Expand Up @@ -1736,7 +1737,7 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecRemoteWriteItems0:


check:
regex.match(str(sendTimeout), r"[0-9]+(ms|s|m|h)") if sendTimeout
regex_match(str(sendTimeout), r"[0-9]+(ms|s|m|h)") if sendTimeout


schema OperatorVictoriametricsComV1beta1VMAgentSpecRemoteWriteItems0BasicAuth:
Expand Down Expand Up @@ -2453,7 +2454,7 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecRemoteWriteSettings:


check:
regex.match(str(flushInterval), r"[0-9]+(ms|s|m|h)") if flushInterval
regex_match(str(flushInterval), r"[0-9]+(ms|s|m|h)") if flushInterval


schema OperatorVictoriametricsComV1beta1VMAgentSpecResources:
Expand All @@ -2475,8 +2476,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecResources:


check:
all _, limits in limits {regex.match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
all _, requests in requests {regex.match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
all _, limits in limits {regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
all _, requests in requests {regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests


schema OperatorVictoriametricsComV1beta1VMAgentSpecRollingUpdate:
Expand Down Expand Up @@ -2716,7 +2717,7 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageEmptyDir:


check:
regex.match(str(sizeLimit), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if sizeLimit
regex_match(str(sizeLimit), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if sizeLimit


schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTemplate:
Expand Down Expand Up @@ -2876,8 +2877,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTem


check:
all _, limits in limits {regex.match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
all _, requests in requests {regex.match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests
all _, limits in limits {regex_match(str(limits), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if limits } if limits
all _, requests in requests {regex_match(str(requests), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if requests } if requests


schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTemplateSpecSelector:
Expand Down Expand Up @@ -2955,8 +2956,8 @@ schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTem


check:
all _, allocatedResources in allocatedResources {regex.match(str(allocatedResources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if allocatedResources } if allocatedResources
all _, capacity in capacity {regex.match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
all _, allocatedResources in allocatedResources {regex_match(str(allocatedResources), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if allocatedResources } if allocatedResources
all _, capacity in capacity {regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity


schema OperatorVictoriametricsComV1beta1VMAgentSpecStatefulStorageVolumeClaimTemplateStatusConditionsItems0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
This file was generated by the KCL auto-gen tool. DO NOT EDIT.
Editing this file might prove futile when you re-run the KCL auto-gen generate command.
"""
import regex
import k8s.apimachinery.pkg.apis.meta.v1
regex_match = regex.match


schema GlobalNetworkPolicy:
Expand Down Expand Up @@ -40,7 +42,7 @@ schema GlobalNetworkPolicy:


check:
all _, capacity in capacity {regex.match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity
all _, capacity in capacity {regex_match(str(capacity), r"^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$") if capacity } if capacity


schema CrdProjectcalicoOrgV1GlobalNetworkPolicyDestination:
Expand Down Expand Up @@ -98,8 +100,8 @@ schema CrdProjectcalicoOrgV1GlobalNetworkPolicyDestination:


check:
all notPorts in notPorts {regex.match(str(notPorts), r"^.*") if notPorts } if notPorts
all ports in ports {regex.match(str(ports), r"^.*") if ports } if ports
all notPorts in notPorts {regex_match(str(notPorts), r"^.*") if notPorts } if notPorts
all ports in ports {regex_match(str(ports), r"^.*") if ports } if ports


schema CrdProjectcalicoOrgV1GlobalNetworkPolicyDestinationServiceAccounts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""
import regex
import k8s.apimachinery.pkg.apis.meta.v1
regex_match = regex.match


schema OperatorConfiguration:
Expand Down Expand Up @@ -293,10 +294,10 @@ schema AcidZalanDoV1OperatorConfigurationConfigurationConnectionPooler:


check:
regex.match(str(connection_pooler_default_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if connection_pooler_default_cpu_limit
regex.match(str(connection_pooler_default_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if connection_pooler_default_cpu_request
regex.match(str(connection_pooler_default_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_limit
regex.match(str(connection_pooler_default_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_request
regex_match(str(connection_pooler_default_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if connection_pooler_default_cpu_limit
regex_match(str(connection_pooler_default_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if connection_pooler_default_cpu_request
regex_match(str(connection_pooler_default_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_limit
regex_match(str(connection_pooler_default_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_request
connection_pooler_number_of_instances >= 1


Expand Down Expand Up @@ -713,11 +714,11 @@ schema AcidZalanDoV1OperatorConfigurationConfigurationLogicalBackup:


check:
regex.match(str(logical_backup_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if logical_backup_cpu_limit
regex.match(str(logical_backup_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if logical_backup_cpu_request
regex.match(str(logical_backup_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if logical_backup_memory_limit
regex.match(str(logical_backup_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if logical_backup_memory_request
regex.match(str(logical_backup_schedule), r"^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$") if logical_backup_schedule
regex_match(str(logical_backup_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if logical_backup_cpu_limit
regex_match(str(logical_backup_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if logical_backup_cpu_request
regex_match(str(logical_backup_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if logical_backup_memory_limit
regex_match(str(logical_backup_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if logical_backup_memory_request
regex_match(str(logical_backup_schedule), r"^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$") if logical_backup_schedule


schema AcidZalanDoV1OperatorConfigurationConfigurationMajorVersionUpgrade:
Expand Down Expand Up @@ -803,14 +804,14 @@ schema AcidZalanDoV1OperatorConfigurationConfigurationPostgresPodResources:


check:
regex.match(str(default_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if default_cpu_limit
regex.match(str(default_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if default_cpu_request
regex.match(str(default_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if default_memory_limit
regex.match(str(default_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if default_memory_request
regex.match(str(max_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if max_cpu_request
regex.match(str(max_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if max_memory_request
regex.match(str(min_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if min_cpu_limit
regex.match(str(min_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if min_memory_limit
regex_match(str(default_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if default_cpu_limit
regex_match(str(default_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if default_cpu_request
regex_match(str(default_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if default_memory_limit
regex_match(str(default_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if default_memory_request
regex_match(str(max_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if max_cpu_request
regex_match(str(max_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if max_memory_request
regex_match(str(min_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if min_cpu_limit
regex_match(str(min_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if min_memory_limit


schema AcidZalanDoV1OperatorConfigurationConfigurationScalyr:
Expand Down Expand Up @@ -852,10 +853,10 @@ schema AcidZalanDoV1OperatorConfigurationConfigurationScalyr:


check:
regex.match(str(scalyr_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if scalyr_cpu_limit
regex.match(str(scalyr_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if scalyr_cpu_request
regex.match(str(scalyr_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if scalyr_memory_limit
regex.match(str(scalyr_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if scalyr_memory_request
regex_match(str(scalyr_cpu_limit), r"^(\d+m|\d+(\.\d{1,3})?)$") if scalyr_cpu_limit
regex_match(str(scalyr_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if scalyr_cpu_request
regex_match(str(scalyr_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if scalyr_memory_limit
regex_match(str(scalyr_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if scalyr_memory_request


schema AcidZalanDoV1OperatorConfigurationConfigurationTeamsAPI:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Editing this file might prove futile when you re-run the KCL auto-gen generate c
"""
import regex
import k8s.apimachinery.pkg.apis.meta.v1
regex_match = regex.match


schema ContainerizedWorkload:
Expand Down Expand Up @@ -149,7 +150,7 @@ schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0EnvItems0:


check:
regex.match(str(name), r"^[-_a-zA-Z0-9]+$")
regex_match(str(name), r"^[-_a-zA-Z0-9]+$")


schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0LivenessProbe:
Expand Down Expand Up @@ -285,7 +286,7 @@ schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0PortsItems0:


check:
regex.match(str(name), r"^[a-z]+$")
regex_match(str(name), r"^[a-z]+$")


schema CoreOamDevV1alpha2ContainerizedWorkloadSpecContainersItems0ReadiessProbe:
Expand Down
Loading

0 comments on commit fba48bd

Please sign in to comment.