Apply suggestions from code review

Co-authored-by: John Gardiner Myers <jgmyers@proofpoint.com>
This commit is contained in:
Matt Long 2020-05-28 08:47:52 +02:00 committed by GitHub
parent 2317b77ba5
commit 9385b1adf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -638,13 +638,13 @@ func validateCalicoAutoDetectionMethod(fldPath *field.Path, runtime *string, ver
return utilvalidation.IsValidIPv6Address(fldPath, destStr)
}
return field.ErrorList{field.Invalid(fldPath, runtime, "Invalid; IP version in incorrect")}
return field.ErrorList{field.InternalError(fldPath, runtime, "IP version is incorrect")}
} else if strings.HasPrefix(*runtime, methodInterface) {
ifStr := strings.TrimPrefix(*runtime, methodInterface)
ifRegexes := regexp.MustCompile(`\s*,\s*`).Split(ifStr, -1)
if len(ifRegexes) == 0 || ifRegexes[0] == "" {
validationError = append(validationError, field.Invalid(fldPath, runtime, "Expected 'interface=<COMMA-SEPARATED-LIST>'"))
validationError = append(validationError, field.Invalid(fldPath, runtime, "'interface=' must be followed by a comma separated list of interface regular expressions"))
}
for _, r := range ifRegexes {
_, e := regexp.Compile(r)
@ -669,7 +669,7 @@ func validateCalicoAutoDetectionMethod(fldPath *field.Path, runtime *string, ver
return validationError
}
return field.ErrorList{field.Invalid(fldPath, runtime, "Invalid autodetection method")}
return field.ErrorList{field.Invalid(fldPath, runtime, "unsupported autodetection method")}
}
func validateContainerRuntime(runtime *string, fldPath *field.Path) field.ErrorList {