diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/scale/scale.go b/staging/src/k8s.io/kubectl/pkg/cmd/scale/scale.go index 1f1f0a53148..9529aeef8db 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/scale/scale.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/scale/scale.go @@ -211,10 +211,11 @@ func (o *ScaleOptions) RunScale() error { return err } - infos, err := r.Infos() - if err != nil { - return err - } + // We don't immediately return infoErr if it is not nil. + // Because we want to proceed for other valid resources and + // at the end of the function, we'll return this + // to show invalid resources to the user. + infos, infoErr := r.Infos() if len(o.ResourceVersion) != 0 && len(infos) > 1 { return fmt.Errorf("cannot use --resource-version with multiple resources") @@ -270,7 +271,7 @@ func (o *ScaleOptions) RunScale() error { } } - return nil + return infoErr } func scaler(f cmdutil.Factory) (scale.Scaler, error) {