Fix the validation of docker registry, improve the error message
@@ -34,7 +34,7 @@ var (
// sanity check against illegal characters.
alphaNumDash = regexp.MustCompile("^[a-zA-Z0-9-]+$")
alphaNumDashDot = regexp.MustCompile("^[\\.a-zA-Z0-9-]+$")
- alphaNumDashDotSlash = regexp.MustCompile("^[\\./a-zA-Z0-9-]+$")
+ alphaNumDashDotSlashColon = regexp.MustCompile("^[\\./a-zA-Z0-9-:]+$")
)
var RootCmd = &cobra.Command{
@@ -185,8 +185,8 @@ func (options *proxyConfigOptions) validate() error {
return fmt.Errorf("%s is not a valid version", options.linkerdVersion)
}
- if !alphaNumDashDotSlash.MatchString(options.dockerRegistry) {
- return fmt.Errorf("%s is not a valid Docker registry", options.dockerRegistry)
+ if !alphaNumDashDotSlashColon.MatchString(options.dockerRegistry) {
+ return fmt.Errorf("%s is not a valid Docker registry. The url can contain only letters, numbers, dash, dot, slash and colon", options.dockerRegistry)
}
if options.imagePullPolicy != "Always" && options.imagePullPolicy != "IfNotPresent" && options.imagePullPolicy != "Never" {
