Merge pull request #98110 from dougsland/krunImageName

kubectl: run - remove unneeded vars
This commit is contained in:
Kubernetes Prow Robot 2021-01-20 08:46:00 -08:00 committed by GitHub
commit 6206f00aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -273,13 +273,12 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
} }
// validate image name // validate image name
imageName := o.Image if o.Image == "" {
if imageName == "" {
return fmt.Errorf("--image is required") return fmt.Errorf("--image is required")
} }
validImageRef := reference.ReferenceRegexp.MatchString(imageName)
if !validImageRef { if !reference.ReferenceRegexp.MatchString(o.Image) {
return fmt.Errorf("Invalid image name %q: %v", imageName, reference.ErrReferenceInvalidFormat) return fmt.Errorf("Invalid image name %q: %v", o.Image, reference.ErrReferenceInvalidFormat)
} }
if o.TTY && !o.Interactive { if o.TTY && !o.Interactive {