Commit Graph

543 Commits

Author SHA1 Message Date
Kevin Wiesmueller 81cd3ef7b0 fix admission controller
Kubernetes-commit: 429a96da5e856c435b08b50791d462120724c475
2021-02-11 16:11:43 +01:00
Kevin Wiesmueller 7da058f6bb disable webhook for testing
Kubernetes-commit: ffbae9c5b4a3df9f7400d0047a5d7a957adf295d
2021-02-01 17:56:49 +01:00
Kevin Wiesmueller 08a5711ffb update bazel
Kubernetes-commit: a06f981fb1388976cd6427d7a4284d36dd2f2448
2021-01-14 20:33:50 +01:00
Kevin Wiesmueller a29734176f use managedFields admission controller in create/patch/update
Kubernetes-commit: 3d306e222de3b13a55030a53fef93622bb300646
2021-01-14 20:15:11 +01:00
Kevin Wiesmueller 4a5fdad93b implement managedFields admission controller
Kubernetes-commit: d5ae113e8dfba62709b1fccb8dbc26c6dde9b3e5
2021-01-14 20:14:38 +01:00
chymy f5152b019f Fix static failures for vendor/k8s.io/apiserver/pkg/endpoints/handlers
Kubernetes-commit: 04515b9c0a8634ddbb48883cdceb1c265ae97015
2021-02-26 21:01:55 -05:00
Alan Zhu 3292215ff4 at most every may result in less than expected times if overloaded
Signed-off-by: Alan Zhu <zg.zhu@daocloud.io>

Kubernetes-commit: 67234271ef50da475b4627b484b3b45ee54e8f8d
2021-02-25 16:27:42 +08:00
Maciej Borsz b4f179e734 Use more real world examples in BenchmarkSerializeObject
Kubernetes-commit: f01f2b122923798d60893c6c189a204b94fe5723
2021-02-18 10:56:51 +01:00
Tim Bannister b29ffb4398 Update generated code
Kubernetes-commit: 284e03e1abde67cae5520a9b61497a71cca78e90
2021-02-15 22:50:30 +00:00
Maciej Borsz f407d7228e Add BenchmarkSerializeObject* benchmarks
Kubernetes-commit: 2228d7ce2650ba4cc5811a761d9f54e09ea6d99e
2021-02-17 15:03:53 +01:00
yoyinzyc 74c8267082 add context to metrics in apiserver/endpoint
Kubernetes-commit: 266d67bd5124725befe775d580289b67a59f496c
2021-01-20 13:13:00 -08: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
David Eads 67507290ad finish removal of exportoptions
Kubernetes-commit: 37cc89ed8d5194f288bc9f9633e6142647631a07
2021-01-22 09:21:56 -05:00
Maciej Borsz 78e27f49d3 Add trace to SerializeObject
Kubernetes-commit: e93836d9b35f5ec231da91807f00dab3d1a28fd9
2021-01-12 09:45:43 +01: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
Dr. Stefan Schimanski a2b6f03b6e apiserver: print unknown responsewriter error strings, not only %#+v
Kubernetes-commit: b0ecbbc3cbd9bd811d5498a1dd95d516bcd82434
2020-11-26 13:39:56 +01:00
Rajalakshmi-Girish c41f156212 fixes the unit tests to be more tolerant with error messages
Kubernetes-commit: 98948ad8092b41ebc08d50aa557b2d7ba5496e7d
2020-11-27 08:21:56 +00:00
Jie Shen 7dd2afd324 Revert "Cleanup: remove sanity check for CVE-2019-11253"
Kubernetes-commit: e3df70364594cdb7d0b321a405f1c0718c2c9b54
2020-12-11 09:38:21 +08:00
drfish 95a1d549eb Cleanup sanity check for CVE-2019-11253
Kubernetes-commit: 4ac5844ec076e9bcc31fd0a79ca17eaf4fb1bdb3
2020-12-08 23:19:21 +08:00
Ken Sipe 92af261bb8 fix SA2006 value of err not used
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: a549d0a75e3a09d26f3a316982ff3711be4ed1d2
2020-06-25 17:23:37 -05:00
Ken Sipe 8877e7bd70 fix S1039 unnecessary use of fmt.Sprintf
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: 168677400c964fe823b985db35b5e1473db17b0f
2020-06-25 17:04:41 -05:00
lala123912 36a172d35e Code optimization for add additional information to log trace in api server
Kubernetes-commit: 5d61e18a4343773105e39c36b944b4f223e70eaf
2020-11-23 16:27:05 +08:00
Tim Hockin c2f3123308 Make tests deal with old and new topology labels
Kubernetes-commit: 3bd337baf487a0ad9d748e7e0362b3d1b5eb5c4d
2020-11-06 08:47:32 -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 77d77260fb unit and integration tests
apiserver dedups and adds warning in CREATE/UPDATE/PATCH requests;
also handles duplication caused by mutating admission.

Kubernetes-commit: 8bcf34a203efa596ac3b65da9afd6b6c764e78a9
2020-11-18 12:46:20 -08: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
Jefftree c13cd1f0d3 Make versionconverter functions private
Kubernetes-commit: 1f986cc69d8ac5b579ccc2e6817fd0a07903692b
2020-10-22 13:21:38 -07: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
Andrea Nodari b4becfdb04 Add yaml util to unmarshal numbers into int/float
Kubernetes-commit: 04d972cb4bab108b12f181f86b7c0f0854a1037a
2020-10-23 17:26:10 +02:00
Joe Betz 2c72507385 Tag LabelSelector with +structType=atomic
Kubernetes-commit: 8874bdf00402b55cf5ede88a5ba4dfc94e9f4399
2020-08-11 11:34:15 -07:00
Antoine Pelisse d0b4a78e16 Do not update managedFields timestamp when they don't change
Kubernetes-commit: fedc0b7093e396aaf1fca7fd6f145a0f3cfd5c47
2020-10-01 10:53:16 -07:00
Andrea Nodari 618f4b129a Make the creation of namespace using POST and PATCH consistent
PATCH verb is used when creating a namespace using server-side apply,
while POST verb is used when creating a namespace using client-side
apply.

The difference in path between the two ways to create a namespace led to
an inconsistency when calling webhooks. When server-side apply is used,
the request sent to webhooks has the field "namespace" populated with
the name of namespace being created. On the other hand, when using
client-side apply the "namespace" field is omitted.

This commit aims to make the behaviour consistent and populates the
"namespace" field when creating a namespace using POST verb (i.e.
client-side apply).

Kubernetes-commit: 3cb510e33eecbdc37aad14f121396ccfbf5268cb
2020-09-21 12:13:12 +02:00
Andrea Nodari 99200040ed Do not allow manual changes to manageFields via subresources
If a request tries to change managedFields, the response returns the
managedField of the live object.

Kubernetes-commit: c522ee08a3d248ec1097e3673119ffa7a4e1ef7b
2020-07-14 17:42:54 +02:00
Lukasz Szaszkiewicz ac3c7faf5d deferredResponseWriter returns after calling the Close() method
previously all sorts of errors including a data race were possible because deferredResponseWriter resets the writer and returns it to the pool.

an attempt to write to a nil writer will lead to "invalid memory address or nil pointer dereference"
sharing the same instance of deferredResponseWriter might lead to "index out of range [43] with length 30" and "recovered from err index > windowEnd" errors

Kubernetes-commit: e6f98311d00f083c1b980ed7434d2e9769fa921f
2020-09-07 12:42:36 +02:00
wojtekt 14d59e2950 Stop setting SelfLink in kube-apiserver.
Kubernetes-commit: 2539912a2245a53f6612100a32af96dd71a2ad4f
2019-07-26 15:48:37 +02:00
Julian V. Modesto dea021183c Add tests for managed fields tracking.
- Test that client-side apply users don't encounter a conflict with
server-side apply for objects that previously didn't track managedFields
- Test that we stop tracking managed fields with `managedFields: []`
- Test that we stop tracking managed fields when the feature is disabled

Kubernetes-commit: f2deb2417a6c542c54606ab17376b26ef1552b87
2020-07-16 17:14:35 -04: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
Antoine Pelisse c4c20f4f7d Update SMD to v4.0.1 and kube-openapi
Kubernetes-commit: f4c145511a0bb62ea7ee1f2154945c84c17ffcd5
2020-08-10 13:02:25 -07:00
Joe Betz 97937c66f2 Revert nested trace PR#88936
Kubernetes-commit: 02cf58102a61b6d1e021e256381ff750573ce55d
2020-07-20 09:55:05 -07:00
Julian V. Modesto fac7ebd95f Implement server-side apply upgrade & downgrade.
- Allow client-side to server-side apply upgrade.

  Ensure that a user can change management of an object from client-side apply to
  server-side apply without conflicts.

- Allow server-side apply to client-side downgrade.

  For an object managed with client-side apply, a user may upgrade to
  managing the object with server-side apply, then decide to downgrade.

  We can support this downgrade by keeping the last-applied-configuration
  annotation for client-side apply updated with server-side apply.

Kubernetes-commit: e4368eb67e363d3d03f81214a8929268d2fe88ff
2019-10-02 11:13:40 -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
Joe Betz 5bb316ec73 Bump to sigs.k8s.io/structured-merge-diff 43c19b to pick up unsetting fields changes PR#166
Kubernetes-commit: 11c38a9c703b825c61d6490e8da85202b760f3b1
2020-06-26 20:05:34 -07:00
Joe Betz ee219411ed Add ResourceVersionMatch parameter to make Resource Version semantics consistent for list
Kubernetes-commit: e214f2408b59c745c199645547948a8ad2a87ac2
2020-05-29 10:44:26 -07:00
AkashSarda e0d29c69be Migrate API server logs to Structured logging framewrok
Kubernetes-commit: af60e7b34d59d635740880a03e7e2587ec9ba041
2020-06-17 21:06:35 +00:00
Antoine Pelisse 025116d4fa Fix fieldType being dropped by older go-clients
Kubernetes-commit: 3f10709e4ce7e14fa9efc019ade3e99bb0a84b8a
2020-04-30 13:38:23 -07:00
Antoine Pelisse 3b7411b225 FieldManager: Reset if we receive nil or a list with one empty item
Kubernetes-commit: ed2cf6ef2cc4f4d358eee038d2d87387614bbf45
2020-05-21 13:23:30 -07:00
Antoine Pelisse cc0f41ad59 fieldManager: Ignore and log all errors when updating managedFields
Kubernetes-commit: 5378a788e471a18594c446888306d826d3b44661
2020-05-08 12:48:09 -07:00
Wei Huang a67f43f565 Remove `EvenPodsSpread` featuregate and related logic
Kubernetes-commit: 133dde63589bfb9f149607d1e8f6ae519d41719f
2020-05-27 14:24:26 -07:00
Tariq Ibrahim d8082ddfe6 s/RelicaSets/ReplicaSets
Kubernetes-commit: 9760dec9dc84d68c6613887128de192b4a66feff
2020-04-29 12:59:05 -07: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
Antoine Pelisse 05f95a480d managedfields: Update Apply time if neither object nor managedfields have changed
Kubernetes-commit: 5231c6815c7b06248575892f3ec96c15c634d368
2020-03-05 13:13:27 -08:00
Antoine Pelisse c81c86d33f Bump sigs.k8s.io/structured-merge-diff to v3
Kubernetes-commit: df41fd932bef1686b30a1abee477c5009ebabe80
2020-03-05 13:09:50 -08:00
Antoine Pelisse 2ff45c3592 fieldmanager: Add failing test for no-op apply actually writing to etcd
Kubernetes-commit: 7120abe6989afff0d4ad879a4590a960f4ab19f0
2020-03-05 10:09:08 -08:00
Antoine Pelisse 5de3b6339e fieldmanager: Move ManagedFields update logic into its own class
Kubernetes-commit: 39681aa5800492b8e4b4ff5fb82e034376864a37
2020-03-05 10:01:37 -08:00
Antoine Pelisse 82ecbdb375 Don't log "SHOULD NOT HAPPEN" errors more than once per second
Kubernetes-commit: 389dd0a499e4fa79d3d2ef4261aa9f25aa94e6b0
2020-02-26 15:58:57 -08:00
jennybuckley a87d964ed1 Don't save managedFields if object is too large
Kubernetes-commit: ccd9e4e2de32b8708f3a7be159f7a4316449c433
2020-01-22 15:38:27 -08:00
Antoine Pelisse 07f3bde07d Enable field management for all new objects
Kubernetes-commit: a54a52c5de3458bfa5dbe1973d12584f59a5581c
2020-02-10 09:06:18 -08:00
Yu-Ju Hong 809bbdf7f8 Replace Beta OS/arch labels with the GA ones
Beta OS/arch labels have been deprecated since 1.14.
This change replaces these labels with the GA ones.

Kubernetes-commit: bcd975aa6575ae37ec3be3481e44cd0dccd02337
2020-02-12 11:30:39 -08:00
jennybuckley 4e7f113e29 Round times to nearest second before sorting
Kubernetes-commit: 888a322d9ca3070b811b348e05ee4a3ce7da6ae9
2020-02-11 11:54:21 -08:00
Jordan Liggitt 51a2cc34eb Lower server-side apply percentage to 10%
Kubernetes-commit: a657d51ce35eb3886a56ed710805cd68732461ee
2020-02-11 09:15:12 -05:00
Antoine Pelisse 3104ef647b Enable field management for all new objects
Kubernetes-commit: 8438bba5fd911c4674e46519228e6c47b5057346
2020-02-10 09:06:18 -08:00
Joe Betz dced5f29d8 Bump to latest SMD to pick up performance optimizations
Kubernetes-commit: d9faaca64738a50455f38dd88845e8b4b5ca37e2
2020-02-06 15:10:25 -08:00
Antoine Pelisse 977fdf9f57 Add UpdateTwice and UpdateApply benchmarks for fieldmanager
I've also moved the deserialization of the object outside the benchmark
since we're not trying to benchmark the yaml parser.

Kubernetes-commit: a52776fbfb305374d87bb553739f712e055b2206
2020-02-06 09:25:52 -08:00
jennybuckley 216aab95f9 Move mutating admission into finishRequest
Kubernetes-commit: 9bd42287f90feeb0cf1076fcfb180ff6e1d02110
2020-01-29 13:21:58 -08:00
jennybuckley 0fe6670327 Make schema error log message more useful
Kubernetes-commit: fee77388c6d4cc04731f35055d9dfcdf08b0f874
2020-01-29 15:01:44 -08:00
jennybuckley 605316fae2 Re-enable apply for 50% of requests
Kubernetes-commit: 9b679748239faa4d01f13c32af1956ffdbfff9aa
2020-01-23 11:27:20 -08:00
jennybuckley 49d583f0ef Update Structured Merge Diff to V3
Kubernetes-commit: b33fbc84d9d6e7033c36fa3bc321b8fea28ceed6
2020-01-21 15:03:56 -08:00
Jordan Liggitt 223f76bd7a Set managedField probability to 0%
Lowers probability of managedField population on create/update to 0%
until serialization/normalization issues are resolved

Kubernetes-commit: ba23aa98f6574bd1f9781f0d3e61d0496f16fc53
2020-01-14 14:47:35 -05:00
Jennifer Buckley 2ac09e3ec3 Update fieldmanager.go
Kubernetes-commit: 4db3822ebbac30248463eb529d88176f8b258fd9
2020-01-10 11:15:06 -08:00
jennybuckley d516617523 create probabilistic SkipNonAppliedManager
Kubernetes-commit: 6cab3a7bec75e42581e8041395c3ceaa14e07c74
2020-01-09 14:15:34 -08:00
Kevin Wiesmüller 4694e4eb62 fix nits
Kubernetes-commit: a2526286498762de187db23f13da5d747ddd1c90
2020-01-10 00:58:52 +01:00
Kevin Wiesmüller 41bde5b991 change Apply signature and move decoding into handlers
Kubernetes-commit: ddf0d4b8034697a8dca23a3c8bc5620629bd691b
2020-01-09 22:34:33 +01:00
ialidzhikov a521baa66a Minor nit in error message about feature gate stage
Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>

Kubernetes-commit: 1eaa0ee3f9553cce1821434ce64e745ba5b135d2
2020-01-01 15:54:06 +02:00
sshukun 38b2d97314 Fix golint failure not contained in .golint_failures
Kubernetes-commit: 8110e08dd4abd4458b2d3793f5c1eb50069ae7df
2019-12-19 14:40:26 +09:00
Jordan Liggitt e00fbd05dd Use openapi fixture for server-side apply tests
Kubernetes-commit: 2b4fac5760ff390d46c2b9bb373feafe9bd97a38
2019-12-04 10:29:48 -05:00
chenjun.cj d1465bc6c3 fix potential memory leak issue in processing watch request
Kubernetes-commit: b911aa6471a83b1d2b4ea346e5c6b442dfa9b53b
2019-11-18 16:43:15 +08:00
Jordan Liggitt 3aa0552959 Switch TableGenerator/TableConvertor interfaces to metav1
Kubernetes-commit: 36eb250cbb441984260ded6f7abeb796974031c3
2019-11-26 13:13:25 -05:00
chenjun.cj 455e205726 use context to check client closed instead of http.CloseNotifier in processing watch request
Kubernetes-commit: 1daa08c5c8634af762b0352ff4a49bdef6924c5f
2019-11-18 21:27:05 +08:00
Antoine Pelisse bab2370cac Update structured-merge-diff to latest version
Kubernetes-commit: 4f0346530d3e228db20aca6bb484d3ed3c83e33b
2019-11-06 09:53:38 -08:00
attlee-wang 6c2628ccd6 json unmarshal coded error at function applyJSPatch()
Kubernetes-commit: 1da2d00935942a887205f801d4b2acfa227055d2
2019-11-07 20:40:28 +08:00
Ted Yu 48d357e235 Stop Watching when there is encoding error
Kubernetes-commit: 639af77d463a4d07bc5d7d19366bd98310b55724
2019-11-07 14:32:47 -08:00
wojtekt 6fd9ceb0b8 Eliminate some default conversions
Kubernetes-commit: ccded1494116d6aa1ac3f4612b4a613b56a2044a
2019-11-06 14:02:27 +01:00
David Eads bde5fd1449 choose a more unique request timeout default
Kubernetes-commit: e1dd9af8948f983d48dfc0dd81dc31b7d6c1672f
2019-05-30 15:17:40 -04:00
Jianfei Bai a5b9ca7482 feat(apiserver): add user-agent and remote info into trace log for endpoints handlers.
Kubernetes-commit: 91bddd13485082892be8e8e471e358be317c4e9b
2019-10-10 21:30:05 +08:00
Wojciech Tyczynski 5f538bd5e3 Optimize NegotiateMediaTypeOptions
Kubernetes-commit: 1baf4778ae130dc9c305736216b5f5024a962595
2019-10-10 11:49:31 +02:00
jennybuckley 72d976a445 Cap the number of managedFields entries for updates at 10
Kubernetes-commit: 61b19c729892a150b61dde19359f6fb19e8d61f1
2019-09-26 12:53:28 -07:00
jennybuckley 49914e3423 Refactor fieldmanager to be more modular
Kubernetes-commit: d72260b9dad186d96aa621dc8594ca9bd6088937
2019-09-19 13:14:36 -07:00
Jordan Liggitt f7fbf2eee4 Limit YAML/JSON decode size
Kubernetes-commit: 8ef4566cefebf49f9a806a36df2105c9149785a1
2019-09-27 16:36:48 -04:00
wojtekt f186d58ea0 Fix transformObject to work with CacheableObject.
Kubernetes-commit: 1dd43724ce97b610aae7f9e0f3842f0798ec9d7b
2019-08-19 09:55:49 +02:00
wojtekt 4aa6bc019e Implement Encoder.Identifier() method
Kubernetes-commit: cd4215ad8b95773a793f69fc2e8bf93c7ede97aa
2019-08-14 16:23:03 +02:00
Antoine Pelisse 3e0b6a7493 Apply current parses the yaml object 3 times
This is super expensive and not needed at all since we don't have to
reparse the entire object. Remove all allocations but the first one.

Kubernetes-commit: 31c644a1e79c685b52683ed1e84964186a37f3ff
2019-09-25 12:38:38 -07:00
Antoine Pelisse 81b54ad46e Add tests and benchmarks for endpoints and node
Kubernetes-commit: 0b7ea8bb0e9cc10335044f9ef75920d59462a4ca
2019-09-20 13:32:06 -07:00
Antoine Pelisse db9f1ff5ea Improve fieldmanager tests and benchmarks
Kubernetes-commit: fae9d0ee2136d3443cdd87b1a26a06d7857b01ee
2019-09-10 14:06:08 -07:00
Jordan Liggitt d1d66bda16 Propagate context to Authorize() calls
Kubernetes-commit: 92eb072989eba22236d034b56cc2bf159dfb4915
2019-09-24 10:06:32 -04:00
jennybuckley 6c75819b84 Split fieldmanager with interface
Kubernetes-commit: 2c67bf47db8557b6481a5181bdae924e91665988
2019-09-12 10:57:21 -07:00
wojtekt ba8f49cc73 Ensure conversions are registered for metainternalversion codecs
Kubernetes-commit: 54163527a69a8c868b87d301876559495220d1b0
2019-09-11 16:30:08 +02:00
Jordan Liggitt 223a2b92f0 Propagate and honor http.ErrAbortHandler
Kubernetes-commit: 43415294a72d13a6d685ec0e2ecb274fada7587c
2019-09-11 11:16:31 -04:00
Antoine Pelisse 912f3b47b9 Refactor FieldManager tests to make them simpler
This is the first step on this, but there are a few improvements that
I'd like to do here.

Kubernetes-commit: b10ad55119a155b776b272a7139dfbed604b05d6
2019-09-10 15:05:26 -07:00
Ted Yu a50931ba7e Move Update Apply conflict test to field manager test
Kubernetes-commit: 9828f986afd4db79a10c78bee1cc2e449faee3a6
2019-08-30 14:47:39 -07:00
Kubernetes Prow Robot c229c2ca0a Merge pull request #81453 from joshmsamuels/master
Apply will fail with managed fields + tests

Kubernetes-commit: 64718f678695884c93d6d3df8f5799614746bea2
2019-09-13 08:22:53 +00:00
jennybuckley b1cbdafe99 Use CRD validation field in server-side apply
Kubernetes-commit: c0617933d4bec5b00dbbfcd24edb7d7e7fc5509d
2019-08-28 15:28:49 -07:00
Antoine Pelisse 625e8a84fc Add new FieldsType to clarify the format of Fields
Kubernetes-commit: ff4e1f3592bfd51aea3018ed7e0a8579e5c0eea1
2019-08-21 16:13:53 -07:00
jennybuckley 263df041f9 Add tests
Kubernetes-commit: 3279c73945553e211ddb7812e07b3c9d46b5e96a
2019-08-22 13:27:38 -07:00
jennybuckley 350fef76f5 Only update managedFields on update if it already exists
Kubernetes-commit: 9a12e37a6dc28fd1d209eb84c210eb0723e6e38f
2019-06-05 14:09:08 -07:00
jennybuckley dcedf932c2 Make sure no op updates don't affect the resource version
Kubernetes-commit: aa1f01ec7e6ebf29444b93de7c3cb65a1a54d47e
2019-08-20 15:09:42 -07:00
Di Xu d9e587908f populate object name for admission attributes when CREATE
Kubernetes-commit: 34cab8f80a9104be7fe5d8a5a22c3207dab46268
2017-09-28 14:59:34 +08:00
Maciej Borsz 9baeaec78d Add 'apiserver_watch_events_sizes'.
That metric can be used to estimate the size of watch events sent out to
the clients.

Kubernetes-commit: 4af189aab9cca61d1a701133596f6f82b1ca0719
2019-07-23 12:55:11 +02:00
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
jennybuckley 427507ed32 Group update managedFieldsEntries by manager name
Kubernetes-commit: 87eabcdbfa5d551af7ebcae3fb07fd8f386badc3
2019-08-19 13:50:15 -07: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
jennybuckley d98d4e6ca0 Use raw bytes in metav1.Fields instead of map
Also define custom proto unmarshaller that understands the old format

Kubernetes-commit: addad99b6f796bc0f0a2eeafa0296396667800e9
2019-07-31 16:05:48 -07:00
Daniel Smith 1fc8fb4c4b fix breaking change
Kubernetes-commit: f55efb8dae5b41a8af083dc96c53b5b6f6e59b49
2019-07-19 15:25:56 -07:00
jennybuckley 6d17cee146 Make changes to integrate new version
Kubernetes-commit: 229894c730c70d39992b27fe3ef98968b2a3fbff
2019-07-08 16:32:03 -07:00
jennybuckley 5751866f63 apiserver: make changes to integrate new structured-merge-patch
Kubernetes-commit: bd333e3ac7f84c33abebc7d55a8c581743d891f7
2019-07-08 16:32:03 -07:00
Antoine Pelisse b19b440e6b Return 400 on invalid patch requests
Kubernetes-commit: 7e964387485f12432bbf616835e034436f52cb4c
2019-06-20 12:17:56 -07:00
Antoine Pelisse 2f450e5e39 Add benchmarks for FieldManager handling
We don't have a lot of data on allocations and how much time it takes to
run apply or update on objects, so adding some benchmark will help us
investigate possible improvements.

Kubernetes-commit: 92cf3764f979e63317c8f483d8e841e0358599f4
2019-07-09 14:00:21 -07: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 c4286f7b60 apiserver: store httplog in context
Kubernetes-commit: e848eaa566b750ad5e5fd26a64eecfc883f936f3
2019-06-14 13:09:13 +02:00
Maciej Borsz df684d906a Add 'apiserver_watch_events_total' metric.
We found this metric useful to understand the CPU usage of the
kube-apiserver process.

Kubernetes-commit: 58d3338ddd5e406988fdfaa9019fd7200996c49f
2019-06-05 14:27:09 +02:00
Odin Ugedal 1be6195f27 Fix file permissions for non executable files
Normal files should have permissions 644 by default,
and does not require the last bit to be
executable

Signed-off-by: Odin Ugedal <odin@ugedal.com>

Kubernetes-commit: 35cb87f9cf71776e99a970dfff751cd29ba7ebfb
2019-06-14 21:04:39 +02:00
jennybuckley e67aadb10a Don't dereference nil pointer in conflicts
Kubernetes-commit: c71583a31368d1e4e71cd458d6961d8fec2265f1
2019-06-13 14:42:19 -07:00
zhoulin xie 77ddb0c208 remove redundant words 'the' in comment
Signed-off-by: zhoulin xie <zhoulin.xie@daocloud.io>

Kubernetes-commit: 77ba845e6d2f0cba81993621531ae5915e7c072b
2019-02-13 22:40:34 +08: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
Jordan Liggitt 054e44a286 make ObjectInterfaces impl generic
Kubernetes-commit: 9071d21e3b1989ffeee4f533406e4fef6bf32aa8
2019-05-13 11:22:11 -04:00
Chao Xu 5c9333e4d3 Run deleteValidation at the storage layer so that it will be retried on
conflict.

Adding unit test verify that deleteValidation is retried.

adding e2e test verifying the webhook can intercept configmap and custom
resource deletion, and the existing object is sent via the
admissionreview.OldObject.

update the admission integration test to verify that the existing object
is passed to the deletion admission webhook as oldObject, in case of an
immediate deletion and in case of an update-on-delete.

Kubernetes-commit: 7bb4a3bace048cb9cd93d0221a7bf7c4accbf6be
2019-04-09 13:49:16 -07:00
yue9944882 019679ce23 Cherrypicking #66535
validate deletion admission object

backward compatibility: add validation for direct storage delete calls

apply nil validation to existing tests

revert behavior changes in deleteCollection call

fixes validation on wiring graceful deletion

remove nil validation check

continue admission check on not found error

Kubernetes-commit: 34c4a6e05767e6c6211b88ccc653f2b07021906a
2018-07-24 12:24:59 +08:00
Antoine Pelisse 2d27d30e4d fieldManager: Ignore conversion errors to internal types
Errors on updates are bad because they usually come from controllers and
it's very hard to take actions on them. We also don't want to start
breaking kubernetes clusters if something in a schema happens a way we
didn't foresee (even though we've tried to be diligent and test as much
as possible, these can still happen).

Log an identifiable error when they happen. Ideally people can look in
the logs to find these and report them, or providers can look for these
in logs and make sure they don't happen.

Only conversion to internal types are going to be logged and ignored.

It means that we're still failing for:
- Version conversions. If we can't convert the object from one version
  to another,
- Unions. If we can't normalize the union,
- Invalid MangedFields sent in the object. If something has changed the
  ManagedFields to an invalid value.
- Failure to serialize the manager information, this really shouldn't
  happen.
- Encoding the ManagedFields

Kubernetes-commit: 4e32d183d0257c9f6c7f8342d1f9aa7f28458f2f
2019-05-16 11:07:47 -07:00
Joe Betz 19327df6d5 Pass {Operation}Option to Webhooks
Kubernetes-commit: 140c8c73a64deb102b528109138ca9fb7dbb2392
2019-05-07 13:34:18 -07:00
Clayton Coleman 196c34b775 PartialObjectMetadataList should nest values, not pointers for Items
Typo during setting up PartialObjectMetadataList, it should be a slice
of `PartialObjectMetadata`, not a slice of `*PartialObjectMetadata`.

Kubernetes-commit: f25efd12e63f1d7db5f29fe28831ad0126200c0b
2019-05-13 14:13:00 -04: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
jennybuckley e999a5ebe2 Treat NoCorrespondingTypeError as MissingVersionError
Kubernetes-commit: 13cb241b1833495c8f195dac96dacf54c0ba4a3a
2019-05-06 15:13:36 -07: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
leigh capili 7762f62741 Refactor loops over SupportedMediaTypes() where mediaType is used to match a single SerializerInfo{}
We have an existing helper function for this:  runtime.SerializerInfoForMediaType()

This is common prep-work for encoding runtime.Objects into JSON/YAML for transmission over the wire or writing to ComponentConfigs.

Kubernetes-commit: 47e52d2981dc2a5c5950042f50688cf24dd92eda
2019-04-04 19:01:01 -06:00
Clayton Coleman e4e8608ba0 Use CodecFactory.WithoutConversion() everywhere
Clarifies that requesting no conversion is part of the codec factory, and
future refactors will make the codec factory less opionated about conversion.

Kubernetes-commit: 7f9dfe58f4cbe1e1b9e80f52addff70bac87bed4
2019-04-03 13:24:37 -04:00
fansong.cfs 73057f16b6 add timeout suuport for watch
Kubernetes-commit: b304a1f96d85cd351a0e22a091e17064d5edb35e
2019-04-03 09:37:48 +08:00
Benjamin Elder 8ad12b3912 Revert "add timeout suuport for watch"
This reverts commit c676e234cc1036a2a1147f2eeef9c89468671330.

Kubernetes-commit: 30a56bab42ab14a3a2ee21f5581b02525d4fd110
2019-04-01 18:39:17 -07:00
Clayton Coleman f2b20f65e2 Set list meta on PartialObjectMetadataList during transform
Kubernetes-commit: 6801ce990a48196d871f6b46e1a08938025ce7c5
2019-03-24 21:29:20 -04:00
fansong.cfs 4d2b8eee69 add timeout suuport for watch
Kubernetes-commit: c676e234cc1036a2a1147f2eeef9c89468671330
2019-03-30 20:07:41 +08: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 8e43494f09 Avoid allocating the watch shim object more than once
We can reset and reuse this object repeatedly without triggering an
allocation.

Kubernetes-commit: 316a87ce7dff525555483eaac962899fd365177d
2019-03-26 23:34:25 -04:00
Clayton Coleman 8541248953 Avoid allocations when building SelfLinks and fast path escape
A self link should only require one allocation, and we should skip
url.PathEscape() except when the path actually needs it.

Add a fuzz test to build random strings and verify them against
the optimized implementation. Add a new BenchmarkWatchHTTP_UTF8 that
covers when we have unicode names in the self link.

```
> before
BenchmarkGet-12          	   10000	    118863 ns/op	   17482 B/op	     130 allocs/op
BenchmarkWatchHTTP-12    	   30000	     38346 ns/op	    1893 B/op	      29 allocs/op

> after
BenchmarkGet-12               	   10000	    116218 ns/op	   17456 B/op	     130 allocs/op
BenchmarkWatchHTTP-12         	   50000	     35988 ns/op	    1571 B/op	      26 allocs/op
BenchmarkWatchHTTP_UTF8-12    	   50000	     41467 ns/op	    1928 B/op	      28 allocs/op
```

Saves 3 allocations in the fast path and 1 in the slow path (the
slow path has to build the buffer and then call url.EscapedPath
which always allocates).

Kubernetes-commit: 389a8436b52db4936b56e08f07984da362c91f6b
2019-03-25 18:06:57 -04:00
Clayton Coleman 78a40897c5 Unify runtime.SerializerInfo with negotiate.AcceptedMediaTypes
There was no reason to have two types and this avoids ~10% of allocations
on the GET code path.

```
BenchmarkGet-12          	  100000	    109045 ns/op	   17608 B/op	     146 allocs/op

BenchmarkGet-12          	  100000	    108850 ns/op	   15942 B/op	     132 allocs/op
```

Kubernetes-commit: 0489d0b1cf139253b82f73b072578073bc5616d6
2019-03-21 21:00:55 -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
jennybuckley aabe804197 Fix int/float apply bug
Kubernetes-commit: 10259c959e9f20668659f7e20251a217b51c6355
2019-03-11 23:07:21 -07:00
Aaron Prindle a595f8c602 Added version check between patch and live object in server side apply
What is the problem being solved?
https://github.com/kubernetes/kubernetes/pull/75135
Currently version compatibility is not being checked in server side apply between the patch object and the live object.  This is causing a merge that will error to be run and the apiserver returns a 500 error.  The request should fail if the apiVersion provided in the object is different from the apiVersion in the url, but it should fail before trying to merge, and be a 4xx error. Probably a bad request error.

Why is this the best approach?
The approach of serializing the patch byte array and then checking for version equality with the already serialized live object is the simplest and most straightforward solution.

Kubernetes-commit: d5bd17cda0c134e5ef5c03c3eac79a9ce4e18003
2019-03-07 16:52:26 -08:00
jennybuckley 2deaad0322 Fix version converter
Kubernetes-commit: f9e57744d3e760b1473cb22e655d20c254af03b6
2019-03-07 17:44:21 -08: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
Kevin Wiesmüller a2d254807d fix handling of nil times in managedFields sorting
Kubernetes-commit: 186761efee887cee019bc92a85b3207474b42185
2019-03-07 00:02:52 +00:00
jennybuckley 55fa47be3a add IsMissingVersionError
Kubernetes-commit: db0562bdbd4ffe17459025fdc10c7bf318dfbc01
2019-03-04 17:29:11 -08:00
jennybuckley 0b311f9745 Update conversion code
Kubernetes-commit: bad7599f06cde17e9b4a51087cd0a84836b29c11
2019-03-04 16:30:37 -08:00
Kevin Wiesmüller e08e8cdb33 change managedFields sort order to oldest first
Kubernetes-commit: 4394bf779800710e67beae9bddde4bb5425ce039
2019-03-05 07:45:08 +01:00
Kevin Wiesmüller 64d9391709 cleanup sort implementation
Kubernetes-commit: 081ccdc75e4646a6b619f16852adb9ce2b4c43d4
2019-03-02 12:07:19 +01:00
Kevin Wiesmüller 8f6431c490 implement sorting of managedFields
Kubernetes-commit: 9ac127408d48aa0876330c79c933d4f1cd603761
2019-03-01 12:51:01 +01:00
Kevin Wiesmüller 61f4009197 start implementing managedFields sorting
Kubernetes-commit: 822c0da84474c50ac640629e7cb9cad01904c2f0
2019-02-28 14:24:02 +01:00
Kevin Wiesmüller 485fbb474e test that managedFields get stripped recursively
Kubernetes-commit: 8a6a2883f9a38e09ae941b62c14f4e68037b2d21
2019-02-26 20:22:54 +01:00
Kevin Wiesmüller 14b16dd3e2 remove deletionTimestamp from strippedFields
Kubernetes-commit: d73dbfc8c1bdc443cf6bf2f70a7789b689815cf7
2019-02-26 20:22:30 +01:00
Kevin Wiesmüller 752a6fcdc7 add tests for new stripped fields and cleanup test
Kubernetes-commit: 89f4f9d4bfe5dd14a11e94ff13b1efa676a2d59f
2019-02-23 12:54:33 +01:00
Kevin Wiesmüller a0ddba7a54 add more fields to be stripped from managedFields
Kubernetes-commit: 78ba7fa05c4360e217af3854c5ae5ba4e823312f
2019-02-17 22:35:15 +01:00
Davanum Srinivas d0a81fb0fb Avoid using ghodss/yaml - switch to our forked repo
Change-Id: I115bc834b2b8473c3a81812a76b8433fda24a908

Kubernetes-commit: 42aba643290c19a63168513bd758822e8014a0fd
2019-02-21 18:48:28 -05:00
Kevin Wiesmüller 00e253c3da hardcode time
Kubernetes-commit: 332bb15476ed6f7ef0b55a5a3a3a735b915ccee3
2019-02-19 20:17:33 +01:00
Kevin Wiesmüller 0faeae1509 rename mocks to fakes and add nil check
Kubernetes-commit: 96d4fa7e4678430046d8fee98bc715f385242e3f
2019-02-19 19:13:49 +01:00
Kevin Wiesmüller 84fe2e0447 add fieldmanager tests for stripFields
Kubernetes-commit: 2f8e8fa3af4b8adce5562dd1a033fd37ea8244d8
2019-02-18 11:44:07 +01:00
Kenichi Omichi 538ceee47b Fix golint failures on handlers/negotiation
DefaultEndpointRestrictions is only used in the module,
so this renames it to defaultEndpointRestrictions.

Kubernetes-commit: 302ec9859113f322a32ed03673865b32ca5a130a
2019-01-18 22:06:48 +00:00
Mehdy Bohlool 87b5ac0c06 Add ObjectInterfaces to Admission and Validation
Kubernetes-commit: 513a87c7b25aa58f84fafe0dc170cee4c76e481b
2019-02-16 12:27:24 -08:00
jennybuckley ddd6f48420 Make apply conflict errors more readable
Kubernetes-commit: 69b9167dcbc8eea2ca5653fa42584539920a1fd4
2019-02-12 15:16:19 -08:00
Antoine Pelisse 3afb63e414 Revert "Temporary fix for alpha features test"
Kubernetes-commit: 845e44dd207fc3793f8bab1b69665a816f966489
2019-02-12 12:25:21 -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
Antoine Pelisse e23fc114aa Add server-side apply members on some apiserver OWNERS
Kubernetes-commit: 83f0653a14ab304ca3c049587e40bb33e9c55353
2019-02-08 16:10:25 -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
Kevin Wiesmüller fa595d7437 strip selected fields from managedFields
refactor fieldstrip and update tests

add checks and remove empty fields

shorten test and check for nil manager

fix gofmt

panic on nil manager

Kubernetes-commit: 9082cac48240ebc316015dabb466e5b24a113dc1
2019-02-03 22:22:10 +01:00
Ted Yu ea3640581f gofmt
Kubernetes-commit: 4f50eb49eae1e6561263ff4abc00ea956139a2ef
2019-02-05 13:58:42 -08:00
Ted Yu ac1ef9aea6 change case for error
Kubernetes-commit: 1638e6698403341122cd55df61e6fe12559b0604
2019-02-05 11:34:36 -08:00
Ted Yu cdd65830fd Misc fix for feature-serverside-apply
Kubernetes-commit: f2e59b44ad5610bb749901b505305ba16c44fad5
2019-02-05 10:29:38 -08:00
Jennifer Buckley 9955ab5084 Temporary fix for alpha suite
Kubernetes-commit: 3f947e034fe6436a2075e8eb202aeaaae46e9df5
2019-02-05 13:23:24 -08:00
Antoine Pelisse 3c768f935f Avoid closure
Kubernetes-commit: bbab0d6c5f9fe75388583772ef4f094e863f9627
2019-01-30 14:15:25 -08:00
Antoine Pelisse 91c401c45f Add object information on FieldManager failures
Kubernetes-commit: 79f3135d2ea2884d2d8115dcdd93a0b454c87b6f
2019-01-29 16:19:52 -08:00
jennybuckley f279314dc7 Minor fixes
Kubernetes-commit: 6b2e4682fe883eebcaf1c1e43cf2957dde441174
2019-02-01 11:55:18 -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
Jordan Liggitt 80029a760c Deprecate and remove use of alpha metadata.initializers field, remove IncludeUninitialized options
Kubernetes-commit: 17aa60686ebe5fd04b4fe6f442dc36a8d70b6730
2019-01-17 09:19:28 -05:00
Davanum Srinivas a6f07cccd1 Switch location for goautoneg vendored code
Move to github.com/munnerz/goautoneg as bitbucket is flaky!

Change-Id: Iaa6e964ef0d6f308eea59bcc6f365ecd7dbf0784

Kubernetes-commit: 16fd72d6c91ba466a0e955a1d59a6c8d9e8791bc
2018-12-17 20:39:56 -05:00
Jordan Liggitt 8a453581d7 Fix nil panic propagation
Kubernetes-commit: b8c64e30d18d3ea41de703d369e2a97063bce08f
2019-01-12 11:11:47 -05:00
Davanum Srinivas 5bbdd5d7c3 Strengthen ErrorToAPIStatus against bad input
Change-Id: Id44a59f56c074901257760ff4e40ce29820c6c50

Kubernetes-commit: 6858a24835721cae6968ad85cdf4985afaa03923
2019-01-04 11:22:46 -05:00
Jordan Liggitt 5e146b0a14 Flush headers before streaming logs
Kubernetes-commit: 93625f502676f7a89474cdd3d588354a8ffabb78
2019-01-04 10:16:40 -05:00
Yang Li b6d1828116 Fix unreachable code
Kubernetes-commit: 267425667f45f37b0fb70a6e6904efb995cb4924
2018-11-18 04:16:25 +08: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
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
Tim Allclair 2390bdcec0 Cleanup apiserver errors
Kubernetes-commit: 0a68e906ed79669912ad3f4cf22f72b6669d343f
2018-07-03 15:21:42 -07:00
Tristan Burgess 753c6a1ccc 50342: Establish '406 Not Acceptable' response for protobuf serialization 'errNotMarshalable'
- Added metav1.Status() that enforces '406 Not Acceptable' response if
    protobuf serialization is not fully supported for the API resource type.
     - JSON and YAML serialization are supposed to be more completely baked
    in, so serialization involving those, and general errors with seralizing
    protobuf, will return '500 Internal Server Error'.
	- If serialization failure occurs and original HTTP status code is
    error, use the original status code, else use the serialization failure
    status code.
     - Write encoded API responses to intermediate buffer
     - Use apimachinery/runtime::Encode() instead of
    apimachinery/runtime/protocol::Encode() in
    apiserver/endpoints/handlers/responsewriters/writers::SerializeObject()
     - This allows for intended encoder error handling to fully work, facilitated by
    apiserver/endpoints/handlers/responsewriters/status::ErrorToAPIResponse() before officially
    writing to the http.ResponseWriter
     - The specific part that wasn't working by ErrorToAPIResponse() was the
    HTTP status code set. A direct call to
    http.ResponseWriter::WriteHeader(statusCode) was made in
    SerializeObject() with the original response status code, before
    performing the encode. Once this
    method is called, it can not again update the status code at a later
    time, with say, an erro status code due to encode failure.
     - Updated relevant apiserver unit test to reflect the new behavior
    (TestWriteJSONDecodeError())
     - Add build deps from make update for protobuf serializer

50342: Code review suggestion impl
 - Ensure that http.ResponseWriter::Header().Set() is called before http.ResponseWriter::WriteHeader()
    - This will avert a potential issue where changing the response media type to text/plain wouldn't work.
    - We want to respond with plain text if serialization fails of the original response, and serialization also fails for the resultant error response.

50342: wrapper for http.ResponseWriter
  - Prevent potential performance regression caused by modifying encode to use a buffer instead of streaming
    - This is achieved by creating a wrapper type for http.ResponseWriter that will use WriteHeader(statusCode) on the first
    call to Write(). Thus, on encode success, Write() will write the original statusCode. On encode failure, we pass control
    onto responsewriters::errSerializationFatal(), which will process the error to obtain potentially a new status code, depending
    on whether or not the original status code was itself an error.

50342: code review suggestions
  - Remove historical note from unit test comment
  - Don't export httpResponseWriterWithInit type (for now)

Kubernetes-commit: bcdf3bb64333ce12f15b1beebef48f554d69027f
2018-08-06 19:18:36 -04:00
Yu-Ju Hong 6b85aed1d6 apiserver: pass the parent request context when creating InputStream
This ensures that request cancellation will be propagated properly to
the client used to create the stream. Without this fix, the apiserver
and the kubelet may leak resources (e.g., goroutine, inotify watches).
One such example is that if user run `kubectl logs -f <container that
don't produce new logs)` and then enter ctrl-c, both kubelet and
apiserver will hold on to the connection and resources indefinitely.

Kubernetes-commit: 31d1607a514b62ef46452e402f5438d827314b98
2018-08-13 16:34:49 -07:00
Jordan Liggitt 5558d0c5ce Make the request attributes clearer in forbidden messages
Kubernetes-commit: 4e0a3b557e235ad354f6dfb4567d2a20ebde403a
2018-08-09 15:51:52 -04:00
Chao Xu e1ccfa4e7d Remove rest.ConnectRequest.
Make apiserver pass connectRequest.Options directly to the admission layer. All
the information in rest.ConnectRequest is present in admission attributes.

Kubernetes-commit: 355691d310803ea3a0cd8ff284a39ead38857602
2018-07-30 18:35:51 -07:00
jennybuckley 4dcfdb8ab8 Explicitly disable dry run for connect
Kubernetes-commit: 702937ac8614a05d3168c6565bea8a3347883dc0
2018-07-11 11:45:24 -07:00
jennybuckley 91278157f6 Support dry run in admission plugins
Kubernetes-commit: adafb1365e2b9f6c422c437e916e22a4fe1c2e3a
2018-08-06 10:37:44 -07:00
Clayton Coleman b605717f7d Make the timeout error more specific so users can find it
This makes the error consistent with the timeout filter and also helps
the user understand that they requested a specific timeout.

Kubernetes-commit: 8a2d037bc51c97758c0a68f2726f104953846cd5
2018-07-25 12:50:39 -04: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
Clayton Coleman 2b9b0922e8 Make conversion function names match expected values
Kubernetes-commit: ba95744bc56970ccc67e51589122911bfdb5425a
2018-07-03 16:06:44 -04: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
Jordan Liggitt 453662ac63 change field selector conversion registration to be strongly typed
Kubernetes-commit: f51ba20cddeb44be355a79718a8274c272efc1e4
2018-07-03 15:47:20 -04:00
jennybuckley 900791d3ac Add additional authorization check for create-on-update
Kubernetes-commit: cc5c17e554a4d8f802043b337ca0787ec0ce7475
2018-07-03 11:20:16 -07:00
jennybuckley 621e8af54b Allow override AllowCreateOnUpdate with new argument to Update
Kubernetes-commit: d10e08fc897f6b5e60ce2aa8420bd2ea536e18b8
2018-06-28 14:24:51 -07:00
Mikhail Mazurskiy 0f7bbcadfb Add missing error handling in schema-related code
Kubernetes-commit: bfe313d5f351dfae086a85a97e7103183173e5b5
2018-06-03 14:59:58 +10:00
Clayton Coleman 9a797b9333 Print type information when unknown watch error
Got

```
E0628 00:23:07.106285       1 watch.go:274] unable to encode watch object: expected pointer, but got invalid kind
```

on a production system and had no way to debug what type was being sent.

Kubernetes-commit: 307849baef076d8ee61a3b9649f9260a765f7ac0
2018-06-27 20:34:48 -04:00
Jordan Liggitt 1f9c7bdd99 Quiet verbose apiserver logs
Kubernetes-commit: 862f8567bb4b1d4e9f63330cf3a516af61ae7cc5
2018-06-11 22:32:46 -04:00
Cao Shufeng 167894cc94 Log policy name from pod security policy
Kubernetes-commit: 241422879d81ac7f8d7874d55c53df73e35d91b0
2018-04-15 10:20:10 +08:00
Guoliang Wang 704926d8fc HandleError include the type of the error object
Kubernetes-commit: f2cb23ad6a14169f5e2a82c5d3b1bd6ebc1074a5
2018-05-25 13:59:05 +08:00
jennybuckley f87486fed9 Expose openapi schema to handlers
Kubernetes-commit: dee088586a76b876c473418efba8190be7fa6b26
2018-05-24 09:55:19 -07:00
wojtekt 6d795842cd Requires single name for list and watch
Kubernetes-commit: f344c5c0621b3e187ade02a6858bccb2c2d641bd
2018-05-06 15:15:32 +02: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
wojtekt 27dca16e75 Track number of registered watchers in apiserver
Kubernetes-commit: bdd9492da0c992e532c5e5d07cae3b68c9b7b78f
2018-05-14 11:22:10 +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
hangaoshuai ca5f87b89a Refactor hard code in rest_test.go
Kubernetes-commit: de1f2c8310fbefbbc6ac38ce6ca2dd90d781b5f5
2018-05-08 15:42:06 +08:00
Jordan Liggitt 91142e772a Collapse onto request scope convertor
Kubernetes-commit: 2c1a689952ec34e3f9ecb7bcd1772c3fa35c9597
2018-04-26 16:21:38 -04:00
Jordan Liggitt 050d3a3aa4 Fix govet error
Kubernetes-commit: f6b08d6d76be65239e3775b52bf99fa81fec667b
2018-04-26 16:10:29 -04:00
jennybuckley 56ec7f69aa Remove unnecessary typer from create/update handlers
Kubernetes-commit: 5e23dd0517f493011e7c529464f448d6b2ae9ef7
2018-04-23 12:29:37 -07:00
Jordan Liggitt 68ff1d00ce Add tests for resourceVersion precondition failures on patch
Kubernetes-commit: b526532c8abf3cbd4442f364377cb7c7f42f199e
2018-04-25 22:44:46 -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
hzxuzhonghu c3f6af1ec1 avoid calling Handles twice
Kubernetes-commit: 9ce6da671d7035c1f9bcc8db9c7f0c69f9701210
2018-04-21 13:44:14 +08:00
hzxuzhonghu f11d20d5bf fix typo: mutating validating admission should be distinguished
Kubernetes-commit: cd4c71422e41e9dbbc015e8b6c0e1b6b5bb67346
2018-04-21 11:37:36 +08: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
Kubernetes Publisher 627fa76a8b sync: initially remove files BUILD */BUILD BUILD.bazel */BUILD.bazel 2018-03-15 09:38:17 +00:00
hangaoshuai 8e51703adb remove unused function negotiate() and writeYAML()
Kubernetes-commit: 5f908c226c9df144dfc0e1665381b8ec534a60a4
2018-02-23 14:53:51 +08:00
Mike Danese cee5e95803 remove deprecated /proxy paths
These were depercated in v1.2.

Kubernetes-commit: 7b4722964d21c994e0fdf36c0d7f5b0dc703a9c2
2018-02-14 11:13:54 -08:00
Jeff Grafton 1ab12b2dc8 Autogenerated: hack/update-bazel.sh
Kubernetes-commit: ef56a8d6bb3800ab7803713eafc4191e8202ad6e
2018-02-16 13:43:01 -08:00
Nikhita Raghunath 2cc4871e76 Collect prometheus metrics for custom resources
Since we have a custom handler for apiextensions-apiserver,
we need to record the metrics here.

Kubernetes-commit: 74cd45fb21b349dd037e3bfd844459ca5834cca1
2017-12-28 14:36:31 +05:30
Clayton Coleman f688fbc3b2 Promote v1alpha1 meta to v1beta1
No code changes, just renames

Kubernetes-commit: d07a608607e1f4d252003c17cd615652574a0823
2018-01-30 13:30:57 -05:00
halfcrazy 6f8c3a80da fix typo in package apiserver
Kubernetes-commit: 0da91a8577ddfdeaff985cbb6c0da69d5a2ffc81
2018-02-01 03:04:33 +08: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