Merge pull request #91858 from SataQiu/fix-kubectl-2020060603

kubectl: fix the bug that kubectl scale does not honor --timeout flag
This commit is contained in:
Kubernetes Prow Robot 2020-07-09 00:04:24 -07:00 committed by GitHub
commit 7fc3d9771b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,10 +62,6 @@ var (
kubectl scale --replicas=3 statefulset/web`)) kubectl scale --replicas=3 statefulset/web`))
) )
const (
timeout = 5 * time.Minute
)
type ScaleOptions struct { type ScaleOptions struct {
FilenameOptions resource.FilenameOptions FilenameOptions resource.FilenameOptions
RecordFlags *genericclioptions.RecordFlags RecordFlags *genericclioptions.RecordFlags
@ -234,7 +230,7 @@ func (o *ScaleOptions) RunScale() error {
var waitForReplicas *scale.RetryParams var waitForReplicas *scale.RetryParams
if o.Timeout != 0 && o.dryRunStrategy == cmdutil.DryRunNone { if o.Timeout != 0 && o.dryRunStrategy == cmdutil.DryRunNone {
waitForReplicas = scale.NewRetryParams(1*time.Second, timeout) waitForReplicas = scale.NewRetryParams(1*time.Second, o.Timeout)
} }
counter := 0 counter := 0