Commit Graph

47 Commits

Author SHA1 Message Date
novahe a2c8b5531e Fix test cases that may potentially cause a panic.
Kubernetes-commit: 9e53371ddaaeab4083fde45e43c803071238e686
2025-03-11 17:41:37 +08:00
xin.li afb79f83b3 fix wrong assertion on tests
Signed-off-by: xin.li <xin.li@daocloud.io>

Kubernetes-commit: bc4ae15d77beab23f321bf6547f82c04ba27c3fa
2025-02-22 12:39:01 +08:00
Wei Fu 2a04234bdc proxy: should add PingPeriod for websocket translator
IIUC, before using the translator handler, the ping data can be delivered from
the client to the runtime side since kube-apiserver does not parse any client
data. However, with WebSocket, the server responds with a pong to the client
without forwarding the data to the runtime side. If a proxy is present, it may
close the connection due to inactivity. SPDY's PingPeriod can help address this
issue.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
Co-authored-by: Antonio Ojea <aojea@google.com>

Kubernetes-commit: dc59c0246fb407dcf035afc224f63fcf0da8244e
2025-02-12 21:39:59 -05:00
Patrick Ohly b84662911c remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".

Kubernetes-commit: 8a908e0c0bd96a3455edf7e3b5f5af90564e65b0
2024-12-02 14:43:58 +01:00
Matthieu MOREL aaeee2a449 fix: enable error-nil and nil-compare rules from testifylint in module `k8s.io/apiserver`
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Kubernetes-commit: 09274182e225fcf4df9e4a3d54fd96fc03de3bdf
2024-09-27 07:29:09 +02:00
Matthieu MOREL c6ba9681f7 fix: enable contains rule from testifylint in module `k8s.io/apiserver`
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Kubernetes-commit: 3b92b9f84d62550a62890d8d3f6a57d96fc70ccc
2024-09-22 11:57:24 +02:00
Matthieu MOREL b489c4ea4e fix: enable error-is-as rule from testifylint in module `k8s.io/apiserver`
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Kubernetes-commit: 0dfc6e2843f913b26c9382144fd2381f4b536bf0
2024-09-22 12:21:19 +02:00
Sean Sullivan f438154cef Adds metrics to PortForward Websockets
Kubernetes-commit: 90d70ed73dd7fcc9465baf452d178eb72f2aaf90
2024-07-17 21:29:31 -07:00
Matthieu MOREL 8705baa8b2 fix: enable empty and len rules from testifylint on pkg package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>

Kubernetes-commit: f014b754fb5925dfbca6e27a44d0c3968b157e14
2024-06-28 21:20:13 +02:00
Sean Sullivan d4a69afe4c Adds apiserver proxy doc.go
Kubernetes-commit: 98ecfd0468c8f05bb49ddade1b71eb9683bdc1a2
2024-04-09 17:56:46 +00:00
Patrick Ohly d712a4ee7e apimachinery runtime: support contextual logging
In contrast to the original HandleError and HandleCrash, the new
HandleErrorWithContext and HandleCrashWithContext functions properly do contextual
logging, so if a problem occurs while e.g. dealing with a certain request and
WithValues was used for that request, then the error log entry will also
contain information about it.

The output changes from unstructured to structured, which might be a breaking
change for users who grep for panics. Care was taken to format panics
as similar as possible to the original output.

For errors, a message string gets added. There was none before, which made it
impossible to find all error output coming from HandleError.

Keeping HandleError and HandleCrash around without deprecating while changing
the signature of callbacks is a compromise between not breaking existing code
and not adding too many special cases that need to be supported. There is some
code which uses PanicHandlers or ErrorHandlers, but less than code that uses
the Handle* calls.

In Kubernetes, we want to replace the calls. logcheck warns about them in code
which is supposed to be contextual. The steps towards that are:
- add TODO remarks as reminder (this commit)
- locally remove " TODO(pohly): " to enable the check with `//logcheck:context`,
  merge fixes for linter warnings
- once there are none, remove the TODO to enable the check permanently

Kubernetes-commit: 5a130d2b71e5d70cfff15087f4d521c6b68fb01e
2023-11-20 20:25:00 +01:00
Sean Sullivan 5e1f7568bd adds portforward streamtunnel unit tests
Kubernetes-commit: ffafb2b9ca94c14c07fb6c1fc75fccd3aba26f1f
2024-03-06 16:37:17 -08:00
Sean Sullivan 0376e5de57 adds comments to tunnelingResponseWriter
Kubernetes-commit: 3d56ff21fd3c9c9da82ff22044691ef0671ac7b6
2024-03-04 11:10:17 -08:00
Jordan Liggitt 9610424488 Fix headerInterceptingConn handling
Kubernetes-commit: 2443b3fa694462ab0438f10dea38557edea4d4e7
2024-03-02 17:57:39 -05:00
Sean Sullivan f4bc37078e portforward: tunnel spdy through websockets
Kubernetes-commit: 8b447d8c97e8823b4308eb91cf7d75693e867c61
2024-02-21 08:56:07 +00:00
Sean Sullivan b5f79f8dae streamtranslator counter metric by status code
Kubernetes-commit: 03812ddb169725b0652744c2ecaa151f5c03887b
2024-02-24 03:55:17 +00:00
Sean Sullivan 10cbfd9a3c StreamTranslator and FallbackExecutor for WebSockets
Kubernetes-commit: 168998e87bfd49a1b0bc6402761fafd5ace3bb3b
2023-07-06 21:22:07 -07:00
Richa Banker 8a38d429d8 Add impl for uvip
Kubernetes-commit: cd5f3d9f9d5ae3153206178e6114d573dc24ad73
2023-03-29 17:20:25 -07:00
Stephen Kitt 6caa44cc84 api-machinery: replace intstr.FromInt with intstr.FromInt32
This touches cases where FromInt() is used on numeric constants, or
values which are already int32s, or int variables which are defined
close by and can be changed to int32s with little impact.

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: 94410ee8078971b8894e5c400ce3fc79f02bc510
2023-03-14 16:17:48 +01:00
TommyStarK 9349b8c968 apiserver/util/proxy: Improving test coverage
Signed-off-by: TommyStarK <thomasmilox@gmail.com>

Kubernetes-commit: c6aa6e5007ffb73c5c5866554d880872faddea2b
2023-02-08 22:44:07 +01:00
Dario Tranchitella 0477735c3a fix(docs): wrong comment block for ResolveEndpoint function
Kubernetes-commit: 01c7559856f6c81d0deb7d042c06bee15be65527
2022-09-06 14:38:30 +02:00
erwinvaneyk 23f238960a Improve the error message when trying to proxy unsupported service type
Kubernetes-commit: 342ef6234d4c7acf3ffca0f01831de316fb7ac11
2021-11-17 12:24:49 +01:00
Ted Yu e5660b53e8 Output port as number in error message
Kubernetes-commit: c224a6de5e01455bcd89763f1483546496e41dcb
2019-11-22 13:12:59 -08:00
Mehdy Bohlool 6c13576bf2 Add port to ServiceResolvers
Kubernetes-commit: 11f37d757fc0b710245446c80a8c9578ce2c02f1
2019-03-01 16:32:50 -08:00
Kubernetes Publisher 627fa76a8b sync: initially remove files BUILD */BUILD BUILD.bazel */BUILD.bazel 2018-03-15 09:38:17 +00:00
Jeff Grafton 1ab12b2dc8 Autogenerated: hack/update-bazel.sh
Kubernetes-commit: ef56a8d6bb3800ab7803713eafc4191e8202ad6e
2018-02-16 13:43:01 -08:00
Jeff Grafton c8a97ee31a Autogenerate BUILD files
Kubernetes-commit: efee0704c60a2ee3049268a41535aaee7f661f6c
2017-12-23 13:06:26 -08:00
Jeff Grafton f4dbe23125 update BUILD files
Kubernetes-commit: aee5f457dbfd70c2d15c33e392dce6a3ca710116
2017-10-12 13:52:10 -07:00
Jeff Grafton 6c539a43c6 Use buildozer to delete licenses() rules except under third_party/
Kubernetes-commit: a7f49c906df816123e7d4ccbd4cebab411519465
2017-08-29 13:15:24 +00:00
Jeff Grafton 6caa2933ae Use buildozer to remove deprecated automanaged tags
Kubernetes-commit: 33276f06be5e872bf53ca62a095fcf0a6b6c11a8
2017-08-29 13:15:24 +00:00
Jeff Grafton 44942b068a Run hack/update-bazel.sh to generate BUILD files
Kubernetes-commit: 3579017b865ddbc5449d6bba87346f086e4b93ff
2017-08-29 13:13:51 +00:00
Clayton Coleman ec4f695076 generated: bazel / godeps
Kubernetes-commit: c73622108ccd285b245cf9fe2dc218a47398d31d
2017-07-16 04:08:42 +00:00
Clayton Coleman bcc0d0a6d0 Unify generic proxy code in apimachinery
Make the utility package truly generic, consolidate all generic proxy in
apimachinery.

Kubernetes-commit: edc12aafe2fbfe3475bdf03c34ffa26cc4322673
2017-07-16 04:08:41 +00:00
Chao Xu 8be42ee0d0 run hack/update-all
Kubernetes-commit: 60604f8818aecbc9c3736fbc32747cc0a535bc80
2017-06-28 00:14:31 +00:00
Chao Xu 81b7aaaa7d run root-rewrite-import-client-go-api-types
Kubernetes-commit: f2d3220a11111f86b2f481e70e3c1ca4f5896f44
2017-06-28 00:14:31 +00:00
Dr. Stefan Schimanski c0e7280688 Update bazel
Kubernetes-commit: c7d9a396fdf9ef63272896200ab90afa0581c8f3
2017-06-13 20:47:30 +00:00
Dr. Stefan Schimanski a3e36a6bf1 aggregation: add ExternalName service support
Kubernetes-commit: 8b409e8f777a305454616554c40c905acad596ac
2017-06-13 20:47:30 +00:00
Dr. Stefan Schimanski 6b536dfda4 aggregation: handle ClusterIPNone correctly
Kubernetes-commit: b1f708758c70dfbb3dde4dec7d2f423b7303e661
2017-06-13 20:47:30 +00:00
Dr. Stefan Schimanski 449313536f aggregation: unify mode implementations
Kubernetes-commit: d56759452cccd34c33d987d001092128d0b0f2ff
2017-06-13 20:47:30 +00:00
Dr. Stefan Schimanski 0b2bbf270c aggregation: restore cluster-ip routing tests
Kubernetes-commit: 35335c09e17c3479ff660f93aaaeed041837b247
2017-06-13 20:47:30 +00:00
Walter Fender 5428bc23d8 Change to aggregator so it calls a user apiservice via its pod IP.
proxy_handler now uses the endpoint router to map the cluster IP to
appropriate endpoint (Pod) IP for the given resource.
Added code to allow aggregator routing to be optional.
Updated bazel build.
Fixes to cover JLiggit comments.
Added util ResourceLocation method based on Listers.
Fixed issues from verification steps.
Updated to add an interface to obfuscate some of the routing logic.
Collapsed cluster IP resolution in to the aggregator routing
implementation.
Added 2 simple unit tests for ResolveEndpoint

Kubernetes-commit: ad8a83a7c1741efb507d924a17eb809748ee2e06
2017-06-13 20:47:29 +00:00
Mike Danese aab2f083cf replace CloneTLSConfig() with (*tls.Config).Clone()
Kubernetes-commit: 6c6dbec1e2364b994bdae42828e094b9b540f9b3
2017-04-28 20:36:30 +00:00
Andy Goldstein 478b3779f2 Add redirect support to SpdyRoundTripper
Add support for following redirects to the SpdyRoundTripper. This is
necessary for clients using it directly (e.g. the apiserver talking
directly to the kubelet) because the CRI streaming server issues a
redirect for streaming requests.

Also extract common logic for following redirects.

Kubernetes-commit: 715d5d9c91c669cf33c0bf9a9c9d352c6c4228a6
2017-04-27 20:37:01 +00:00
Mike Danese 2aab760a2a autogenerated
Kubernetes-commit: a05c3c0efdc5822049e34b1a5a1ee259c5fb1906
2017-04-15 20:35:23 +00:00
Abhishek Dasgupta ba77f4a298 Updated key.pm and cert.pm to remove error in setting up localhostCert pool.
Signed-off-by: Abhishek Dasgupta <a10gupta@linux.vnet.ibm.com>

Kubernetes-commit: 0d42da1b9345e2a649f298ac4f77807143e7befa
2017-04-10 20:35:11 +00:00
Dr. Stefan Schimanski 5858be0e9d third_party/forked/golang/netutil: move to k8s.io/apimachinery 2017-01-27 08:47:01 -05:00
Dr. Stefan Schimanski de513ec8e2 pkg/util: move proxy into k8s.io/apiserver 2017-01-27 08:47:01 -05:00