Skip to content

Commit af3791d

Browse files
committed
Ensure BMH name is a valid DNS hostname
Signed-off-by: Didrik Frimann Barroso Koren <[email protected]>
1 parent 1070d84 commit af3791d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/webhooks/metal3.io/v1alpha1/baremetalhost_validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ func validateRAID(r *metal3api.RAIDConfig) []error {
184184
}
185185

186186
func validateBMHName(bmhname string) error {
187-
invalidname, _ := regexp.MatchString(`[^A-Za-z0-9\.\-\_]`, bmhname)
187+
invalidname, _ := regexp.MatchString(`[^A-Za-z0-9\-]`, bmhname)
188188
if invalidname {
189-
return errors.New("BareMetalHost resource name cannot contain characters other than [A-Za-z0-9._-]")
189+
return errors.New("BareMetalHost resource name cannot contain characters other than [A-Za-z0-9-] to remain DNS hostname compatible with RFC1035")
190190
}
191191

192192
_, err := uuid.Parse(bmhname)

0 commit comments

Comments
 (0)