Commit Graph

50 Commits

Author SHA1 Message Date
Jordan Liggitt 0c706a033c Plumb context to admission Admit/Validate
Kubernetes-commit: 61774cd7176cae0c0324d23ab20e6c6b3038153f
2019-08-19 10:48:08 -04:00
Jordan Liggitt aab7154c4f plumb client-specified request timeout to context
Kubernetes-commit: 89d5c1f3ea8d8e27526e4f558872c4e24ddc526c
2019-08-20 10:36:34 -04:00
wojtekt e603adaf68 Deprecate SelfLink + featuregate for setting it
Kubernetes-commit: 3bf4eb70723340cf84abec11e9ce14dfcc02a148
2019-08-05 08:59:25 +02:00
Joe Betz f103fcda51 Replace string concatination with trace fields
Kubernetes-commit: 46a04d50af78e01d06a9879d62cc71fbe892076f
2019-08-02 23:47:24 -07:00
Antoine Pelisse b19b440e6b Return 400 on invalid patch requests
Kubernetes-commit: 7e964387485f12432bbf616835e034436f52cb4c
2019-06-20 12:17:56 -07:00
Joe Betz 19327df6d5 Pass {Operation}Option to Webhooks
Kubernetes-commit: 140c8c73a64deb102b528109138ca9fb7dbb2392
2019-05-07 13:34:18 -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
Antoine Pelisse 46d98f52ff Add "fieldManager" to flag to PATCH/CREATE/UPDATE
And add a corresponding flag in kubectl (for apply), even though the
value is defaulted in kubectl with "kubectl".

The flag is required for Apply patch-type, and optional for other PATCH,
CREATE and UPDATE (in which case we fallback on the user-agent).

Kubernetes-commit: eb904d8fa89da491f400614f99458ed3f0d529fb
2019-02-16 20:16:11 -08:00
Mehdy Bohlool 87b5ac0c06 Add ObjectInterfaces to Admission and Validation
Kubernetes-commit: 513a87c7b25aa58f84fafe0dc170cee4c76e481b
2019-02-16 12:27:24 -08:00
Chao Xu 3866fe78d2 Limit the number of operations in a single json patch to be 10,000
Kubernetes-commit: 5e6fc5dce8b12c5ce80e016b208a51c81a8c9ce8
2019-02-12 23:37:01 -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 91c401c45f Add object information on FieldManager failures
Kubernetes-commit: 79f3135d2ea2884d2d8115dcdd93a0b454c87b6f
2019-01-29 16:19:52 -08:00
Antoine Pelisse d1a2d7fd8d Plugin FieldManager in CRD handler, change to API
Kubernetes-commit: b55417f429353e1109df8b3bfa2afc8dbd9f240b
2019-01-29 14:24:52 -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
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
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
Jordan Liggitt b758170bd7 Inline patch#toUnversioned
Kubernetes-commit: 870d121d5e8033a72c62ef3a64939f0eacab6798
2018-10-22 10:01:27 -04:00
Cao Shufeng be442e0127 return 400 status when invalid json patch passed to apiserver
Kubernetes-commit: 1248f569917511c37501b6ef6bbb215ce87353dc
2018-09-11 14:11:39 +08:00
jennybuckley 008018b080 fix typo in dry run disabled error
Kubernetes-commit: 5253c7f414a686e8bcf721655b7ffe26e81765b4
2018-09-12 14:43:18 -07:00
Antoine Pelisse 35d83292e2 dry-run: Allow dry-run flag to pass through if alpha enabled
Kubernetes-commit: 5f364a0b84669a2dc086a35292db088b912d1c3c
2018-06-28 08:59:58 -07:00
jennybuckley 91278157f6 Support dry run in admission plugins
Kubernetes-commit: adafb1365e2b9f6c422c437e916e22a4fe1c2e3a
2018-08-06 10:37:44 -07:00
Antoine Pelisse 026601bbf1 dry-run: Add DryRunTrue value
Kubernetes-commit: e99651b34bf94fdead5a8827abe0fc98159cd16d
2018-07-09 15:52:16 -07:00
yue9944882 3b41cc363d fixes operation for "create on update"
remove create-on-update logic for quota controller

review: add more error check

remove unused args

revert changes in patch.go

use hasUID to judge if it's a create-on-update

Kubernetes-commit: ccb1ec7a3695082326fe60ec06890f91004dc043
2018-06-28 16:35:15 +08:00
xuzhonghu cbadd11a32 remove useless codec param from strategicPatchObject
Kubernetes-commit: 43baa697aac69a0d88edad77f8fe2ef3896c2996
2018-07-17 11:33:53 +08:00
Antoine Pelisse cc843478d7 dry-run: Create new options for Update/Create and pass it along
Kubernetes-commit: 03b1e14101a73706980b559b4b7069ea956c80bd
2018-06-14 09:14:59 -07:00
jennybuckley 621e8af54b Allow override AllowCreateOnUpdate with new argument to Update
Kubernetes-commit: d10e08fc897f6b5e60ce2aa8420bd2ea536e18b8
2018-06-28 14:24:51 -07:00
Cao Shufeng 167894cc94 Log policy name from pod security policy
Kubernetes-commit: 241422879d81ac7f8d7874d55c53df73e35d91b0
2018-04-15 10:20:10 +08:00
Dr. Stefan Schimanski c4d743d011 apiextensions: only create patch reference object for smp path
Kubernetes-commit: 9745d6c11927686d99b80af45e4a631e155ebf80
2018-05-15 19:35:05 +02:00
Antoine Pelisse 7d9df7dc93 apiserver: Fail if dry-run query param is specified
Kubernetes-commit: 98613924ea282ef70a6f9a14dda11e854fe02c28
2018-05-11 14:59:47 -07:00
Jordan Liggitt 91142e772a Collapse onto request scope convertor
Kubernetes-commit: 2c1a689952ec34e3f9ecb7bcd1772c3fa35c9597
2018-04-26 16:21:38 -04:00
Jordan Liggitt aa2276ee48 collapse patch conflict retry onto GuaranteedUpdate
builds on #62868

1. When the incoming patch specified a resourceVersion that failed as a precondition,
the patch handler would retry uselessly 5 times. This PR collapses onto GuaranteedUpdate,
which immediately stops retrying in that case.

2. When the incoming patch did not specify a resourceVersion, and persisting to etcd
contended with other etcd updates, the retry would try to detect patch conflicts with
deltas from the first 'current object' retrieved from etcd and fail with a conflict error
in that case. Given that the user did not provide any information about the starting version
they expected their patch to apply to, this does not make sense, and results in arbitrary
conflict errors, depending on when the patch was submitted relative to other changes made
to the resource. This PR changes the patch application to be performed on the object retrieved
from etcd identically on every attempt.

fixes #58017
SMP is no longer computed for CRD objects

fixes #42644
No special state is retained on the first attempt, so the patch handler correctly handles
the cached storage optimistically trying with a cached object first

Kubernetes-commit: fbd6f3808480d27a83643e82a11c217601b76cbc
2018-04-24 21:55:06 -04:00
Daniel Smith c8a994aada Refactor the patch handler for readability
This is the combination of a series of changes which individually don't
make any behavioral changes. The original commits are preserved in my
own fork in the refactor-patch-complete branch, as when squashed this is
impossible to review.

This turned a big function with lots of parameters and closures into an
object with multiple functions, fewer closures and more well documented
state transitions.

Kubernetes-commit: 349a99b80e7e6c0c92218c814ae0858fd71609fc
2018-04-18 16:59:17 -07:00
Mike Danese cd0258b4d7 replace request.Context with context.Context
Kubernetes-commit: 54fd2aaefd11e12a3ecb6d1a1326f04cdc8ea1a3
2018-04-24 08:10:34 -07:00
Jordan Liggitt 25758bf0f8 Remove request context mapper
Kubernetes-commit: 8ea88a5092c767fc3141512db924fd0435f7670e
2018-04-18 11:12:15 -04:00
Mengqi Yu c621a422af fix patch conflict detection in apiserver
Kubernetes-commit: ff18af452dafef7fc115512940e0c6250ccf31ca
2018-03-29 16:43:23 -07:00
Cao Shufeng 4741d69bc6 trace patch operations
Just like `update`, `create`, `get` and `delete` operations.

Kubernetes-commit: 534eb3dfbd734dd44357e97dcb10fdf3b1ce5880
2018-01-05 11:09:51 +08:00
Jordan Liggitt e5c1570dd1 Return correct error when submitting patch in unsupported format
Kubernetes-commit: aa504ccd57f38bfc23248c68019b7685fb14e668
2018-01-15 20:42:47 -05:00
Clayton Coleman ce019febe3 Move unstructured conversion into pkg/runtime
Scheme conversion should support unstructured conversion natively to
allow going from unstructured to typed and back. It is not a higher
level responsibility to do that conversion because the scheme is the
only one who knows what types it supports.

Kubernetes-commit: 557f9ddfe6300ecdbdd70ea67dca63bf6b710ea7
2017-11-13 21:28:57 -05:00
Dr. Stefan Schimanski 441ac63056 admission: complete plumbing of validation admission
Kubernetes-commit: 74b4223ab80fa3bbf326ac1073ef28f0b8daa304
2017-10-24 14:08:34 +02:00
Nikhita Raghunath eb855aac8e Fix error for strategic merge patch of custom resources
We need the go struct tags `patchMergeKey` and `patchStrategy`
for fields that support a strategic merge patch. For native
resources, we can easily figure out these tags since we know
the fields.

Because custom resources are decoded as Unstructured and
because we're missing the metadata about how to handle
each field in a strategic merge patch, we can't find the
go struct tags. Hence, we can't easily  do a strategic merge
for custom resources.

So we should fail fast and return an error.

Kubernetes-commit: 79349c93bddcc1125a9d6ea4528c6d63b172f083
2017-10-07 17:29:19 +05:30
Nikhita Raghunath 6f448f398c apiserver: return 4xx for invalid patch
Add interpretPatchError to return appropriate http code
(400 or 422) according to the error type.

We add this function in apiserver because we don't want
to mention the http code in apimachinery. The apimachinery
code is also used in kubectl. The client should not return
a server error.

Add a test to validate the http error code and error message.

Kubernetes-commit: e0a2168ecbf8b4e43f932a32fa55cd55215123cc
2017-10-24 17:26:03 +05:30
David Eads a0a5b2c568 split up large rest handling file
Kubernetes-commit: cd663d7ad00937cffa8a09e4761acb95d34c89a3
2017-10-18 16:04:33 -04:00
Mikhail Mazurskiy 7039fe1e17 Refactor unstructured converter
Kubernetes-commit: dc1ee493a29251492403e4282b5df3e897de2214
2017-06-30 08:44:46 +00:00
Jordan Liggitt fa876f6773 Fix original object mutation on patch retry
Kubernetes-commit: c415e4aeabe5e5514dcdbf2c01c533533c25f4c1
2017-04-06 20:35:16 +00:00
Jordan Liggitt 8543f589d2 Ensure patched objects are defaulted correctly
Kubernetes-commit: 464db160b410b22dba53af6d11fa097f0fa4fd6b
2017-03-18 19:56:09 +00:00
ymqytw 7306f452f2 switch to k8s json to avoid number conversion issue
Kubernetes-commit: b29f4c26d799dca6606b45a0e03f7f931abcdefc
2017-03-18 19:56:09 +00:00
Wojciech Tyczynski 63e29dca6f Use new runtime.Object <-> map[string]interface{} converter 2017-02-27 15:10:34 -05:00
Dr. Stefan Schimanski f3c3e07241 Mechanical move: pkg/genericapiserver -> k8s.io/apiserver 2017-02-13 07:36:41 -05:00