242 Commits

Author SHA1 Message Date
Shyam Jeedigunta
b8a8d94944 Add DisableCompression option to KubeConfig
Kubernetes-commit: 641fd5b482c6117d459a22d99f76aae086c3524f
2022-09-07 18:04:17 -07:00
cndoit18
bcd2e6c7da style: remove redundant judgment
Signed-off-by: cndoit18 <cndoit18@outlook.com>

Kubernetes-commit: ec43037d0f57fdfc2fdc4960fdb8a7e31ac79fae
2022-07-29 18:25:05 +08:00
André Martins
e9d4627252 client-go/rest: check if url is nil to prevent nil pointer dereference
Signed-off-by: André Martins <aanm90@gmail.com>

Kubernetes-commit: 94e7b2b8fdb4028b8b9d10ce57b9b33df146beb7
2022-08-09 14:19:01 +02:00
André Martins
c501ee0eba Revert "client-go: remove no longer used finalURLTemplate"
The functionality provided by the finalURLTemplate is still used by
certain external projects to track the request latency for requests
performed to kube-apiserver.

Using a template of the URL, instead of the URL itself, prevents the
explosion of label cardinality in exposed metrics since it aggregates
the URLs in a way that common URLs requests are reported as being the
same.

This reverts commit bebf5a608f68523fc430a44f6db26b16022dc862.

Signed-off-by: André Martins <aanm90@gmail.com>

Kubernetes-commit: f8f190cdd2fa76296f8b1b019ac77128b5d40b79
2022-08-08 23:27:45 +02:00
inosato
27de641f75 Remove ioutil from client-go
Signed-off-by: inosato <si17_21@yahoo.co.jp>

Kubernetes-commit: 88dfa51b6003c90e8f0a0508939a1d79950a40df
2022-07-30 20:54:41 +09:00
Davanum Srinivas
2a6c116e40 Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: a9593d634c6a053848413e600dadbf974627515f
2022-07-19 20:54:13 -04:00
ldsdsy
123d4e7e38 Fix a typo
Kubernetes-commit: bfe61fa574321474c4b278afb39af95464efad43
2022-06-20 21:52:50 +08:00
zhoumingcheng
84e1219642 Correct some wrong syntax
Signed-off-by: zhoumingcheng <zhoumingcheng@beyondcent.com>

Kubernetes-commit: e590ab77dcb68486a154b755aae658509b9290ea
2022-07-12 10:46:56 +08:00
saltbo
7c3fa18b11 fix: update the typo code comment
Kubernetes-commit: d2bab218ddef3fc3f444038420dd500c0e8bc068
2022-07-13 10:16:51 +08:00
HaoJie Liu
2f582c2a40 Fix:import the same package multiple times
Signed-off-by: HaoJie Liu <liuhaojie@beyondcent.com>

Kubernetes-commit: 4f0a0ec81c649727cfc62cf8c0a2ad7eabf12516
2022-07-12 17:41:37 +08:00
Abu Kashem
71b8c174e4 client-go: fix backoff delay
Kubernetes-commit: 60e74a9ff73b206e5dd439b5df51ac9826635579
2022-05-17 17:19:26 -04:00
Abu Kashem
d8531f5ff0 client-go: make retry in Request thread safe
Kubernetes-commit: 6618b8ef7c0b552839555d4578b64427d20524ef
2022-03-29 13:09:26 -04:00
Abu Kashem
01ab7fb211 client-go: reset request body after response is read and closed
This commit refactors the retry logic to include resetting the
request body. The reset logic will be called iff it is not the
first attempt. This refactor is nescessary mainly because now
as per the retry logic, we always ensure that the request body
is reset *after* the response body is *fully* read and closed
in order to reuse the same TCP connection.

Previously, the reset of the request body and the call to read
and close the response body were not in the right order, which
leads to race conditions.

This commit also adds a test that verifies the order in which
the function calls are made to ensure that we seek only after
the response body is closed.

Co-authored-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: 68c8c458ee8f6629eef806c48c1a776dedad3ec4
2022-03-28 20:40:49 -04:00
Abu Kashem
7c9347d386 client-go: wrap error from previous attempt to provide more context
Kubernetes-commit: 868b5a31d382b325f49e1b831e6b094282d50cc7
2022-03-14 18:57:56 -04:00
Patrick Ohly
9175c47d17 enhance and fix log calls
Some of these changes are cosmetic (repeatedly calling klog.V instead of
reusing the result), others address real issues:

- Logging a message only above a certain verbosity threshold without
  recording that verbosity level (if klog.V().Enabled() { klog.Info... }):
  this matters when using a logging backend which records the verbosity
  level.

- Passing a format string with parameters to a logging function that
  doesn't do string formatting.

All of these locations where found by the enhanced logcheck tool from
https://github.com/kubernetes/klog/pull/297.

In some cases it reports false positives, but those can be suppressed with
source code comments.

Kubernetes-commit: edffc700a43e610f641907290a5152ca593bad79
2022-02-16 12:17:47 +01:00
Jordan Liggitt
83029168cc Temporarily disable TestCheckRetryClosesBody
Kubernetes-commit: 9c13a27d182c36296b7f2e381970b82c69d5c405
2022-03-24 10:11:06 -04:00
Abu Kashem
147848c452 client-go: chain the error returned by rate limiter
Kubernetes-commit: 6acbe7e6452a44057768c61909da2d5b7c878159
2022-02-24 17:28:01 -05:00
Abu Kashem
34f3aff43e client-go: refactor retry logic for backoff, rate limiter and metric
Kubernetes-commit: cecc563d3b9a9438cd3e6ae1576baa0a36f2d843
2022-02-17 16:57:45 -05:00
Antonio Ojea
e2c62ff0c0 client-go: add request and response size metrics
Get metrics for the request and response  size, so we can correlate latency
and size on a request, otherwise we could get confused because we don't know if the
network is slow or just the request size huge.

Kubernetes-commit: 64d9d0585f6dbc9266f31b6d0f795d6c0421495e
2021-12-09 12:11:01 +01:00
Abu Kashem
e4ecde2cf0 client-go: add unit test to verify order of calls
Kubernetes-commit: f6a66bbe051d2c7d537cf9033cc800babbb1a74b
2022-02-21 13:53:23 -05:00
Antonio Ojea
83bb1e3ff2 client-go: remove no longer used finalURLTemplate
The restclient metrics were updated to track only the host field of the
url, the finalURLTemplate is not longer needed, its only goal was to
replace name and namespace in the path to avoid cardinality.

Kubernetes-commit: bebf5a608f68523fc430a44f6db26b16022dc862
2022-02-17 16:51:55 +01:00
Davanum Srinivas
3bf0eac274 OWNERS cleanup - Jan 2021 Week 1
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9682b7248fb69733c2a0ee53618856e87b067f16
2022-01-03 10:59:47 -05:00
Davanum Srinivas
73f2731e23 Cleanup OWNERS files (No Activity in the last year)
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 497e9c1971c9e7d0193bc6d11503ec4ad527f1d5
2021-12-10 15:18:50 -05:00
Davanum Srinivas
70f09c4943 Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9405e9b55ebcd461f161859a698b949ea3bde31d
2021-12-09 21:31:26 -05:00
Antonio Ojea
115ee0e475 bump TestHTTP1DoNotReuseRequestAfterTimeout timeout
the test TestHTTP1DoNotReuseRequestAfterTimeout has to wait for
request to time out to assert that subsequent requests does not
reuse the TCP connection.

It seems that current value of 100ms causes issues on some CI
environments and bumping the timeout seems to solve this flakiness,

We can bump the timeout value because is really low compared to real
scenarios and the bump still keeps it in the millisecond order.

Kubernetes-commit: 85797eba7075d83b116b5c91ff3b17c2d5118d01
2021-11-29 15:37:31 +01:00
Antonio Ojea
34c99305b5 remove unused fakeUpgradeConnection
Kubernetes-commit: bf9ce7fd76068903e909358d2b25b05da7e4a431
2021-11-16 22:54:18 +01:00
Antonio Ojea
d62dc4e20e no lint unused variables
Kubernetes-commit: 0019f986130fdd8ca17c6e5511b15168d9181b1e
2021-11-16 19:00:31 +01:00
Antonio Ojea
f34af1a39f CloseIdleConnections for wrapped Transport
It iterates over the wrapped transports until it finds one
that implements the CloseIdleConnections method and executes it.

add test for closeidle http1 connections

add test for http1.1 reconnect with inflight request

add test to reuse connection request

add test for request connect after timeout

add test for client-go request concurrency

Kubernetes-commit: b9d865a8185b62d83e9ff81b0e3499a26ac6960d
2021-09-10 15:27:23 +02:00
Antonio Ojea
fd09dceb88 RESTClient contructors for config and http client
Add two new constructors for versioned and unversioned RESTClients.

These new constructors allow to pass an http.Client to the RESTClient,
taking precence over the transport Config parameters.

Add a new helper function to generate an http.Client from the RESTClient
Config object.

Co-authored-by: Jordan Liggitt <liggitt@google.com>

Kubernetes-commit: 80fbc817263de1c46e1493819aca35b1ef8e3d09
2021-10-09 00:17:04 +02:00
Margo Crawford
e0129e64d4 Introduces Impersonate-Uid to client-go.
* Updates ImpersonationConfig in rest/config.go to include UID
  attribute, and pass it through when copying the config
* Updates ImpersonationConfig in transport/config.go to include UID
  attribute
* In transport/round_tripper.go, Set the "Impersonate-Uid" header in
  requests based on the UID value in the config
* Update auth_test.go integration test to specify a UID through the new
  rest.ImpersonationConfig field rather than manually setting the
  Impersonate-Uid header

Signed-off-by: Margo Crawford <margaretc@vmware.com>

Kubernetes-commit: d9ddfb26e10ee353fc4617b66d2c9274bf6d1c08
2021-07-30 15:50:51 -07:00
wojtekt
608b5216df Migrate to k8s.io/utils/clock in client-go - part 1
Kubernetes-commit: 950f655bdd19c5af275846cf1940d767a5ec0115
2021-09-15 10:58:56 +02:00
wojtekt
8d49a0b940 Migrate to k8s.io/utils/clock in flowcontrol backoff
Kubernetes-commit: 4ce452989bef21ab6d15bc659f463d8c706ad33e
2021-09-10 09:37:30 +02:00
tiloso
04efcfc452 Fix staticcheck in apiserver and client-go pkgs
Kubernetes-commit: 830a137d2ea70663cd94403595313b95ac40ffe8
2021-06-19 22:03:46 +02:00
Stephen Augustus
624e6827e6 generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>

Kubernetes-commit: 481cf6fbe753b9eb2a47ced179211206b0a99540
2021-08-12 17:13:11 -04:00
Andrey Smirnov
c8b4c1e4bd fix: properly wrap errors when reading response body in the client
As `%v` doesn't allow error unwrapping, checks like `errors.Is` are not
working properly.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>

Kubernetes-commit: 6c0463bd2b616d0f22f47905bb26d66fa3b04e37
2021-06-18 23:35:31 +03:00
Andrew Keesler
37ed584bed exec credential provider: InteractiveMode support
The value here is that the exec plugin author can use the kubeconfig to assert
how standard input is treated with respect to the exec plugin, e.g.,
- an exec plugin author can ensure that kubectl fails if it cannot provide
  standard input to an exec plugin that needs it (Always)
- an exec plugin author can ensure that an client-go process will still call an
  exec plugin that prefers standard input even if standard input is not
  available (IfAvailable)

Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: cd83d89ac94c5b61fdd38840098e7223e5af0d34
2021-06-14 17:15:36 -04:00
Abu Kashem
fc210d907d client-go: fix flake in test TestRequestWatchWithRetry
Kubernetes-commit: e797a5a1989373275311b745faf0ff97f5d61000
2021-06-04 15:12:48 -04:00
Abu Kashem
bbd71da939 Revert "Merge pull request #102581 from liggitt/revert-watch-retry"
This reverts commit 5a59a43957c6743995dac67fdda42bf8e0a9ca77, reversing
changes made to 81b9789eaa7bc067f417b5e74d5695dd6dd88a46.

Kubernetes-commit: 892d4fabb845e2461e3655aa414beb6ac322fc99
2021-06-04 13:45:26 -04:00
Jordan Liggitt
5ba99a7f80 Revert "client-go: add retry logic for Watch and Stream"
This reverts commit 607d3819498e64d969407c3d7cbbb8f53d98f0d4.

Kubernetes-commit: e35af41a1236943b6510a25cfb8cb47855aaa16e
2021-06-04 01:11:25 -04:00
Abu Kashem
55854fadb1 client-go: add retry logic for Watch and Stream
Kubernetes-commit: 607d3819498e64d969407c3d7cbbb8f53d98f0d4
2021-05-18 15:15:28 -04:00
Abu Kashem
239ec44d74 client-go: refactor retry logic so it can be reused
Kubernetes-commit: 5fdf196b4e9bbba036a43f4c3b5d9ed8af1672cc
2021-05-20 16:54:19 -04:00
Ivan Sim
c8704063ca Fix the missing format specifier error in log output
The message argument is mistakenly used as the format specifier, if it
contains the special '%' characters. This causes many '[%d|%s](MISSING)'
errors in the API server logs.

Signed-off-by: Ivan Sim <isim@redhat.com>

Kubernetes-commit: b1d0d401875b2076e73183f8468ecb95c3fe61aa
2021-04-15 15:26:57 -07:00
Monis Khan
7998e982ab Prune stale entries from OWNERS files
Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: 91241eac9b7a7e62cc31e663147294bf6dc8f875
2021-04-07 10:38:27 -04:00
yoyinzyc
6a42ca30ba add context to restclient metrics
Kubernetes-commit: 69d40a1de7bc765647d8ef392fe406429fded807
2021-02-04 18:23:26 -08:00
Li Zhijian
bb1d67da92 request.go: correct subresource referencing
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>

Kubernetes-commit: 678e4ebaf6534e9b15fc4cc8602caadbead2e40e
2021-02-18 17:51:55 +08:00
Abu Kashem
d1fdbcd4dc client-go: add more context to request throttle message
Kubernetes-commit: bc66d3d137d3600b117be390ccb253a9dbcde25e
2021-02-12 14:39:44 -05:00
ZxYuan
a9fe1e1ae9 Fix typo in client-go/rest/client.go
Kubernetes-commit: cd63fd4543b99a45d0920421d0bd23af6f762dc8
2021-02-14 00:18:41 +08:00
Nikhita Raghunath
1d0cb03f5a *: remove nikhiljindal from OWNERS
Kubernetes-commit: 6cef3a4e33c10c27bb301a1070ea3ff4cdad0c39
2021-02-16 10:50:50 +05:30
Nikhita Raghunath
4c4207ac6f *: move gmarek to emeritus_approvers
Kubernetes-commit: b11516d69f2131327931a2cf7452d5e891d7e520
2021-02-16 10:31:19 +05:30
Andrey Viktorov
b804f9f657 add noop persister to plugin loader
Kubernetes-commit: 2dd86fe8c2cc7b655085b773bd1a06bc2ab54bbd
2021-01-12 00:08:42 +02:00