Commit Graph

835 Commits

Author SHA1 Message Date
wojtekt 242c8c8a1c Optimize APF support for watch initialization to fix the pod startup time regression.
Kubernetes-commit: ef435b85b47618d0d463ac93e9758d75c2998681
2021-07-13 10:22:30 +02:00
Ryan Phillips 7afffd8ef3 Revert "apiserver: add callback to get notified of object count"
Kubernetes-commit: d95b14e1abfb5ec87248e5dd826b89d0c738af42
2021-07-08 13:56:39 -05:00
wojtekt fbc127e994 Add watch tracker to APF for request cost estimation
Kubernetes-commit: cea1dcfeed2fc4e8ab89cd43e5a0e402251c8df5
2021-06-15 10:49:42 +02:00
Abu Kashem cf5c77fde9 apf: add additional latency into width
Kubernetes-commit: 24e19229101d242d924ce98a562be3864dde9eae
2021-06-27 12:45:24 -04:00
David Ashpole fe620be9c7 change tracing service from kube-apiserver to apiserver
Kubernetes-commit: 8972efc65fe7f4d2ed840ba1a2bd8ff31e829a7a
2021-07-02 07:04:26 -07:00
Abu Kashem d929410e13 apiserver: add callback to get notified of object count
Kubernetes-commit: 1002b0d163dd948334f10b0e25d0e91d253791e8
2021-06-18 10:44:07 -04:00
Lukasz Szaszkiewicz aefd8ed86f adds HasBeenReady signal that fires when the readyz endpoint succeeds
Kubernetes-commit: 58b91ffca9efe3afb20d80914cdc33c6b0acdef2
2021-07-02 15:18:19 +02:00
Lukasz Szaszkiewicz 279d11fb1e readyz signals when the handler succeeds for the first time.
Co-authored-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>

Kubernetes-commit: ca108d109d55e927c292e3e558fc4f761a3a4e7c
2021-06-30 11:04:44 +02:00
Lukasz Szaszkiewicz d8c0235e05 remove logging from the Signal method
Kubernetes-commit: 6c88a62cb4c849e3844dcc3870073a1b5e05d301
2021-07-02 12:50:20 +02:00
Lukasz Szaszkiewicz 3f407f0668 rename terminationSignals to lifecycleSignals
Kubernetes-commit: dae08bc3a735e50845af7cf639bdbb8971a2115a
2021-07-02 12:28:07 +02:00
David Ashpole 71612b014d move tracing instantiation further up, and check for nil
Kubernetes-commit: b0ffaa93f5c607325203f978c1ae685d6b64d053
2021-07-01 10:42:11 -07:00
David Ashpole 5053bddd06 add tracing to the apiserver's client-go requests
Kubernetes-commit: 79d400c4416f903af604fb2cf07d2c34bb4b98f7
2021-06-26 09:16:32 -07:00
Lukasz Szaszkiewicz 9ff2637133 adds metrics for authorization webhook
Kubernetes-commit: 4a2aef00d6dd2543b011aa7e5af28df598a0cd72
2021-03-17 16:30:40 +01:00
Lukasz Szaszkiewicz 69433684ce adds metrics for authentication webhook
Kubernetes-commit: 322c18c147da08dd2eea25ba3c2b9630a228cf5f
2021-02-23 08:39:25 +01:00
JD Nurme 288c8d4acf Updated to use konnectivity client v0.0.21, and implemented placeholder context
Kubernetes-commit: 21fd224ebdb17fbaafbb73a36a18aafcab6e4efa
2021-06-23 19:29:14 +00:00
Abu Kashem 4f3f9c7b9e add unit test to verify graceful termination behavior
Kubernetes-commit: 913c449a42f13da758fca2740474bb33d3b65da8
2021-06-24 16:15:12 -04:00
Abu Kashem c1c949723d apiserver: NonBlockingRun should return a listener stopped channel
NonBlockingRun should also return a channel that gets closed when the
underlying http Server has stopped listening (during the graceful
shutdown period)

Kubernetes-commit: a84c1b71005930e8253c1348515020132c5c175b
2021-06-24 16:04:54 -04:00
Abu Kashem 5c1642946b apiserver: refactor graceful termination logic
- refactor graceful termination logic so we can write unit tests
  to assert on the expected behavior.

Kubernetes-commit: d85619030e3a5fec5960ad00136e8d9bd030b5f8
2021-06-24 15:51:38 -04:00
David Ashpole 5927da0040 Add distributed tracing to the apiserver using OpenTelemetry
Kubernetes-commit: 79550ed40c67a70534c1cb697e1fb7e7dbf96335
2021-06-25 05:20:16 -07:00
Mike Spreitzer feae5f3e79 Add config checking for inflight limits
When API Priority and Fairness is enabled, the inflight limits must
add up to something positive.
This rejects the configuration that prompted
https://github.com/kubernetes/kubernetes/issues/102885

Update help for max inflight flags

Kubernetes-commit: 0762f492c5b850471723a305cfa7390e44851145
2021-06-21 16:53:07 -04:00
Antonio Ojea 5a7fb85083 deflake TestClientReceivedGOAWAY test
The test was flaking because the test was creating more connections
than expected.

Disabling connection pooling removes the flakes, and no more connections
are created that the necessary.

Kubernetes-commit: 4d11c3cd8cb18c1e246a7a6b8e9a791177c49d31
2021-06-18 00:38:02 +02:00
Daniel Smith a08d7d5ddf Make logged verbs match metric-reported verbs
Kubernetes-commit: 54fde5d119f8bb55aec18cb5aef01b6ea58dfea0
2021-06-16 17:08:54 -07:00
Davanum Srinivas c2350dc583 Switch to github.com/coreos/go-systemd/v22 and drop older package
- We use the new v22 module released on May 10
- We drop the unmaintained `github.com/coreos/pkg`

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

Kubernetes-commit: 7fcdbbef06d0bc8c4416db1d2cbba9f30d30e8c4
2021-06-16 11:14:02 -04:00
Abu Kashem 3c7f54740f apf: add plumbing to estimate width" of a request
- add plumbing that allows us to estimated "width" of a request
- the default implementation returns 1 as the "width" of all
  incoming requests, this is in keeping with the current behavior.

Kubernetes-commit: 9b72eb1929a64b9d5a5234090a631ba312fb4d41
2021-05-11 07:03:05 -04:00
Abu Kashem f410577081 apiserver: close handler chain right after shutdown delay duration
Kubernetes-commit: de7e56bf37440ca6a4c634ede8abaf1315fe9de3
2021-06-07 18:13:24 -04:00
AbdulBasitAlvi da18259e5b hotfix(staging_apiserver_pkg_httplog): restore depth to log calls
/kind bug

This PR adds depth to logging which was removed when migrating to structured logging in the file

Ref #102353

```release-note
NONE
```

```docs

```

Kubernetes-commit: 5d4c1162b944ff34374313103d0555ac0b334a1d
2021-05-30 01:42:54 +02:00
Abu Kashem 9421ee44c4 apf: fix flake in test
Kubernetes-commit: 8847a25026711f51ae694fe8288e285a48e70675
2021-06-01 20:07:51 -04:00
Jordan Liggitt 84ac736f8e Fix audit unit test file location
Kubernetes-commit: 91e5d98b572a74bf827a575559238cc0a4be6c57
2021-06-04 17:23:34 -04:00
wojtekt 9b71cff19c Fix watch rejections in P&F filter
Kubernetes-commit: 8054b0f808d116658ac086e4b71fb34d1502cd57
2021-06-02 08:22:29 +02:00
wojtekt d000916ae7 Address watch panics in P&F handler and extend testing.
Kubernetes-commit: d9d51541a87ec627160d7d6a1fcd4b357a0fa493
2021-05-27 14:49:54 +02:00
wojtekt 5290a24345 Implement support for watch initialization in P&F
Kubernetes-commit: 0cc217647ca8be0820973b970124a072c27b6575
2021-05-07 12:49:06 +02:00
Marcel Zięba 489e43cad9 Add logging of filters to api calls logs
Kubernetes-commit: 7e01b7260ac5cc20c1fc236cae220857726dc330
2021-05-17 11:52:33 +00:00
Lukasz Szaszkiewicz 1d2b77256f adds a unit test for checking if graceful shutdown of HTTP2 server works
Kubernetes-commit: 373fc7d711a2fb39b7e94737b2b880feca596171
2020-12-11 13:12:46 +01:00
David Eads d15d62d4df enforce strict alpha handling for API serving
Kubernetes-commit: 21faec925459bce93954e0f0110ebd3a4f207c24
2021-05-12 09:17:15 -04:00
David Eads 2286099903 update integration tests to reflect the kube version to stop serving removed APIs
Kubernetes-commit: d6a4afa5b8f6b7a17868649ea40b370c7f12a37f
2021-05-11 15:17:40 -04:00
sanwishe 1b6c1bf2dd Structured Logging migration: for package staging/src/k8s.io/apiserver/pkg/server/dynamiccertificates
Signed-off-by: sanwishe <jiang.mingzhi35@zte.com.cn>

Kubernetes-commit: 6eb645088c41f5f9309ad27a3fe80ccebd18460d
2021-05-10 20:08:14 +08:00
pacoxu e11aa23b6b wait for poststarthook/max-in-flight-filter to be initialized asynchronously
Signed-off-by: pacoxu <paco.xu@daocloud.io>

Kubernetes-commit: 3c4eb55b4acd4bc4740b15a58fc7da0d5b516300
2021-05-07 15:17:03 +08:00
Chao Xu 8f650d1e76 Move the comment to the right line
Kubernetes-commit: 6001c70c7274d88b566ac3ff40e4f8900cc23c54
2021-04-23 00:05:15 +00:00
Chok Yip Lau f0cd8bd9bf Fix staticcheck on vendor/k8s.io/apiserver/pkg/server/httplog
Kubernetes-commit: eaaa803d48e8d78e5ad6d49324169e9d775ed7bc
2021-01-08 17:57:20 -05:00
Abu Kashem b84fa01322 add more context to post timeout request activities
Kubernetes-commit: 66587afb60b10569aa4ed35d53a4a91fcc40abd2
2021-04-09 12:09:35 -04:00
Chao Xu 218926b065 Switch the order of adding SNICert and creating LoopbackClientConfig
Kubernetes-commit: 1df4503b859a2b7b2b7f9c5bcf400f61cc29d349
2021-04-22 23:17:39 +00:00
Juan Antonio Osorio Robles 332add01ef Ensure audit log permissions are restricted
While the apiserver audit options merely use the lumberjack logger in
order to write the appropriate log files, this library has very loose
permissions by default for these files [1]. However, this library will
respect the permissions that the file has, if it exists already. This is
also the most tested scenario in the library [2].

So, let's follow the pattern marked in the library's tests and
pre-create the audit log file with an appropriate mode.

[1] https://github.com/natefinch/lumberjack/blob/v2.0/lumberjack.go#L280
[2] https://github.com/natefinch/lumberjack/blob/v2.0/linux_test.go

Signed-off-by: Juan Antonio Osorio Robles <jaosorior@redhat.com>

Kubernetes-commit: 42df7bc5b3aa26bf545b6392b557833c7162c472
2020-10-08 09:38:57 +03:00
Gautier Delorme af9424d2c9 remove go-openapi/spec
Signed-off-by: Gautier Delorme <gautier.delorme@gmail.com>

Kubernetes-commit: 34b0fcef5fc47e3fcddf7f6ca1b3e6176b2a5323
2021-04-20 17:48:33 +02:00
Mike Danese a6a121887a force implementors of dyanmiccertificates providers to think about notify
Right now, `_, ok := provider.(Notifier); !ok` can mean one of two
things:

1. The provider does not support notification because the provided
   content is static.
2. The implementor of the provider hasn't gotten around to implementing
   Notifier yet.

These have very different implications. We should not force consumers of
these interfaces to have to figure out the static of Notifier across
sometimes numerous different implementations. Instead, we should force
implementors to implement Notifier, even if it's a noop.

Change-Id: Ie7a26697a9a17790bfaa58d67045663bcc71e3cb

Kubernetes-commit: 9b7d654a08d694d20226609f7075b112fb18639b
2021-04-09 16:59:17 -07:00
Shihang Zhang 87ac3f57d4 allow multiple of --service-account-issuer
Kubernetes-commit: 925900317e43e58435082f624f5969e3cfe25c67
2021-04-15 09:50:43 -07:00
Lukasz Szaszkiewicz 49d90ce0ad DelegatingAuthenticationOptions TokenReview request timeout
it turns out that setting a timeout on HTTP client affect watch requests made by the delegated authentication component.
with a 10 second timeout watch requests are being re-established exactly after 10 seconds even though the default request timeout for them is ~5 minutes.

this is because if multiple timeouts were set, the stdlib picks the smaller timeout to be applied, leaving other useless.
for more details see a937729c2c/src/net/http/client.go (L364)

instead of setting a timeout on the HTTP client we should use context for cancellation.

Kubernetes-commit: d690d71d27c78f2f7981b286f5b584455ff30246
2021-04-09 13:20:51 +02:00
Abu Kashem bb69e234a6 apiserver: improve correlation by using the audit ID
- when we forward the request to the aggregated server, set the audit
  ID in the new request header. This allows audit logs from aggregated
  apiservers to be correlated with the kube-apiserver.
- use the audit ID in the current tracer
- use the audit ID in httplog
- when a request panics, log an error with the audit ID.

Kubernetes-commit: b607ca1bf3e1cf6152c446ea61ac7fdd9014e1f1
2021-03-02 19:27:43 -05:00
Abu Kashem f1a76db888 apiserver: manage audit ID associated with a request
Manage the audit ID early in the request handling logic so that it can
be used by different layers to improve correlation.
- If the caller does not specify a value for Audit-ID in the request
  header, we generate a new audit ID
- If a user specified Audit-ID is too large, we truncate it
- We echo the Audit-ID value to the caller via the response
  Header 'Audit-ID'

Kubernetes-commit: 31653bacb9b979ee2f878ebece7e25f79d3f9aa6
2021-03-02 19:22:39 -05:00
Abu Kashem 1e7338b1ea use request received timestamp in httplog
Kubernetes-commit: 71199664be6d26e435a78566818379ff43110352
2021-03-02 18:05:51 -05:00
Lukasz Szaszkiewicz b5be45a80f DelegatingAuthOptions: allows for specifying a middleware function for custom HTTP behaviour for the auth webhook client
Kubernetes-commit: ea7d94497b5fef2fe7b925d378f425b94448f01b
2021-03-04 12:35:09 +01:00
xiongzhongliang fbe8ccc9bd Optimize some codes
Kubernetes-commit: 4a24a08f936a295bf332b9567bea182e2feff554
2021-02-28 01:00:09 +08:00
Kevin Delgado a11399dd98 Add ability to skip OpenAPI handler installation
Kubernetes-commit: 66d2f4359efadd2cf85f9d901676f2ea28555951
2021-03-17 00:26:23 +00:00
answer1991 db01b261c4 disable flaky TestClientReceivedGOAWAY test case
Kubernetes-commit: d6f9369126dcaa3c94902108ec1aa3d01f658163
2021-03-15 21:12:22 +08:00
Monis Khan 63ca1f6039 delegated authn: allow client CA override based on non-empty opts
Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: 6686d8b846546f682d1a449cc9cd0e3c0de977b4
2021-03-09 22:53:04 -05:00
David Eads 3f9e652c39 provide directly decodable versions for storageversion API
Kubernetes-commit: fa03dee68cea605b285b00ae5b6ce22659d95026
2021-03-08 09:33:46 -05:00
answer1991 43c20c5bfe enable goaway testcases which will not flake any more with new golang.org/x/net version.
Kubernetes-commit: f1b23fe7679f3c650cabcd13a60b5a08b8cda36f
2021-02-05 23:34:30 +08:00
Jordan Liggitt a70d9c48f0 Deflake TestPrepareRun
Kubernetes-commit: ba4aade23a76969d7598fb7ac170891c183e7327
2021-03-06 19:46:00 -05:00
Han Kang 1cd0838bc2 bump apiserver_request_total to STABLE status
We've dropped the content-type field since it is effectively unbounded
(we had a sec-vuln about this before actually). We retain all other
fields, despite their unboundedness due to the fact that we can now
explicitly set bounds on label values.

Change-Id: Icc483fc6a17ea6382928f4448643cda6f3e21adb

Kubernetes-commit: cfd00de6866e636332bdcd3f46d6d2ffd8d2bc88
2021-03-04 07:52:00 -08:00
Shiming Zhang 4180bf5339 Fix flake test timeout
Kubernetes-commit: bd2655be235a00fe9db47dfe03220b691599f5f0
2021-02-23 13:59:31 +08:00
David Eads e4ff37f227 refact RemoveDeletedKinds to eliminate questions about interating over mutated maps
Kubernetes-commit: ab429a3120deafb64104d113ca86274e73b18314
2021-03-03 16:02:08 -05:00
David Eads 04ee9b3397 Use a versioner to convert an internal type into an external type for
beta serving

Kubernetes-commit: 3cf9bc547fcd9d3e93bf7ccdbf989fa7d8c32221
2021-02-23 11:13:50 -05:00
carlory 146083d06b deprecate audit.k8s.io/v1[alpha|beta]1 versions
Kubernetes-commit: cad9c245b84fd16cbb5bf240622af07ce7bc3585
2021-02-08 11:22:29 +08:00
yue9944882 d3f04fd7c9 support storage encryption for aa server
Kubernetes-commit: dcf4821cd4c798aa08e6b31c5474717c7164945a
2021-02-18 19:10:50 +08:00
David Eads 9c9a096f68 move removed kind evaluation to genericapiserver
Kubernetes-commit: f6941fcfa227beb78d0bdda2b85c81514cf64e12
2021-02-11 16:45:53 -05:00
Abu Kashem 8cbefb5817 apf: set response headers for rejected requests
Kubernetes-commit: de73ac519867b3ce41adcb9a419c3c28c7a99c41
2021-02-16 12:13:36 -05:00
hellogdc 1d45e7fbbc fix the address of restful-CORS-filter.go and restful-basic-authentication.go in the comment of ./staging/src/k8s.io/apiserver/pkg/server/filters/cors.go
Kubernetes-commit: 66459d3386db74ba02a06ee29f68248bd695aa8f
2021-02-06 09:07:58 +08:00
Marek Siarkowicz f4899d2eda Allow adding healthz and livez checks independent to each other
Kubernetes-commit: 67f3204b408ce71bab1f3c6102f8c06f50919337
2021-02-13 17:29:34 +01:00
Maurizio Drocco 353b45e333 Update etcd.go
Kubernetes-commit: f6ac24bfd86d9dfce6a8ff0d611b4fdabc7bc504
2020-04-13 13:29:18 -04:00
Maurizio Drocco 68a0c4dbb1 Update etcd.go
Kubernetes-commit: 368e976113ca035854083212275a0c39373f152e
2020-04-10 13:21:59 -04:00
Maurizio Drocco 05f1caa35b Update etcd.go
Kubernetes-commit: 5c3d6a26a11875a8305832fa681cc5929d159eb2
2020-04-10 11:12:26 -04:00
Maurizio Drocco 442d715210 added note on --etcd-servers-overrides
Added a note on etcd-servers-overrides option, to clarify CRDs are not supported (yet).

Kubernetes-commit: 4a71f84a30107abde63b66424c2f8d55acde7ffe
2020-04-10 10:14:50 -04:00
Nikhita Raghunath d22b238769 *: remove nikhiljindal from OWNERS
Kubernetes-commit: 6cef3a4e33c10c27bb301a1070ea3ff4cdad0c39
2021-02-16 10:50:50 +05:30
Dr. Stefan Schimanski 482cbd8dcc apiserver: add --permit-address-sharing flag to listen with SO_REUSEADDR
Kubernetes-commit: cef2ab700fc7d9ce226ab51f78344c907dfbb831
2020-08-10 15:51:37 +02:00
yoyinzyc 74c8267082 add context to metrics in apiserver/endpoint
Kubernetes-commit: 266d67bd5124725befe775d580289b67a59f496c
2021-01-20 13:13:00 -08:00
David Eads 4925be5c06 Update delegated authorization options default to eliminate unnecessary
SARs

healthz, readyz, and livez are canonical names for checks that the kubelet does.  By default, allow access to them in the options. Callers can adjust the defaults if they have a reason to require checks.

system:masters has full power, so the authorization check is unnecessary and just uses an extra call for in-cluster access.  Callers can adjust the defaults if they have a reason to require checks.

Kubernetes-commit: cebce291ddcb8490a705c79623c0b4f13faef6e7
2021-01-22 16:16:14 -05:00
pacoxu 2343af38bb fix all keps links 404 for kep folder migration
Signed-off-by: pacoxu <paco.xu@daocloud.io>

Kubernetes-commit: a10bdfed09e96f3c2703454caafa2c884914e064
2021-01-14 14:03:21 +08:00
Abu Kashem c4f555497d add unit test to simulate an enqued request that times out
Kubernetes-commit: 1d691ddb44e8dfa54008977469201a811410f7e9
2020-12-21 12:08:58 -05:00
Abu Kashem 026eb846a4 apiserver: plumb context with request deadline
- as soon as a request is received by the apiserver, determine the
  timeout of the request and set a new request context with the deadline.
- the timeout filter that times out non-long-running requests should
  use the request context as opposed to a fixed 60s wait today.
- admission and storage layer uses the same request context with the
  deadline specified.

we use the default timeout enforced by the apiserver:
- if the user has specified a timeout of 0s, this implies no timeout on the user's part.
- if the user has specified a timeout that exceeds the maximum deadline allowed by the apiserver.

Kubernetes-commit: e416c9e574c49fd0190c8cdac58322aa33a935cf
2020-11-26 23:53:20 -05:00
SataQiu ae6d1f2a91 fix the bug that network proxy logging http-connect mode in all cases
Signed-off-by: SataQiu <1527062125@qq.com>

Kubernetes-commit: 1690d6d011dd00360f2bbd1ae85897a726b60c85
2021-01-27 12:09:11 +08:00
xiongzhongliang 351f1ab57a use klog.Info and klog.Warning when had no format
Kubernetes-commit: 90f4aeeea4cc5f96caa6ed87c67ca7e62d1ba21c
2020-11-14 00:55:06 +08:00
yue9944882 9db9b5f556 disables APF if the aggregated apiserver cannot locate the core kube-apiserver
Kubernetes-commit: 02df343437ca9331ab6b0a0de65858c68ba47a54
2021-01-12 18:08:46 +08:00
KeZhang 23abb6c50f Fix HSTS Missing From HTTPS Server(Nessus Scanner)
Kubernetes-commit: 4801f4d25506dbfed834c67e3fc363bfab54a48e
2020-11-12 16:10:58 +08:00
yue9944882 54481aaf0e fixes nil panic for nil delegated auth options
Kubernetes-commit: 9ade821baab1fa5573f4a36eb7d7098b033ec17c
2021-01-12 17:12:33 +08:00
Ling Samuel bd7da186cc apiserver add metric etcd_lease_object_counts
Signed-off-by: Ling Samuel <lingsamuelgrace@gmail.com>

Kubernetes-commit: 7e9fe39cd7c3ee67fcc29e6ca0836917c5a4e9e1
2020-12-07 10:45:44 +08:00
Abu Kashem eea0d66fcd clean up executing request on panic
Kubernetes-commit: 13cedca0eb5337b13e5176983ea5e784ec38df22
2020-12-10 12:57:21 -05:00
Antonio Ojea bd10b9f5fb bind-address flag usage
Kubernetes-commit: 2e4aed2d4a8dc32acbd12ee7464fa00e650e0204
2020-12-11 18:42:51 +01:00
Ling Samuel f673ce24f7 apiserver add --lease-reuse-duration-seconds to config lease reuse duration
Signed-off-by: Ling Samuel <lingsamuelgrace@gmail.com>

Kubernetes-commit: c99567005db15d220f2b792e98af735c5aa24f6e
2020-12-02 17:35:10 +08:00
Abu Kashem 239a5f624e add comment to describe why we set the UID in the response headers
Kubernetes-commit: cecd90f52418458d7ef146846fa6efabeddc3f7c
2020-12-01 14:31:54 -05:00
Ken Sipe 0da065589a fix S1023 redundant return statement
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: 1d795002919675b8cf3bf462b6543fef843b5b54
2020-06-25 17:29:42 -05:00
Stefan Bueringer 8f48bb2b5d rollback httplog change
Kubernetes-commit: 6190b87927ccfe57600b19217b31523b8acacb86
2020-11-17 12:56:47 +01:00
Stefan Bueringer c8433b21e4 fix staticcheck: vendor/k8s.io/apiserver/pkg/server
Kubernetes-commit: ed0adcb65e92198177bf23db97807b3312d6be29
2020-11-17 11:58:13 +01:00
drfish 385e831c2d Fix typo in apiserver config.file file
Kubernetes-commit: 3d51cbef6b099db14bd5bf966be46cecc1514a47
2020-06-20 22:26:18 +08:00
Jordan Liggitt cec339c07a Revert "plumb context with request deadline"
This reverts commit 83f869ee1350da1b65d508725749fb70d0f535f2.

Kubernetes-commit: afd92b3b3ea8fa8e3dbe2521d6ce213c809d25c7
2020-11-19 18:15:04 -05:00
Abu Kashem 46e3e4810e plumb context with request deadline
- as soon as a request is received by the apiserver, determine the
timeout of the request and set a new request context with the deadline.
- the timeout filter that times out non-long-running requests should
use the request context as opposed to a fixed 60s wait today.
- admission and storage layer uses the same request context with the
deadline specified.

Kubernetes-commit: 83f869ee1350da1b65d508725749fb70d0f535f2
2020-10-30 16:30:05 -04:00
Antoine Pelisse 1419de0133 Strip defaults in new places
Kubernetes-commit: de4abee3ef6f23d0ff43e01639c046c47001edc8
2020-11-11 12:42:12 -08:00
yue9944882 a4a3fc9b87 APF: graduate API and types to beta
Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>

Kubernetes-commit: 849be447f563fc93a27a0827fb1185b885b57114
2020-11-04 16:33:14 +08:00
David Eads fd497c40f8 put a message, not a stack, in the log on a timeout
Kubernetes-commit: 2fca40d5b1699aafa940fcf6260a994ca8a7567f
2020-11-10 14:52:36 -05:00
Lukasz Szaszkiewicz 383e99f309 stops puting a stacktrace of aborted requests in the logs
Aborted requests are the ones that were disrupted with http.ErrAbortHandler.
For example, the timeout handler will panic with http.ErrAbortHandler when a response to the client has been already sent
and the timeout elapsed.

Additionally, a new metric requestAbortsTotal was defined to count aborted requests. The new metric allows for aggregation for each group, version, verb, resource, subresource and scope.

Kubernetes-commit: 057986e32c1bb7284b0edbc161f0380f1548492f
2020-09-24 10:07:24 +02:00
Haowei Cai 0273686309 require APIServerIdentity to be enabled to run StorageVersionAPI
without APIServerIdentity enabled, stale apiserver leases won't be GC'ed
and the same for stale storage version entries. In that case the storage
migrator won't operate correctly without manual intervention.

Kubernetes-commit: 1c2d446648662529282a3bb1528a6dbb50700fdb
2020-11-08 19:06:30 -08:00
Haowei Cai 21ce34e628 return a Status formatted JSON response
Kubernetes-commit: 8a1d8f7fd58ee7eaa9a8985048a56e02c9ad40c1
2020-11-04 22:29:52 -08:00
Chao Xu 5533252037 Add a generic filter that blocks certain write requests before
StorageVersions are updated during apiserver bootstrap.

Also add a poststarthook to the aggregator which updates the
StorageVersions via the storageversion.Manager

Kubernetes-commit: 721897871697db007c2439ac298c579c0f201388
2020-02-24 15:36:08 -08:00
Chao Xu cfa0865e12 Collect storage versions as ResourceInfo when installing API endpoints.
Co-authored-by: Haowei Cai <haoweic@google.com>

Kubernetes-commit: 369475681679e1cb68c23c3355542599a3c0e1e3
2020-02-24 15:35:14 -08:00
yue9944882 dd68cdaa08 removes filter metrics test retries
Kubernetes-commit: 58cf6c0fb87a670165bd02128bb3b6db44e765e4
2020-11-05 11:41:34 +08:00
Haowei Cai 8e0bbdb835 add kube-apiserver-lease-controller poststart hook
Kubernetes-commit: 3761a00e5b4bd1fab01f0b6682830aa1ef86a131
2020-10-26 13:17:00 -07:00
Lukasz Szaszkiewicz e275c178b6 DelegatingAuthenticationOptions: allows for setting a timeout for the TokenReview client that is used by for the webhook authenticator
Previously no timeout was set. Requests without explicit timeout might potentially hang forever and lead to starvation of the application.
When no timeout was specified a default one will be applied.

Kubernetes-commit: 7340c3498ac23f46fc8b6bff4d5ac664a9c64a3b
2020-11-04 11:14:44 +01:00
David Eads beb1fce6bb remove dead apiserver field
Kubernetes-commit: 4dcf3807ac534377439b948d9772101ef8ac0259
2020-11-04 14:35:13 -05:00
Adhityaa Chandrasekar 1ad5afe6a9 apiserver/filters test: fix data race and do not leak goroutines
Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>

Kubernetes-commit: a2eb6d67ee43c799465ea0378c83dc3ac3a24246
2020-11-04 18:58:06 +00:00
Patrik Cyvoct ddd0b07a5a Allow configuration of etcd healthcheck timeout
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>

Kubernetes-commit: 2e430ba622817b534642fd93098f87ea7f983aee
2020-07-20 09:22:13 +02:00
staebler a541a1b602 do not allow inflight watermark histograms to fall too far behind
The MaxInFlight and PriorityAndFairness apiserver filters maintain
watermarks with histogram metrics that are observed when requests
are handled. When a request is received, the watermark observer
needs to fill out observations for the entire time period since the
last request was received. If it has been a long time since a
request has been received, then it can take an inordinate amount of
time to fill out the observations, to the extent that the request
may time out. To combat this, these changes will have the filters
fill out the observations on a 10-second interval, so that the
observations never fall too far behind.

This follows a similar approach taken in
9e89b92a92c02cdd2c70c0f52a30936e9c3309c7.

https://github.com/kubernetes/kubernetes/issues/95300

The Priority-and-Fairness and Max-in-Flight filters start goroutines to
handle some maintenance tasks on the watermarks for those filters. Once
started, these goroutines run forever. Instead, the goroutines should
have a lifetime tied to the lifetime of the apiserver.

These changes move the functionality for starting the goroutines to
a PostStartHook. The goroutines have been changed to accept a stop channel
and only run until the stop channel is closed.

Kubernetes-commit: 6c9b86646871f13a4431361310ba6a0785372053
2020-10-05 11:26:48 -04:00
bjrara 7498f28769 Add multi request test
Kubernetes-commit: 833ce487b9fab1650d5aaba2a8b295f8a90e07bd
2020-10-09 16:51:19 +08:00
bjrara bb16b18666 Fix issue in missing metrics of terminated requests
Kubernetes-commit: ce00f4ee545af8d7b7519045c3422893e19d43bc
2020-08-17 15:57:15 +08:00
yue9944882 0c7caae2de e2e cases for apf
Kubernetes-commit: c28036efa5fcafdbd9d10014c9197bef42d05eaf
2020-09-21 15:43:01 +08:00
Abu Kashem 5254108841 make backoff parameters configurable for webhook
Currently webhook retry backoff parameters are hard coded, we want
to have the ability to configure the backoff parameters for webhook
retry logic.

Kubernetes-commit: 53a1307f68ccf6c9ffd252eeea2b333e818c1103
2020-10-30 11:25:32 -04:00
Abu Kashem 130dbfbda2 Enable filter latency tracking for request filters
Enable filter latency tracking for the following request filters:
- apf (priority and fairness)
- authentication
- authorization
- impersonation
- audit

Kubernetes-commit: 62431047b46c5949eaf592825712098d7280c4c0
2020-10-13 18:22:49 -04:00
卢振兴10069964 3e37d6db5c add audit-log-compress to apiserver
Kubernetes-commit: 9470f64a4f8af6439cb6c5c35335121446faade3
2020-08-18 11:26:07 +08:00
Jefftree ce4c2eff1a Reuse SSA type converter for resources in the same API Group
Kubernetes-commit: 7182d84b109bb1c928bd5bf92d8c175432b9eeae
2020-10-20 11:16:51 -07:00
Lukasz Szaszkiewicz 972d12cb5f DelegatingAuthorizationOptions: exposes and sets a default timeout for SubjectAccessReview client
previously no timeout was set. Requests without explicit timeout might potentially hang forever and lead to starvation of the application.

Kubernetes-commit: 2160cbc53fdd27a3cbc1b361e523abda4c39ac42
2020-10-20 14:39:45 +02:00
Andrew Sy Kim 48a554c31a apiserver: update TestReadEgressSelectorConfiguration to use 'controlplane' egress selector name
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>

Kubernetes-commit: 5a0932586484b8d5e261cfcbd587fb3ce0c72b27
2020-10-26 10:24:16 -04:00
Andrew Sy Kim d544684a3d apiserver: add validation for EgressSelection names in EgressSelectorConfiguration API
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>

Kubernetes-commit: 30d43806c3fe283c8a0b02f050a7ad93dcb1a759
2020-10-26 10:24:16 -04:00
Andrew Sy Kim 6746ccadda apiserver: support egress selection name 'controlplane' and deprecate 'master'
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>

Kubernetes-commit: a0aebf96ec2eef6517e2611335f0e6c9375dd807
2020-10-26 10:24:16 -04:00
Dr. Stefan Schimanski 4cf3f7725b apiserver: fix healthz vs. livez vs. readyz log output
Kubernetes-commit: 480b4c74b858a9caac0b33cb4d9a1ab30ae65cf4
2020-09-15 15:46:02 +02:00
Zhou Peng b07fe5362d [k8s.io/apiserver/pkg/server/filters]: fixup go vet warning
Signed-off-by: Zhou Peng <p@ctriple.cn>

Kubernetes-commit: 842cd8e315566388025f509edf563b20022922f6
2020-07-20 17:06:01 +08:00
Abu Kashem 50cce843c9 Take into account latency incurred in server filters
apiserver_request_duration_seconds does not take into account the
time a request spends in the server filters. If a filter takes longer
then the latency incurred will not be reflected in the apiserver
latency metrics.

For example, the amount of time a request spends in priority and
fairness machineries or in shuffle queues will not be accounted for.

- Add a server filter that attaches request received timestamp to the
request context very early in in the handler chain (as soon as
net/http hands over control to us).
- Use the above received timestamp in the apiserver latency metrics
apiserver_request_duration_seconds.
- Use the above received timestamp in the audit layer to set
RequestReceivedTimestamp.

Kubernetes-commit: d74ab9e1a4929be208d4529fd12b76d3fcd5d546
2020-09-18 16:46:07 -04:00
chenjun.cj cdf4e75f4f skip TestClientReceivedGOAWAY
Kubernetes-commit: 3a4ae287d43046516e1686cb950907e981b96cae
2020-09-09 00:26:24 +08:00
Jordan Liggitt b7440ce51e Deflake serving options, avoid hard-coding ports
Kubernetes-commit: ec3faa18213fd1386c3fddca40061d6b4a7df22d
2020-09-04 15:55:01 -04:00
Jordan Liggitt 338bb3eda2 Skip TestGOAWAYConcurrency
Kubernetes-commit: dbdd8c5a0c2b345a6b9f2c47055701390d42c3c8
2020-09-04 12:07:02 -04:00
knight42 9acb27b704 test(apiserver): deflake TestClientReceivedGOAWAY
protect `localAddr` from concurrent read and write

Signed-off-by: knight42 <anonymousknight96@gmail.com>

Kubernetes-commit: 1f235c858c39f77161d5b5e8272a7113bfca3143
2020-09-04 23:35:53 +08:00
chenjun.cj 599aa4d0a8 add more testcases for GOAWAY filter
Kubernetes-commit: 434fd2a976b8ecf8a85c9b00ef7c6ccf8f6f5ca3
2020-09-01 16:44:48 +08:00
Manjunath Kumatagi 9e91e826fe Skip TestLoopbackHostPortIPv6 run on non-IPv6 env
Kubernetes-commit: a9c0c5a9de80bc2f1c88f049a19fcbcff285c245
2020-08-31 23:20:49 +05:30
Ken Sipe f5622f5df7 fix S1000 simplify ch switch cases
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: ba11567617aa8f00d9be01ce2551c49d153cdadf
2020-06-26 10:53:08 -05:00
Ken Sipe 0c18993949 fix S1008 simplify bool returns
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: b287287a3093e895a77ccf78053adffcaa7a67c9
2020-06-26 10:39:16 -05:00
Ken Sipe ce7f425acc fix S1002 omit comp to bool
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: e8878687b18fd961e9f3e29c1c46fe018157a77d
2020-06-26 10:36:38 -05:00
panpan0000 8cd4b9b8ca Fix static check failures for staging/src/k8s.io/apiserver/pkg/server/healthz/healthz_test.go
Kubernetes-commit: 16c42fffb0458184d0f576459f1e05be2275db0b
2020-06-23 06:41:42 -04:00
Mike Spreitzer b1ede52e21 Make sampleAndWaterMarkHistograms not fall very far behind
Kubernetes-commit: 9e89b92a92c02cdd2c70c0f52a30936e9c3309c7
2020-08-20 16:43:11 -04:00
bjrara 23237f73b9 Add missing termination metrics to priority-and-fairness handler
Kubernetes-commit: 7094964fe00e0b221e7db29f5980da8bc9166b30
2020-08-07 16:22:30 +08:00
wojtekt 54adf136f5 Fix /readyz to contain informer-sync
Kubernetes-commit: 5b4ab8f41ba574d5b3a70d7141dc348835c9f5e4
2020-08-04 08:51:40 +02:00
ialidzhikov f1d71be938 Fix panic on /readyz
Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>

Kubernetes-commit: 1f06c88dd38f17b1687d83208572a0093c2b2905
2020-07-31 14:30:28 +03:00
Stephen Augustus 0866d387da [VDF] Remove references to gcr.io/google-containers
Signed-off-by: Stephen Augustus <saugustus@vmware.com>

Kubernetes-commit: 99dd7570eb59a4ff040a7656c9d2b879f47acc59
2020-07-22 15:28:13 -04:00
Joe Betz 97937c66f2 Revert nested trace PR#88936
Kubernetes-commit: 02cf58102a61b6d1e021e256381ff750573ce55d
2020-07-20 09:55:05 -07:00
Han Kang 9eea426ca7 port over apiserver metric handler to use the instrumentation library
Change-Id: Ifabb726120c1c4f90ff3e4d71fdbba468fe74e8a

Kubernetes-commit: 6b994af680b292ac5a9be7198df8ca18c27241df
2020-07-16 09:26:47 -07:00
Mike Spreitzer e28ab56bd4 Introduce more metrics on concurrency
Introduce min, average, and standard deviation for the number of
executing mutating and readOnly requests.

Introduce min, max, average, and standard deviation for the number
waiting and number waiting per priority level.

Later:

Revised to use a series of windows

Use three individuals instead of array of powers

Later:

Add coarse queue count metrics, removed windowed avg and stddev

Add metrics for number of queued mutating and readOnly requests,
to complement metrics for number executing.

Later:

Removed windowed average and standard deviation because consumers can
derive such from integrals of consumer's chosen window.

Also replaced "requestKind" Prometheus label with "request_kind".

Later:

Revised to focus on sampling

Make the clock intrinsic to a TimedObserver

... so that the clock can be read while holding the observer's lock;
otherwise, forward progress is not guaranteed (and violations were
observed in testing).

Bug fixes and histogram buckets revision

SetX1 to 1 when queue length limit is zero, beause dividing by zero is nasty.

Remove obsolete argument in gen_test.go.

Add a bucket boundary at 0 for sample-and-water-mark histograms, to
distinguish zeroes from non-zeros.

This includes adding Integrator test.

Simplified test code.

More pervasively used "ctlr" instead of "ctl" as abbreviation for
"controller".

Kubernetes-commit: 57ecea22296797a93b0157169db0ff2e477f58d0
2020-05-17 01:02:25 -04:00
Joe Betz 7a467399ac Enable nested tracing, add request filter chain tracing incl. authn/authz tracing
Kubernetes-commit: b12ac0abc64adb71d97fbde12f373b1424631f20
2020-03-06 16:11:21 -08:00
Li Bo 7f8013437d log tls handshake error at trace level to avoid error flooding, and add
metric to count such errors

Kubernetes-commit: eabb362aa37f7acc85bc64f2035dadc5511d3716
2020-05-20 11:29:44 +08:00
chenjun.cj 0cdc30602c make Kubelet bootstrap certificate signal aware
Kubernetes-commit: db7194177538d5efc84af621c4400174a2836b3b
2020-07-04 12:08:04 +08:00
Maciej Borsz ea82586fc5 Wait for all informers to sync in /readyz.
Kubernetes-commit: 3f680002038c81b02541e4cc4bd7c019b7e7d6e6
2020-06-18 15:21:12 +02:00
David Eads 75c70e8856 make log output of failed healthchecks more focused
Kubernetes-commit: e87f62dcd57fb455135e8cd6fb7e604afbc2e1c4
2020-06-16 15:35:26 -04:00
Marek Siarkowicz 5587d5c607 Improve performance of http access logs
Fixes:
* Don't call LogArgs if log will not be written due low verbosity
* Create separate slice for hijacked to avoid append on main path
* Shorten log message as this log is to common to be verbose

name           old time/op    new time/op    delta
WithLogging-4    4.95µs ± 3%    3.52µs ± 1%  -28.80%  (p=0.000 n=10+8)

name           old alloc/op   new alloc/op   delta
WithLogging-4    2.93kB ± 0%    1.22kB ± 0%  -58.45%  (p=0.000 n=10+9)

name           old allocs/op  new allocs/op  delta
WithLogging-4      32.0 ± 0%      20.0 ± 0%  -37.50%  (p=0.000 n=10+10)

Kubernetes-commit: 303e1c19225149868d735b5c876d8ca9d3e1b5c9
2020-06-23 13:56:01 +02:00
AkashSarda e0d29c69be Migrate API server logs to Structured logging framewrok
Kubernetes-commit: af60e7b34d59d635740880a03e7e2587ec9ba041
2020-06-17 21:06:35 +00:00
yue9944882 7f1f8c2578 introduce apf debug endpoint
Kubernetes-commit: 567becd5eedd9a1f3802f2b3b0b6b8efc445d2a1
2020-05-22 13:02:10 +08:00
Dr. Stefan Schimanski 4b2cf85d1b apiserver: fix secure serving cast for non-tcp listeners
Kubernetes-commit: 2c3687c255c014f7049eed159de30a82082656b6
2020-06-16 13:31:32 +02:00