Commit Graph

49 Commits

Author SHA1 Message Date
Timo Furrer
d11d5308d6 Export DefaultServerUrlFor utility function
Signed-off-by: Timo Furrer <tuxtimo@gmail.com>

Kubernetes-commit: ebaf49dbd709a94e0c44aa75b4c32b50898a05e3
2023-05-16 19:20:07 +02: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
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
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
Marek Siarkowicz
e93788d387 Add datapolicy tags to staging/src/k8s.io/client-go/
Kubernetes-commit: e29c568c4a9cd45d15665345aa015e21bcff52dd
2020-10-29 18:15:52 +01:00
Andrew Keesler
a7ba87c612 exec credential provider: ProvideClusterInfo and kubeconfig shadow
- The main idea here is that we want to 1) prevent potentially large CA
  bundles from being set in an exec plugin's environment and 2) ensure
  that the exec plugin is getting everything it needs in order to talk to
  a cluster.
- Avoid breaking existing manual declarations of rest.Config instances by
  moving exec Cluster to kubeconfig internal type.
- Use client.authentication.k8s.io/exec to qualify exec cluster extension.
- Deep copy the exec Cluster.Config when we copy a rest.Config.

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

Kubernetes-commit: c4299d15d5289768808034676858e76a177eeae5
2020-10-29 13:38:42 -04:00
Monis Khan
9e147f192f exec credential provider: wire in cluster info
Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: f97422c8bd57692f5a1a3aa6dc6abc31051ebc82
2020-05-06 01:01:09 -04:00
phillc
8ea16c1919 find . -type f \( -name "*.go" -or -name "*.md" \) -print0 | xargs -0 gsed -i 's/the the /the /g'
Kubernetes-commit: adbc7c2172ea622db7399f41e893063b00ca1a87
2020-09-21 16:37:12 -04:00
Jordan Liggitt
dbb8ed36f1 Improve docs for client-go warning handlers
Kubernetes-commit: b0573d526d5eb171e7e21edd642ffe5c258c37a7
2020-08-29 10:40:33 -04:00
lihaowei
abfce0f8c3 Format Codes
Chore: Correct words and format codes

Revert three changes

Revert 1 change

Revert again

Revert 2 changes

Kubernetes-commit: af7cf4abc6bfeb0d2cfaca76097cf7a0603c4495
2020-08-08 13:27:28 +08:00
Jordan Liggitt
75f9ee62c1 client-go: extract warning headers from API responses
Kubernetes-commit: b1098bd0d53658bfb945e485683d543ab7dc73ba
2019-01-17 11:35:07 -05:00
Davanum Srinivas
75fea27a27 switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
2020-04-17 15:25:06 -04:00
Mike Danese
0caa50056a rest.Config: support configuring an explict proxy URL
With support of http, https, and socks5 proxy support. We already
support configuring this via environmnet variables, but this approach
becomes inconvenient dealing with multiple clusters on different
networks, that require different proxies to connect to. Most solutions
require wrapping clients (like kubectl) in bash scripts.

Part of: https://github.com/kubernetes/client-go/issues/351

Kubernetes-commit: f3f666d5f1f6f74a8c948a5c64af993696178244
2019-05-03 13:50:17 -07:00
Clayton Coleman
9bbcc2938d Always negotiate a decoder using ClientNegotiator
This commit performs two refactors and fixes a bug.

Refactor 1 changes the signature of Request to take a RESTClient, which
removes the extra copy of everything on RESTClient from Request. A pair
of optional constructors are added for testing. The major functional
change is that Request no longer has the shim HTTPClient interface and
so some test cases change slightly because we are now going through
http.Client code paths instead of direct to our test stubs.

Refactor 2 changes the signature of RESTClient to take a
ClientContentConfig instead of ContentConfig - the primary difference
being that ClientContentConfig uses ClientNegotiator instead of
NegotiatedSerializer and the old Serializers type. We also collapse
some redundancies (like the rate limiter can be created outside the
constructor).

The bug fix is to negotiate the streaming content type on a Watch()
like we do for requests. We stop caching the decoder and simply
resolve it on the request. We also clean up the dynamic client
and remove the extra WatchSpecificVersions() method by providing
a properly wrapped dynamic client.

Kubernetes-commit: 3b780c64b89606f4e6b21f48fb9c305d5998b9e5
2019-11-10 16:52:08 -05:00
Jordan Liggitt
696c159e45 Plumb NextProtos to TLS client config, honor http/2 client preference
Kubernetes-commit: aef05c8dca2c1a9967ebd9a2f67a0bf7fb16f079
2019-08-28 09:55:37 -04:00
Clayton Coleman
40d852a94d Allow gzip compression to be disabled from rest.Config
Golang automatically enables transport level gzip, but local network
clients may wish to disable it for better CPU usage and lower latency
(scheduler, controller-manager). Allow DisableCompression on rest.Config
to modify the underlying transport. This impacts the transport cache,
but it is expected that most clients connecting to the same servers
within a process will have the same compression config.

Kubernetes-commit: dee6de70d0e4ad381bd5de01b6d1fbd4fde004bc
2019-08-02 14:23:33 -04:00
Jordan Liggitt
f570226af0 Exclude custom transports when constructing AnonymousClientConfig()
Kubernetes-commit: 05b764dbe3e0f979f1d17293a13bafda688d5951
2019-03-27 09:29:07 -04:00
Andrew Lytvynov
420f3f77fb Implement fmt.Stringer on rest.Config to sanitize sensitive fields
It's very easy to add glog.Info(config) calls for debugging (or actual
logging). In some scenarios those configs will carry sensitive tokens
and those tokens will end up in logs or response bodies.
Leaking of those stringified configs compromises the cluster.

Also implement fmt.GoStringer.

Kubernetes-commit: c9ad1d7339b164dfba0846ec49fa4a52474d3e23
2018-11-02 11:39:14 -07:00
Clayton Coleman
615e8e2492 Make wrapping a client transport more pleasant
Properly wrapping a transport can be tricky. Make the normal case
(adding a non-nil transport wrapper to a config) easier with a helper.
Also enforce a rough ordering, which in the future we can use to
simplify the WrapTransport mechanism down into an array of functions
we execute in order and avoid wrapping altogether.

Kubernetes-commit: 1f590e697ef64812620c787720b4b5942027e4a1
2018-12-27 11:47:50 -05:00
Jordan Liggitt
66e83da33c Plumb token and token file through rest.Config
Kubernetes-commit: dba85e58debadfcb66aff2b68ba8bcc2eafeac2d
2018-12-04 11:24:29 -05:00
Davanum Srinivas
74cd8bbeee Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135

Kubernetes-commit: 954996e231074dc7429f7be1256a579bedd8344c
2018-11-09 13:49:10 -05:00
Mike Danese
98e0c7ac0d periodically reload tokens read from TokenFile in kubeconfig
Like we do with InClusterConfig.

Kubernetes-commit: 718adb7473d2249d706b2031e0b8e0ffbd835be9
2018-11-02 18:57:45 -07:00
Mike Danese
eb0f6510ef reload token file for InClusterConfig every 5 minutes
Kubernetes-commit: 287f6a564fb8c264f281056011f4a66f197b18f4
2018-08-13 16:47:17 -07:00
Dr. Stefan Schimanski
6007d7f0a9 authn/z: optionally opt-out of mandatory authn/authz kubeconfig
Kubernetes-commit: a671d65673590f0dfcf5c2b673e1518d11510bdb
2018-08-22 11:56:07 +02:00
Yann Hodique
334ce435af client-go: fix error message spelling in rest config
Kubernetes-commit: f0ca5c1376f28c2a6c2aebeab4b83ceb35a78817
2018-07-16 16:00:03 -07:00
Mikhail Mazurskiy
4a75b93cb4 Use Dial with context
Kubernetes-commit: 5e8e570dbda6ed89af9bc2e0a05e3d94bfdfcb61
2018-05-19 08:14:37 +10:00
Clayton Coleman
a6f5cf653e restclient should not depend on api/core/v1
Kubernetes-commit: 847edc0e27054f1bf7771ba8d412b10bfd533f90
2018-04-25 18:51:38 -04:00
Eric Chiang
19c591bac2 client-go: add an exec-based client auth provider
Kubernetes-commit: 6463e9efd9ba552e60d2555a3e6526ef90196473
2018-02-07 15:43:12 -08:00
David Eads
c673e31530 remove dead prefix field
Kubernetes-commit: e7b6d77c7ec39b00da7215626cef3c0ae87fca3c
2018-01-29 11:30:14 -05:00
Eric Chiang
77f9dfa073 client-go: remove import of github.com/gregjones/httpcache
Kubernetes-commit: ea085e0a32a6b723e5c565e60d8941b5a760bb68
2017-12-15 15:02:31 -08:00
David Eads
18d0325d5c update admission webhook to accept client config
Kubernetes-commit: 0859798e8e278ec382dcbeb77914f40bf2c78a2c
2017-10-18 12:57:59 -04:00
Kubernetes Publisher
baf97d23c3 plumb the proxyTransport to the webhook admission plugin;
set the ServerName in the config for webhook admission plugin.

Kubernetes-commit: 186a0684d582272aa2fbfec390aea5fbb88a8bc6
2017-09-22 11:22:07 +00:00
Antoine Pelisse
928f5804e3 Revert "Revert "Merge pull request #47353 from apelisse/http-cache""
This reverts commit 4ee72eb300423772020dd1cf208159058ba7dab5.

Kubernetes-commit: 332b681bd1d961e2cee16bca10784088a8d308f1
2017-09-01 16:19:00 +00:00
Jordan Liggitt
53ab900949 Revert "Merge pull request #47353 from apelisse/http-cache"
This reverts commit fc89743dca6b563063b74728c3b28100cf674d9d, reversing
changes made to 29ab38e898988c36e2de34f77fa33be556eb21bd.

Kubernetes-commit: 4ee72eb300423772020dd1cf208159058ba7dab5
2017-08-29 12:51:24 +00:00
Antoine Pelisse
d7f469601f c-go: Use http Etag cache
Add a new command-line cachedir flag to specify where to store the http
cache responses. This cache will only be used for OpenAPI Swagger spec
for now (as this is the only end-point that returns an ETag).

Kubernetes-commit: d7bba25d4a42f346f1963c86fc0dab43aa4f242e
2017-08-29 12:50:18 +00:00
Dr. Stefan Schimanski
4596ac0d5c deepcopy: add interface deepcopy funcs
- add DeepCopyObject() to runtime.Object interface
- add DeepCopyObject() via deepcopy-gen
- add DeepCopyObject() manually
- add DeepCopySelector() to selector interfaces
- add custom DeepCopy func for TableRow.Cells

Kubernetes-commit: 39d95b9b065fffebe5b6f233d978fe1723722085
2017-07-19 03:39:07 +00:00
Chao Xu
d82cfb70dd run hack/update-staging-client-go, somehow we copied listers/<authn,authz,imagepolicy>
Kubernetes-commit: ffe74d1fe749b5887711f70af24e1375856f2520
2017-06-28 00:06:44 +00:00
Chao Xu
1e9caa8e14 run root-rewrite-import-client-go-api-types
Kubernetes-commit: f2d3220a11111f86b2f481e70e3c1ca4f5896f44
2017-06-28 00:06:44 +00:00
Chao Xu
cf012f20d0 easy changes
Kubernetes-commit: 3fa7b7824abbf3daec1189b118b91b5bb726958f
2017-04-28 20:28:25 +00:00
Jeffrey Regan
633aab4bea Use OS-specific libs when computing client User-Agent.
**What this PR does / why we need it**:

The User-Agent reported by clients (e.g. kubectl) in request
headers should include the name of the client executable
but not the full path to that executable.

This PR changes how this name is determined by using the
operating-system specific package "path/filepath" (meant for
working with file system paths) instead of the "path" package
(meant for URL paths).

This fixes a problem on the Windows OS in the case where, if the
user has not set their PATH to point to the location of their
client executable, the User-Agent unnecessarily includes the
full path.

Fixes: #44419

Kubernetes-commit: 04f993250bc7a1aef0f2874d440ddb4bec1012c5
2017-04-15 20:28:18 +00:00
Chao Xu
6c315a68f3 manully sync up to 1634d8f9f72a626b16c55573d78e8da2d75e6356
(merging https://github.com/kubernetes/kubernetes/pull/42084). For the new publish
script to work, client-go has to be synced up to when k8s.io/kubernetes doesn't
include _vendor
2017-03-08 11:31:44 -08:00
Kubernetes Publisher
fcdf37233b published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is baaaf26609565b4299008018486ec75fb30903eb
2017-01-25 15:19:43 +00:00
Kubernetes Publisher
204f12b1f3 published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 616038db1b0d1e852b4a3d10c8c512a052f91fba
2017-01-14 15:19:47 +00:00
Kubernetes Publisher
124670e99d published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 81d788dd6e0748e5d53a62c16d933c5f7a0718af
2016-12-04 11:39:55 +00:00
Kubernetes Publisher
41a99d711a published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 238ffdd0d6d79d610cea2ebe3a03868a197283c8
2016-12-03 08:16:09 +00:00
Kubernetes Publisher
5d8c36c93c published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 124fb610dcbd445fa710da67508ac6d5b822f61d
2016-11-24 08:15:51 +00:00
Kubernetes Publisher
75399f68c8 published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is e56cfc5322138aa23e6418ee30a6ab54c7c6fe8c
2016-10-21 04:44:19 +00:00
Chao Xu
a6d206121d remove the top-level folders for versions
remove scripts
2016-10-19 14:34:19 -07:00