mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 06:02:18 +00:00
Extending label.Parse method to support exact match
This commit is contained in:
@@ -103,3 +103,13 @@ func IsQualifiedName(value string) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
const LabelValueFmt string = "([A-Za-z0-9_\\-\\\\.]*)"
|
||||
|
||||
var labelValueRegexp = regexp.MustCompile("^" + LabelValueFmt + "$")
|
||||
|
||||
const labelValueMaxLength int = 63
|
||||
|
||||
func IsValidLabelValue(value string) bool {
|
||||
return (len(value) <= labelValueMaxLength && labelValueRegexp.MatchString(value))
|
||||
}
|
||||
|
Reference in New Issue
Block a user