Fix _ is allowed in k8s label names

This commit is contained in:
allegroai 2023-02-05 10:29:48 +02:00
parent 855622fd30
commit af6a77918f

View File

@ -949,5 +949,6 @@ class K8sIntegration(Worker):
value = re.sub(r'^[^A-Za-z0-9]+', '', value) # strip leading non-alphanumeric chars
value = re.sub(r'[^A-Za-z0-9]+$', '', value) # strip trailing non-alphanumeric chars
value = re.sub(r'\W+', '-', value) # allow only word chars (this removed "." which is supported, but nvm)
value = re.sub(r'_+', '-', value) # "_" is not allowed as well
value = re.sub(r'-+', '-', value) # don't leave messy "--" after replacing previous chars
return value[:63]