Skip to content

Add global timeout flag - #33958

Merged
k8s-github-robot merged 2 commits into
kubernetes:masterfrom
juanvallejo:jvallejo/add-global-timeout-flag
Oct 15, 2016
Merged

k8s-github-robot merged 2 commits into
kubernetes:masterfrom
juanvallejo:jvallejo/add-global-timeout-flag

Conversation

@juanvallejo

@juanvallejo juanvallejo commented Oct 3, 2016 •

Copy link
Copy Markdown
Contributor

Release note:

Add a new global option "--request-timeout" to the `kubectl` client

UPSTREAM: https://github.com/kubernetes/client-go/pull/10

This patch adds a global timeout flag (viewable with kubectl -h) with
a 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

$ kubectl get pods # no timeout flag set - default to 0s (which means no
timeout)
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$ kubectl get pods --request-timeout=0 # zero means no timeout no timeout flag set
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$kubectl get pods --request-timeout=1ms
Unable to connect to the server: net/http: request canceled while
waiting for connection (Client.Timeout exceeded while awaiting headers)

This change is Reviewable

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

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.

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Oct 3, 2016
}
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".`)

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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

@0xmichalis

Copy link
Copy Markdown
Contributor

cc: @kubernetes/kubectl

@juanvallejo

Copy link
Copy Markdown
Contributor Author

@deads2k or @fabianofranz could you take a look please?

FlagImpersonate = "as"
FlagUsername = "username"
FlagPassword = "password"
FlagTimeout = "request-timeout"

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown

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.

@deads2k

deads2k commented Oct 5, 2016

Copy link
Copy Markdown
Contributor

Squash and lgtm.

I'll leave it open a day for comments on the flag name.

@deads2k

deads2k commented Oct 5, 2016

Copy link
Copy Markdown
Contributor

Oh, and test-cmd test. A kubectl get -w --request-timeout ought to return, right?

@juanvallejo

Copy link
Copy Markdown
Contributor Author

@deads2k

A kubectl get -w --request-timeout ought to return, right?

Yes, when using the default 0 value, it behaves as usual (watches a resource until a user terminates the process).

When used with a non-zero request-timeout value, it does timeout after the time specified:

$ oc get pod zookeeper-1 -w --request-timeout=10s
NAME          READY     STATUS    RESTARTS   AGE
zookeeper-1   1/1       Running   2          6h

After 10s, the complete output from the command above is:

NAME          READY     STATUS    RESTARTS   AGE
zookeeper-1   1/1       Running   2          6h
E1005 15:50:25.125415   11319 streamwatcher.go:109] Unable to decode an event from the watch stream: net/http: request canceled (Client.Timeout exceeded while reading body)

@deads2k

deads2k commented Oct 5, 2016

Copy link
Copy Markdown
Contributor

Yes, when using the default 0 value, it behaves as usual (watches a resource until a user terminates the process).

Right, just pointed that out for your test-cmd.sh test.

@juanvallejo
juanvallejo force-pushed the jvallejo/add-global-timeout-flag branch from 396551b to 5933816 Compare October 5, 2016 20:27
@adohe-zz

adohe-zz commented Oct 6, 2016

Copy link
Copy Markdown

@juanvallejo any priority between local timeout flag and global flag?

@soltysh

soltysh commented Oct 6, 2016

Copy link
Copy Markdown
Contributor

@juanvallejo any priority between local timeout flag and global flag?

I guess, since request-timeout is applied at transport layer it'll have priority over local timeout, which is usually applied to a bigger chunk of operation (ie. for reapers it's applied while waiting for scale down operation).

The changes LGTM, but since this is a new feature, release not is needed @juanvallejo,

@juanvallejo

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, release note added!

@juanvallejo
juanvallejo force-pushed the jvallejo/add-global-timeout-flag branch from 5933816 to 778e57e Compare October 6, 2016 14:17
@soltysh soltysh added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels Oct 6, 2016
@soltysh

soltysh commented Oct 6, 2016

Copy link
Copy Markdown
Contributor

If there are no objections I'm gonna tag it for merge later today.

@soltysh

soltysh commented Oct 6, 2016

Copy link
Copy Markdown
Contributor

@k8s-bot ok to test

@soltysh

soltysh commented Oct 6, 2016

Copy link
Copy Markdown
Contributor

Flake #32430

@k8s-bot node e2e test this

}

// BindDurationFlag binds the flag based on the provided info. If LongName == "", nothing is registered
func (f FlagInfo) BindDurationFlag(flags *pflag.FlagSet, target *time.Duration) {

@fabianofranz fabianofranz Oct 6, 2016 •

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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

@juanvallejo
juanvallejo force-pushed the jvallejo/add-global-timeout-flag branch from 778e57e to 1742dc5 Compare October 6, 2016 21:50
@fabianofranz

Copy link
Copy Markdown
Contributor

LGTM

@soltysh

soltysh commented Oct 7, 2016

Copy link
Copy Markdown
Contributor

@juanvallejo can you look into those test failures and link to flakes?

@soltysh soltysh added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 7, 2016
@juanvallejo
juanvallejo force-pushed the jvallejo/add-global-timeout-flag branch from 1742dc5 to 10571e3 Compare October 7, 2016 17:20
mhan8796 pushed a commit to mhan8796/kubernetes that referenced this pull request Jun 26, 2026
…bal-timeout-flag

Automatic merge from submit-queue

Add global timeout flag

**Release note**:
```release-note
Add a new global option "--request-timeout" to the `kubectl` client
```

UPSTREAM: https://github.com/kubernetes/client-go/pull/10

This patch adds a global timeout flag (viewable with `kubectl -h`) with
a 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**
```
$ kubectl get pods # no timeout flag set - default to 0s (which means no
timeout)
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$ kubectl get pods --request-timeout=0 # zero means no timeout no timeout flag set
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$kubectl get pods --request-timeout=1ms
Unable to connect to the server: net/http: request canceled while
waiting for connection (Client.Timeout exceeded while awaiting headers)
```
sanyamk23 pushed a commit to sanyamk23/kubernetes that referenced this pull request Sep 1, 2026
…rnetes#34269)

### Issue # (if applicable)

Closes kubernetes#33958

### Reason for this change
Duplicate id of alarm of multiple StepScalingPolicy

### Description of changes
Update Lambda permission prefix to use `Names.uniqueId`

Considering this requires resource destruction, please let me know if i need a feature flag for the fix. As there was another feature flag in the exact same place.

### Description of how you validated changes
Unit + Integ

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants