-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add global timeout flag #33958
Add global timeout flag #33958
Conversation
Can a kubernetes member verify that this patch is reasonable to test? If so, please reply with "@k8s-bot ok to test" on its own line. Regular contributors should join the org to skip this step. |
@@ -91,7 +91,7 @@ func NewCmdRollingUpdate(f *cmdutil.Factory, out io.Writer) *cobra.Command { | |||
} | |||
cmd.Flags().Duration("update-period", updatePeriod, `Time to wait between updating pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) | |||
cmd.Flags().Duration("poll-interval", pollInterval, `Time delay between polling for replication controller status after the update. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) | |||
cmd.Flags().Duration("timeout", timeout, `Max time to wait for a replication controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot change these flag names without breaking existing scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted local flag names back to timeout
. Updated global flag to --request-timeout
396551b
cc: @kubernetes/kubectl |
@deads2k or @fabianofranz could you take a look please? |
@@ -121,6 +138,7 @@ const ( | |||
FlagImpersonate = "as" | |||
FlagUsername = "username" | |||
FlagPassword = "password" | |||
FlagTimeout = "request-timeout" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kubernetes/kubectl Any comments on the flag name? --timeout
was already take by commands that use reapers for a different meaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request-timeout
sounds good to me.
Squash and lgtm. I'll leave it open a day for comments on the flag name. |
Oh, and test-cmd test. A |
Yes, when using the default When used with a non-zero
After
|
Right, just pointed that out for your test-cmd.sh test. |
396551b
to
5933816
Compare
@juanvallejo any priority between local timeout flag and global flag? |
I guess, since The changes LGTM, but since this is a new feature, release not is needed @juanvallejo, |
Thanks for the feedback, release note added! |
5933816
to
778e57e
Compare
If there are no objections I'm gonna tag it for merge later today. |
@k8s-bot ok to test |
@@ -105,6 +108,20 @@ func (f FlagInfo) BindBoolFlag(flags *pflag.FlagSet, target *bool) { | |||
} | |||
} | |||
|
|||
// BindDurationFlag binds the flag based on the provided info. If LongName == "", nothing is registered | |||
func (f FlagInfo) BindDurationFlag(flags *pflag.FlagSet, target *time.Duration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still believe --request-timeout
should support values without units, which defaults to seconds like every other timeout flag out there. Like in ssh
, timeout
, scp
, curl
, and so on.
You'd probably have to use string and parse it by yourself like in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like --request-timeout=30
is the first thing I'll try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Thanks for providing the example
778e57e
to
1742dc5
Compare
LGTM |
@juanvallejo can you look into those test failures and link to flakes? |
1742dc5
to
10571e3
Compare
LGTM. Thanks! |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
Release note:
UPSTREAM: kubernetes/client-go#10
This patch adds a global timeout flag (viewable with
kubectl -h
) witha default value of
0s
(meaning no timeout).The timeout value is added to the default http client, so that zero
values and default behavior are enforced by the client.
Adding a global timeout ensures that user-made scripts won't hang for an
indefinite amount of time while performing remote calls (right now, remote
calls are re-tried up to 10 times when each attempt fails, however, there is
no option to set a timeout in order to prevent any of these 10 attempts from
hanging indefinitely).
Example
This change is