Commit Graph

105 Commits

Author SHA1 Message Date
Jefftree e4486afb41 Separate OpenAPI V2 and V3 Config
Kubernetes-commit: 67d3dbfaae87a5bf3325fadda7266ed223766a53
2022-03-28 13:18:56 -07:00
Abu Kashem af86802d1a apiserver: stop http server after pre shutdown hooks
Kubernetes-commit: 8d96cc2dfbd650544660e41c5e8efc8d1e1033a3
2022-02-09 16:40:57 -05:00
David Eads 7fd5822a08 migrate more rest handlers to select by resource enablement
Kubernetes-commit: 0ec20f97d27e08be8d8bbbbff52e68a4409ab43c
2022-02-21 16:10:25 -05:00
Wojciech Tyczyński 5e8e1ff118 Relax to using namer instead of selflinker in API groupversion
Kubernetes-commit: 0ad588b27b6845d9ece955bfdde0e2863b8e1394
2022-01-13 16:34:56 +01:00
Arda Güçlü 1fbc8d31a2 Rename ServeWithListenerStopped to Serve in secure_serving
This PR removes Serve function and uses all required places
ServeWithListenerStopped which takes place new Serve function.

This function returns ListenerStopped channel can be used to drain
requests before shutting down the server.

Kubernetes-commit: a8d2b3a7926394b1c53621804cdeb93e4a61b7c8
2021-11-08 17:20:31 +03:00
Jefftree 649cd36479 Add OpenAPI v3 publishing under feature gate OpenAPIV3
Kubernetes-commit: 5bf3ed7a98e1e5247fe3fc2f6f948e6ed9a23521
2021-10-26 11:11:59 -07:00
Lukasz Szaszkiewicz 67be998d0f rename to muxAndDiscoveryComplete
Kubernetes-commit: 9e2bdfee02a6851fbb13ffe28611e9d2b6242785
2021-10-19 12:24:00 +02:00
Lukasz Szaszkiewicz 5c13ee7dbf genericapiserver: indroduce muxCompleteSignals for holding signals that indicate all known HTTP paths have been registered
the new field exists primarily to avoid returning a 404 response when a resource actually exists but we haven't installed the path to a handler.
it is exposed for easier composition of the individual servers.
the primary users of this field are the WithMuxCompleteProtection filter and the NotFoundHandler.

Kubernetes-commit: ddfbb5d2bb57ee44b3e10f0b58f9cc7001f55802
2021-10-15 18:14:20 +02:00
Lukasz Szaszkiewicz b96eea9892 allow for passing a custom handler to the empty delegate
Kubernetes-commit: 207478c1e6f94b26d8033d5edc7a8a91c69ef716
2021-09-02 14:22:23 +02:00
wojtekt b898581360 Migrate to k8s.io/utils/clock in apiserver
Kubernetes-commit: 859a98c0358610e2c127cd2fba1be601ca975188
2021-09-14 20:36:07 +02:00
Abu Kashem ffb869e08f apiserver: add a new mode for graceful termination
add a new mode for graceful termination with the new server run option
'shutdown-send-retry-after'
- shutdown-send-retry-after=true: we initiate shutdown of the
  HTTP Server when all in-flight request(s) have been drained. during
  this window all incoming requests are rejected with status code
  429 and the following response headers:
    - 'Retry-After: N' - client should retry after N seconds
    - 'Connection: close' - tear down the TCP connection
- shutdown-send-retry-after=false: we initiate shutdown of the
  HTTP Server as soon as shutdown-delay-duration has elapsed. This
  is in keeping with the current behavior.

Kubernetes-commit: 3182b69e970bd1fd036ff839fdf811f14e790244
2021-07-14 10:39:29 -04: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
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
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 f410577081 apiserver: close handler chain right after shutdown delay duration
Kubernetes-commit: de7e56bf37440ca6a4c634ede8abaf1315fe9de3
2021-06-07 18:13:24 -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
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
Kevin Delgado a11399dd98 Add ability to skip OpenAPI handler installation
Kubernetes-commit: 66d2f4359efadd2cf85f9d901676f2ea28555951
2021-03-17 00:26:23 +00:00
David Eads 3f9e652c39 provide directly decodable versions for storageversion API
Kubernetes-commit: fa03dee68cea605b285b00ae5b6ce22659d95026
2021-03-08 09:33:46 -05: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
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
Haowei Cai 8e0bbdb835 add kube-apiserver-lease-controller poststart hook
Kubernetes-commit: 3761a00e5b4bd1fab01f0b6682830aa1ef86a131
2020-10-26 13:17:00 -07:00
David Eads beb1fce6bb remove dead apiserver field
Kubernetes-commit: 4dcf3807ac534377439b948d9772101ef8ac0259
2020-11-04 14:35:13 -05: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 2785853faa genericapiserver library must wait for server.Shutdown
Kubernetes-commit: 4362d613f243a02558f03e90b8fcb58b4c6efb06
2020-06-10 14:05:24 +02:00
Davanum Srinivas 5879417a28 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
Abu Kashem 6d7d21c695 /readyz should start returning failure on shutdown initiation
Currently, /readyz starts reporting failure after ShutdownDelayDuration
elapses. We expect /readyz to start returning failure as soon as
shutdown is initiated. This gives the load balancer a window defined by
ShutdownDelayDuration to detect that /readyz is red and stop sending
traffic to this server.

Kubernetes-commit: 4134494fa51402ec5e5ea3fa1c51c0be55c955fd
2020-03-06 10:55:45 -05:00
jennybuckley b1cbdafe99 Use CRD validation field in server-side apply
Kubernetes-commit: c0617933d4bec5b00dbbfcd24edb7d7e7fc5509d
2019-08-28 15:28:49 -07:00
Han Kang 050d1b223c add /livez as a liveness endpoint for kube-apiserver
go fmt

make func private

refactor config_test

Two primary refactorings:

1. config test checkPath method is now each a distinct test
run (which makes it easier to see what is actually failing)

2. TestNewWithDelegate's root path check now parses the json output and
does a comparison against a list of expected paths (no more whitespace
and ordering issues when updating this test, yay).

go fmt

modify and simplify existing integration test for readyz/livez

simplify integration test

set default rbac policy rules for livez

rename a few functions and the entrypoint command line argument (and etcetera)

simplify interface for installing readyz and livez and make auto-register completion a bootstrapped check

untangle some of the nested functions, restructure the code

Kubernetes-commit: aa1b2d6d35c92a31be17357fc66cfc1eca8a67e0
2019-08-26 16:57:25 -07:00
Han Kang 2b0c93afef rename healthz methodNames to be more consistent w/ present day usages
Kubernetes-commit: 2e23788fda86c68e7f17cf0b66ee1017594c1055
2019-08-13 12:42:13 -07:00
Dr. Stefan Schimanski 5f126c4400 apiserver: add --shutdown-delay-duration to keep serving until LBs stop serving traffic
Kubernetes-commit: 408f36b8825136c2b1771f642d88557e83a2ddb7
2019-02-22 15:13:28 +01:00
Clayton Coleman 72566fea6c Replace HTTP compression with an inline handler
The previous HTTP compression implementation functioned as a filter, which
required it to deal with a number of special cases that complicated the
implementation.

Instead, when we write an API object to a response, handle only that one
case. This will allow a more limited implementation that does not impact
other code flows.

Also, to prevent excessive CPU use on small objects, compression is
disabled on responses smaller than 128Kb in size.

Kubernetes-commit: 4ed2b9875d0498b5c577095075bda341e96fcec2
2019-05-04 17:36:36 -04:00
Dr. Stefan Schimanski 747ac192e8 apiserver: chain delegated PrepareRun
Kubernetes-commit: 7c4329ed45e3609b1e66b4026c453e71e78db26b
2019-03-04 12:04:43 +01:00
Ted Yu e3747a151a Close auditStopCh if SecureServing encounters error
Kubernetes-commit: 9e018468153255ae5972b681f998e96c3f1a6cbe
2019-06-19 12:01:57 -07:00
Han Kang 7fd71e31ef add readyz endpoint for kube-apiserver readiness checks
add startup sequence duration and readyz endpoint

add rbac bootstrapping policy for readyz

add integration test around grace period and readyz

rename startup sequence duration flag

copy health checks to fields

rename health-check installed boolean, refactor clock injection logic

cleanup clock injection code

remove todo about poststarthook url registration from healthz

Kubernetes-commit: 54dcf5c9c46fc4782d4861936309349b5a71a1ac
2019-05-30 11:19:49 -07:00
Jordan Liggitt 6562ecd83a Add GetResourceMapper to admission ObjectInterfaces
Kubernetes-commit: 92f735042e1cae38afe74364c036489fb7a81973
2019-05-13 11:24:20 -04:00
Han Kang 18a2d0a0ba log preshutdowndown registration error if we encounter one
Kubernetes-commit: 021f6082944496765383c7572157e9be86ed4177
2019-03-26 13:04:10 -07:00
Haowei Cai 103a5b29b5 expose openapi service from genericapiserver
Kubernetes-commit: efae739d02bec5bd74bfda75f3c125dab1376196
2019-02-14 14:33:20 -08:00
Chao Xu 4ebbf20f41 Adding a limit on the maximum bytes accepted to be decoded in a resource
write request.

Kubernetes-commit: b971b12d3cfa8887aa87957fbba92b90e3e99dc6
2019-02-06 16:58:24 -08:00
Antoine Pelisse 337fc9ccde API Machinery, Kubectl and tests
Kubernetes-commit: 0e1d50e70fdc9ed838d75a7a1abbe5fa607d22a1
2019-01-16 21:14:42 -08:00
Dr. Stefan Schimanski db5a1882b5 apiserver: sync with https server shutdown to flush existing connections
Kubernetes-commit: 5b47f99164d76b6b043d7de2d3834abeda6685b0
2019-01-16 15:58:53 +01:00
Jordan Liggitt 2109711572 Remove build/verify scripts for swagger 1.2 API docs, API server swagger ui / swagger 1.2 config
Kubernetes-commit: 9229399bd6049bc7766829b436d5cb5fe0dfe2f1
2019-01-15 10:44:36 -05:00
Jordan Liggitt a7180e74a2 Revert "Merge pull request #67205 from roycaihw/crd-openapi-spec"
This reverts commit 54ee58b2d613c636f972312ca80357563292b57d, reversing
changes made to 9e2820e4c9541a7718e9d5b7a0ee62429552023a.

Kubernetes-commit: 8799eb4e2e12e5d144871a35c6288b8433a74c9b
2018-11-16 16:36:24 -05:00
Haowei Cai 3c9d1f5b21 Apiextensions-apiserver aggregates CRD schemas
efficiently without checking conflicts, and wire up CRD discovery
controller to serve OpenAPI spec.

Kubernetes-commit: 3222a7033cf9128b76c0677887f4e383821d0475
2018-11-15 11:02:11 -08:00
jennybuckley 7cc3f112fb Build OpenAPI Definitions per group instead of per resource
Kubernetes-commit: 758e8623e9b08065f053bedf4474626696b6346c
2018-11-14 12:50:02 -08:00
Davanum Srinivas 2710b17b80 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
jennybuckley 900791d3ac Add additional authorization check for create-on-update
Kubernetes-commit: cc5c17e554a4d8f802043b337ca0787ec0ce7475
2018-07-03 11:20:16 -07:00
David Eads a8cd668cfc legacy api endpoints only support v1 ever
Kubernetes-commit: b063e9f85ee28233241ae4f9071a62ac6c9b499c
2018-06-22 08:58:32 -04:00