Commit Graph

181 Commits

Author SHA1 Message Date
yanxuean 48fc8a399d missing format args in apiserver/pkg/endpoints
Signed-off-by: yanxuean <yan.xuean@zte.com.cn>

Kubernetes-commit: 08b0883734ab39b3b789c225b14e62f5c25be660
2017-11-23 09:52:56 +08:00
Shiyang Wang e89cc5fee9 Fix Content negotiation incorrect when Accept header uses type parameters
Kubernetes-commit: 66c2ec32f2497616ddd6912cfc97f0b4306f9eea
2017-08-14 16:24:30 +08:00
Maciej Szulik 4ad8f1d59a Return original error instead of negotiation one
Kubernetes-commit: 7c83e736624d9861da44459269925e8a127f5a44
2017-11-14 14:12:21 +01:00
Clayton Coleman 9f9cf56bb6 Table printers and server generation should always copy ListMeta
Tables should be a mapping from lists, so if the incoming object has
these add them to the table. Allows paging over server side tables.
Add tests on the generic creater and on the resttest compatibility.

Kubernetes-commit: d2a62fd42234a96cbab2dbcf402c168c59b41784
2017-11-15 21:01:49 -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
Clayton Coleman 089e209aad Guarantee that status errors have a kind set
Some errors are invoked outside of negotiation. These errors should
still have a kind and apiVersion (which is only set by structured
encoders, not always availabe). Ensure that all errors by default get a
status kind and version set.

Kubernetes-commit: a1e44fc69bf0faeb47e6d2ebfc2709bbc3f17221
2017-11-15 21:02:34 -05:00
Dr. Stefan Schimanski 563bb7b931 Update generated code
Kubernetes-commit: 1e79dfb959896f2e51be87ecef491452bd17724c
2017-11-09 12:27:20 +01:00
Dr. Stefan Schimanski 204da0b2db apiserver: add validating admission tests
- in endpoint tests
- in generic registry
- in patch handler
- in admission chain

Kubernetes-commit: c558d2a3517fafdb704edd2c00b6df6738786959
2017-11-07 10:40:43 +01:00
Mike Danese 06a5d25846 move authorizers over to new interface
Kubernetes-commit: 12125455d84c75562e6dd6a183762549adff747f
2017-09-29 14:21:40 -07:00
Cao Shufeng 35655c329b [trival]remove duplicated code from unit test
Kubernetes-commit: acb90b6547e0d8304a0f75bf21b9769c5186cf5d
2017-11-05 15:02:41 +08:00
Dr. Stefan Schimanski 45afa13373 admission: rename Validate{ -> Initialization}, Validat{ingAdmit -> e}
Kubernetes-commit: aedcf681b32618be3cf9ad40eeb039f1bb26c5ae
2017-10-27 17:09:39 +02:00
Dr. Stefan Schimanski 3eeded3a29 admission: wire create+update validation func into kube registries
Kubernetes-commit: 2452afffe09e1ced9487e5a701beb1443a92b741
2017-10-24 15:33:28 +02:00
Dr. Stefan Schimanski 441ac63056 admission: complete plumbing of validation admission
Kubernetes-commit: 74b4223ab80fa3bbf326ac1073ef28f0b8daa304
2017-10-24 14:08:34 +02:00
Dr. Stefan Schimanski a8fb04360a admission: { -> Mutating}Admit(admission.Attributes)
Kubernetes-commit: 970d2553cca466c1236f1e91b3161cb1a69dbdd2
2017-10-23 14:26:38 +02:00
David Eads a2e3d31f52 add wiring for validating admission
Kubernetes-commit: 02e16cb253f01303d71ad4e8d6aa578d1ab79c0a
2017-10-19 09:44:42 -04: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
Jordan Liggitt 198ca9b2e0 Use GVK from storage in API registration
Kubernetes-commit: 5913fccada6097c984b168ab15c243a8b20876e5
2017-10-27 04:29:04 -04:00
Jordan Liggitt 8ea8479b92 Specify correct subresource discovery info
Kubernetes-commit: 729a0da155871de445ea2116cf6457e29e313d08
2017-10-27 04:22:39 -04:00
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
Jeff Grafton f4dbe23125 update BUILD files
Kubernetes-commit: aee5f457dbfd70c2d15c33e392dce6a3ca710116
2017-10-12 13:52:10 -07:00
Cao Shufeng f7e881914a support micro time for advanced audit
Kubernetes-commit: 817bc6954ca9af02013fd8f492f8ef865c217b0d
2017-09-25 11:56:30 +08:00
Dr. Stefan Schimanski 3cfc602704 apimachinery: mechanical removal of ObjectCopier plumbing
Kubernetes-commit: 509df603b18d356777176953e5d160b6f3d0bba9
2017-10-06 13:30:12 +02:00
Clayton Coleman d1431e49e4 Endpoints can add a get or connect options type in their group
optionsExternalVersion is being used for shared types (meta.k8s.io). The
installer should first look in the current API group for GET and CONNECT
options objects before checking in `v1`.

Kubernetes-commit: 0e4b20fbf9ff299c37a5055e082fa27dbf2b49c0
2017-09-25 17:03:34 -04:00
Brendan Burns 5621f05378 Add 201/202 to the list of returned codes.
Kubernetes-commit: 449082f55d323bf4acf6963c4d093c044742762c
2017-09-26 22:31:19 -07:00
Clayton Coleman 2aa97c4081 Add a negotiate method media type for use in explicit contexts
Kubernetes-commit: 26d87e49cbbc4caa9e0eef47fce9115c1f43566e
2017-09-23 15:07:55 -04:00
Shyam Jeedigunta 649cc4c05e Modify traces in deletion handler
Kubernetes-commit: c4ca2c734963afd442ff6c43631d004092ea74e8
2017-09-27 00:48:06 +02:00
Clayton Coleman 4175a07239 Track gauge of all long running API requests
Allows a caller to know how many exec, log, proxy, and watch calls are
running at the current moment.

Kubernetes-commit: fabce1b893f96bdf466c1fdb1fcf825210c008ae
2017-09-19 20:35:29 -04:00
Clayton Coleman 1caba4b96e Collapse all metrics handlers into common code
Remove the MonitorRequest method and replace with a method that takes
request.RequestInfo, which is our default way to talk about API objects.
Preserves existing semantics for calls.

Kubernetes-commit: 10e6dc5ed3573118c56fa8823b387e47c8e8ae06
2017-09-11 14:53:18 -04:00
Jim Minter 4e1a340bd1 ProducesObject should only update the returned API object resource documentation
Kubernetes-commit: e18eeb2d63f67b1e0dd3e79982beb7879242c3bb
2017-09-05 15:34:15 -05:00
Jordan Liggitt 78261d54df Preserve leading and trailing slashes on proxy subpaths
Kubernetes-commit: 04eede9b2a2a24571cb084fcb952c6a2a2a2bdd1
2017-09-22 22:35:20 -04:00
Kubernetes Publisher 8fc21589fe Increase sliding window to 5hr for request_latencies metric
Kubernetes-commit: e1ba3da16c9bebccb3902952d56b59f2e2dbb900
2017-09-22 11:42:05 +00:00
Kubernetes Publisher 24ccf40372 Add extra steps to delete resource handler trace
Kubernetes-commit: 6089cadab3d136455b1b4376d819464fb0d2379a
2017-09-22 11:42:05 +00:00
Kubernetes Publisher 7d0b0b91fc Report "resource" scope where possible
Also rename the variables to match the concept

Kubernetes-commit: c13a3c03201c9082c4b373b7af8b99d7effd5a62
2017-09-22 11:42:04 +00:00
Kubernetes Publisher 7727b5a3a8 Report scope on all apiserver metrics
Counting list of namespaces is != list across all namespaces (same for
latency)

Kubernetes-commit: 545aba778d5d039a3b8a0f0939fdf8f8261ae1a8
2017-09-22 11:42:04 +00:00
Kubernetes Publisher 4c578f11a1 Normalize WATCHLIST to WATCH in metrics
This causes confusion and doesn't match what we authorize on

Kubernetes-commit: 5e46d5b5450f7e7db87e860440f1bb1f8f523ffa
2017-09-22 11:42:04 +00:00
Maciej Szulik 6959d4a79a Fill in creationtimestamp in audit events
Kubernetes-commit: 3dd3e7aa5243228b49211f4bb40022a719cc57ac
2017-09-09 21:44:33 +00:00
Di Xu e69ddb7b01 fix format of forbidden messages
Kubernetes-commit: 95738d5a0eeb179325858e52ff83ff86de6fce0b
2017-09-09 21:44:31 +00:00
CaoShufeng 5d22e67a97 enhance unit tests of advance audit feature
This change does three things:
    1. use auditinternal for unit test in filter stage
    2. add a seperate unit test for Audit-ID http header
    3. add unit test for audit log backend

Kubernetes-commit: c030026b544da2dd7ef7201019bdc0ac255c2d23
2017-09-09 21:44:30 +00:00
Cao Shufeng 4905dd9b0c Provide a way to omit Event stages in audit policy
Updates https://github.com/kubernetes/kubernetes/issues/48561
This provide a way to omit some stages for each audit policy rule.

For example:
  apiVersion: audit.k8s.io/v1beta1
  kind: Policy
  - level: Metadata
    resources:
       - group: "rbac.authorization.k8s.io"
         resources: ["roles"]
    omitStages:
      - "RequestReceived"

RequestReceived stage will not be emitted to audit backends with
previous config.

Kubernetes-commit: 47ba91450fbe7d9002bfc9d4a48a73256252821f
2017-09-04 14:03:48 +00:00
David Eads 9f885389e9 make url parsing in apiserver configurable
Kubernetes-commit: ccc7c9bdfa80caee93953a96dec0d689d93f08e5
2017-09-04 14:03:48 +00:00
Maciej Szulik 3c2866020c Switch audit output to v1beta1
Kubernetes-commit: f3487f08c6c2444adde9ba110263c9132769332b
2017-09-03 14:04:14 +00:00
David Eads 56e7f5b9c2 expose discovery information on scalable resources
Kubernetes-commit: 65d0f188f68f6428ccc0a776adff496d972faa56
2017-09-03 14:04:14 +00:00
Cao Shufeng d781318aca audit real impersonated user info
Log the newest impersonated user info in the second audit event. This
will help users to debug rbac problems.

Kubernetes-commit: 1c3dc52531b7761921c8855cafc58b669da111f1
2017-09-03 14:04:13 +00:00
Maciej Szulik 677d724b3a Allow audit to log authorization failures
Kubernetes-commit: 9fef244d4ccce0ea8daf37ab86a7af4892d000cf
2017-09-03 14:04:12 +00:00
Cao Shufeng 9ab155429e Split APIVersion into APIGroup and APIVersion in audit events
audit.Event.ObjectRef.APIVersion currently holds both the the API group and
version, separated by a /. This change break these out into separate fields.

This is part of:
https://github.com/kubernetes/kubernetes/issues/48561

Kubernetes-commit: c57eebfe2f8d36361d510f0afd926777a44cccd2
2017-09-01 16:38:54 +00:00
Tim Hockin 39fbd1db4a Remove generated JSON code
Kubernetes-commit: 9e2fccd1de5384a6ecadf54849f612a10ecfe93a
2017-09-01 16:38:01 +00:00
Chenxingyu 22f326be0a make api request verb can be overrided and make "GET" pod log request reported as "CONNECT" pod log request for metrics
Kubernetes-commit: e49315f2db93f5fb2333794ad8064ab7a44053d7
2017-09-01 16:37:09 +00:00
Cao Shufeng 892932fb62 Fix forbidden message format
Before this change:
 # kubectl get pods --as=tom
 Error from server (Forbidden): pods "" is forbidden: User "tom" cannot list pods in the namespace "default".
After this change:
 # kubectl get pods --as=tom
 Error from server (Forbidden): pods is forbidden: User "tom" cannot list pods in the namespace "default".

Kubernetes-commit: ab0918673728fc50fc539017c86bbc03fceb0adc
2017-08-29 13:18:50 +00:00
Clayton Coleman d6c8c768c4 Make generic metadata conform to documented name column convention
Kubernetes-commit: e5857b1ec02514f06b82bf5833fcb87645732883
2017-08-29 13:18:48 +00:00