• Kubernetes Submit Queue's avatar
    Merge pull request #33958 from juanvallejo/jvallejo/add-global-timeout-flag · c0bd6e8e
    Kubernetes Submit Queue authored
    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)
    ```
    c0bd6e8e
Name
Last commit
Last update
..
src/k8s.io/client-go Loading commit data...
README.md Loading commit data...