Commit Graph

100 Commits

Author SHA1 Message Date
Antoine Pelisse 85d860d23f managedfields: Move most of fieldmanager package to managefields
Kubernetes-commit: 4f3859ce911bd308dbf6f617a8c9e2bdf3a1883b
2022-12-22 14:34:58 -08:00
Kevin Delgado c40024ba00 drop Enabled() checks for ServerSideFieldValidation feature gate
Kubernetes-commit: 2d5ceb9b15347b8bb5af360470b6346370157042
2023-01-24 17:48:31 +00:00
Alexander Zielenski 0a2a637e85 negotiated refactor
Co-authored-by: Jeffrey Ying <jeffrey.ying86@live.com>

Kubernetes-commit: 76f056867a2be388f7780c1ff5c794edcdfd9aa4
2022-11-08 12:12:34 -08:00
Han Kang ce7b4d6e8c Add request body size metric
Change-Id: Ica5d9b5457d4f844c4500b2c05b2f0631c27454c

Kubernetes-commit: 43c95cbf0682895cf5bb79452b1f011123ac4513
2022-08-24 09:15:23 -07:00
Tim Allclair 1e36b0a9fb Don't add audit annotations directly to the audit event
Kubernetes-commit: bdebc62d49293a0fbbd7e0d95bfd94b1ce21015c
2022-03-28 11:38:38 -07:00
Wojciech Tyczyński 35d7dfb633 Prepare apiserver for operating on cached objects by not modifying them
Kubernetes-commit: 7e434682e450e28d36f0ee4787e7b4672e8eb255
2022-02-21 15:05:35 +01:00
Wojciech Tyczyński 2d144f4c39 Ensure non-nil items in lists
Kubernetes-commit: 8c1e8355f8efb322ad6e53229f0cbb14999a8fc2
2022-01-14 10:14:17 +01:00
Wojciech Tyczyński 38d7003d33 Remove selflink setting from apiserver
Kubernetes-commit: 0a674d3ed92ce6384e2e8018ca63cf2925474146
2022-01-13 15:29:21 +01:00
Kevin Delgado 59227ac996 Server Side Field Validation
Implements server side field validation behind the
`ServerSideFieldValidation` feature gate. With the
feature enabled, any create/update/patch request
with the `fieldValidation` query param set to
"Strict" will error if the object in the request
body have unknown fields. A value of "Warn"
(also the default when the feautre is enabled)
will succeed the request with a warning.

When the feature is disabled (or the query param
has a value of "Ignore"), the request will succeed
as it previously had with no indications of any
unknown or duplicate fields.

Kubernetes-commit: e50e2bbc889eb274ad1463a54188a2805767bfde
2021-08-18 02:25:36 +00:00
Abu Kashem d53acfe201 apiserver: store (event, evaluated policy) pair in request context
Kubernetes-commit: 8be823b0b0270e1b979b3d4c6e683e1daa0f2e01
2021-09-20 17:43:16 -04:00
Jordan Liggitt b97dfc761c allow evictions subresource to accept policy/v1 and policy/v1beta1
Kubernetes-commit: 33ad842480353f2816873bf728d75333948e4817
2021-03-31 16:54:55 -04:00
Abu Kashem 28c097bee7 move FinishRequest to its own package
Kubernetes-commit: 393a1f73fbaa1bf1facb8882eaf4fead16b94f58
2021-03-22 16:39:14 -04: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
lala123912 5d990a9e20 staging\src\k8s.io\apiserver\pkg\endpoints:migrate to structured logs
Kubernetes-commit: 12076ff3e587be00f1ef52e546fa3a3a85d41e7b
2021-01-15 15:23:55 +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
Haowei Cai 00bc4d7843 apiserver dedups owner references and adds warning
for CREATE and UPDATE requests, we check duplication before managedFields
update, and after mutating admission; for PATCH requests, we check
duplication after mutating admission

Kubernetes-commit: ffc54ed1d2cbf4396fcc498beeb6ad34ac3df69c
2020-11-18 12:35:45 -08: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
wojtekt 14d59e2950 Stop setting SelfLink in kube-apiserver.
Kubernetes-commit: 2539912a2245a53f6612100a32af96dd71a2ad4f
2019-07-26 15:48:37 +02:00
Joe Betz 97937c66f2 Revert nested trace PR#88936
Kubernetes-commit: 02cf58102a61b6d1e021e256381ff750573ce55d
2020-07-20 09:55:05 -07: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
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
jennybuckley a87d964ed1 Don't save managedFields if object is too large
Kubernetes-commit: ccd9e4e2de32b8708f3a7be159f7a4316449c433
2020-01-22 15:38:27 -08:00
David Eads bde5fd1449 choose a more unique request timeout default
Kubernetes-commit: e1dd9af8948f983d48dfc0dd81dc31b7d6c1672f
2019-05-30 15:17:40 -04:00
jennybuckley 49914e3423 Refactor fieldmanager to be more modular
Kubernetes-commit: d72260b9dad186d96aa621dc8594ca9bd6088937
2019-09-19 13:14:36 -07:00
jennybuckley 6c75819b84 Split fieldmanager with interface
Kubernetes-commit: 2c67bf47db8557b6481a5181bdae924e91665988
2019-09-12 10:57:21 -07:00
Jordan Liggitt 223a2b92f0 Propagate and honor http.ErrAbortHandler
Kubernetes-commit: 43415294a72d13a6d685ec0e2ecb274fada7587c
2019-09-11 11:16:31 -04:00
Jordan Liggitt 0c706a033c Plumb context to admission Admit/Validate
Kubernetes-commit: 61774cd7176cae0c0324d23ab20e6c6b3038153f
2019-08-19 10:48:08 -04:00
wojtekt e603adaf68 Deprecate SelfLink + featuregate for setting it
Kubernetes-commit: 3bf4eb70723340cf84abec11e9ce14dfcc02a148
2019-08-05 08:59:25 +02:00
Clayton Coleman dc06278276 CRDs should support watch of protobuf PartialObjectMetadata
Correctly ensure CRDs can be watched using protobuf when transformed to
PartialObjectMetadata. To do this we add a set of serializers allowed to
be used for "normal" requests (that return CRDs) while the serializers
supported by the infrastructure is broader and includes protobuf. During
negotatiation we check for transformation requests and protobuf is
excluded from non-transform requests.

As part of the change, correct an error message when the server returns
a 406 but the client doesn't accept the format to avoid confusing users
who set impossible Accept rules for CRDs (the dynamic client doesn't
support Protobuf, so if the server responds with a protobuf status the
message from the server is lost and the generic error was confusing).

Kubernetes-commit: 89e752add07f443248f66e4798d160f2d7529a19
2019-04-16 23:21:44 -04:00
Jordan Liggitt 6562ecd83a Add GetResourceMapper to admission ObjectInterfaces
Kubernetes-commit: 92f735042e1cae38afe74364c036489fb7a81973
2019-05-13 11:24:20 -04:00
Joe Betz 19327df6d5 Pass {Operation}Option to Webhooks
Kubernetes-commit: 140c8c73a64deb102b528109138ca9fb7dbb2392
2019-05-07 13:34:18 -07:00
Clayton Coleman 1394d8d85c API server should offer metav1 Table/Partial transforms
Now that internal types are equivalent, allow the apiserver to serve
metav1 and metav1beta1 depending on the client. Test that in the
apiserver integration test and ensure we get the appropriate responses.

Register the metav1 type in the appropriate external locations.

Kubernetes-commit: 33a3e325f754d179b25558dee116fca1c67d353a
2019-05-04 16:55:49 -04:00
zuoxiu.jm 7195bbdf3c properly transform decoder error into status error
Kubernetes-commit: 1e65162d44f83d74e9802caf34848abed3eb403c
2018-11-28 16:11:11 +08:00
Haowei Cai 4ff581692b remove TrimSuffix and document buffer size
Kubernetes-commit: 0e61b77826f23cbf835002a9eef5722bb1cfdf53
2019-04-01 11:02:39 -07:00
Clayton Coleman c8f7d5017d Make RequestScope be a pointer consistently for better memory use
RequestScope is a large struct and causes stack growth when we pass
it by value into multiple stack levels. Avoid the allocations for
this read only struct by passing a pointer.

Kubernetes-commit: 8fede0b18a81a6fb1acc1a48857f482857c25286
2019-03-25 23:33:48 -04:00
Clayton Coleman 9006e59e3b IsListType uses reflection and is expensive for hot paths
IsListType was causing ~100 allocations for a non list object. It is
used in a wide range of code, so perform a more targeted check.

The use of `%#v` in a hot return path for `fmt.Errorf()` was the main
victim.

Replace `%#v` with a typed error and create a cache of types that are
lists with a bounded size (probably not necessary, but safer).

```
BenchmarkGet-12          	  100000	    119635 ns/op	   20110 B/op	     206 allocs/op
BenchmarkWatchHTTP-12    	  100000	     65761 ns/op	    7296 B/op	     139 allocs/op

BenchmarkGet-12          	  100000	    109085 ns/op	   17831 B/op	     152 allocs/op
BenchmarkWatchHTTP-12    	  200000	     33966 ns/op	    1913 B/op	      30 allocs/op
```

Kubernetes-commit: 58fb665646aa4c1b63f1322a50e3af7a60e39886
2019-03-21 20:43:26 -04:00
Clayton Coleman 8d7b330c4c Support Table and PartialObjectMetadata on watch
Clean up the code paths that lead to objects being transformed and output with negotiation.
Remove some duplicate code that was not consistent. Now, watch will respond correctly to
Table and PartialObjectMetadata requests. Add unit and integration tests.

When transforming responses to Tables, only the first watch event for a given type will
include the columns. Columns will not change unless the watch is restarted.

Add a volume attachment printer and tighten up table validation error cases.

Disable protobuf from table conversion because Tables don't have protobuf because they
use `interface{}`

Kubernetes-commit: 3230a0b4fd14a6166f8362d4732e199e8779c426
2018-11-28 23:50:12 -05:00
Mehdy Bohlool 87b5ac0c06 Add ObjectInterfaces to Admission and Validation
Kubernetes-commit: 513a87c7b25aa58f84fafe0dc170cee4c76e481b
2019-02-16 12:27:24 -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
Andrew Kim 2b43930b32 replace k8s.io/apiserver/pkg/util/trace with k8s.io/utils/trace
Kubernetes-commit: 93b086f6eafc1e94214fc1d946a1917482751cf3
2019-01-24 11:50:30 -05:00
Jordan Liggitt 8a453581d7 Fix nil panic propagation
Kubernetes-commit: b8c64e30d18d3ea41de703d369e2a97063bce08f
2019-01-12 11:11:47 -05:00
Clayton Coleman a229479a54 Better organize object conversion in response handling
Prepare to support watch by cleaning up the conversion method and
splitting out each transition into a smaller method.

Kubernetes-commit: 63c49ba55a8da571522a9615dfa64471c5e9041e
2018-11-28 22:01:47 -05:00
Clayton Coleman 065e089126 Ensure all response object modification happens in one place
Make setLink and setListLink the same, and make them happen in transformResponseObject.
Make those methods also responsible for ensuring an empty list. Then move outputMediaType
negotiation before all other calls in the specific methods, to ensure we fail fast.

Refactoring in preparation to support type conversion on watch.

Kubernetes-commit: 56a25d8c5f04ec5401b99c8eb29e980b1e8123d3
2018-11-28 21:32:51 -05:00
Dr. Stefan Schimanski b4ca200ede apiserver: add component label to request metrics
Kubernetes-commit: 7190b17e5a52a7c0673c2e8a30cbe95f2847a6df
2018-11-29 16:30:15 +01:00
Jordan Liggitt 67a9161222 apiserver: propagate panics from REST handlers correctly
Kubernetes-commit: 0952c9ee9692dea46b7e1456f984bafa5cdb56ed
2018-11-15 10:07:49 -05: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
Walter Fender 4749d14e11 Added tracing for long running requests.
Added tracing for use cases where etcd is not the cause of long running
requests.
Fixed spelling.
Factored in Wojtek-t feedback.

Kubernetes-commit: 99ebe8747176a10c718d5e3276c64d8c507bfb3b
2018-10-12 17:36:36 -07:00
Jordan Liggitt dba666528b Allow specifying the hub group-version for a handler
Kubernetes-commit: 0e9b06df0f21b421ff69fd455d4542883d61e8c3
2018-10-22 10:14:52 -04:00