Commit Graph

579 Commits (f32b390cf08a9afd9f9899e0d97a90eb162b32a8)

Author SHA1 Message Date
Dr. Stefan Schimanski 2f9fa55c6f pkg/storage/etcd: cut off pkg/api scheme 2017-02-02 11:16:28 +01:00
mbohlool 7c4faba1a1 Update bazel 2017-02-02 00:37:37 -08:00
mbohlool 9623d05f79 Move post processing/backward compatibility of openapi out of generic package 2017-02-02 00:37:36 -08:00
Jordan Liggitt ff977e5c7c
Add internal/external DNS node address types 2017-02-01 23:10:32 -05:00
deads2k 6b57489552 move apiserver options 2017-02-01 15:18:33 -05:00
Kubernetes Submit Queue c523476d6f Merge pull request #40124 from mbohlool/separation
Automatic merge from submit-queue

Use full package path for definition name in OpenAPI spec

We were using short package name (last part of package name) plus type name for OpenAPI spec definition name. That can result in duplicate names and make the spec invalid. To be sure we will always have unique names, we are going to use full package name as definition name. Also "x-kubernetes-tag" custom field is added to definitions to list Group/Version/Kind for the definitions that has it. This will help clients to discover definitions easier.
Lastly, we've added a reference from old definition names to the new ones to keep backward compatibilities. The list of old definitions will not be updated.

**Release note**:
- Rename OpenAPI definition names to type's full package names to prevent duplicates
- Create OpenAPI extension "x-kubernetes-group-version-kind" for definitions to store Group/Version/Kind
- Deprecate old definition names and create a reference to the new definitions. Old definitions will be removed in the next release.
2017-02-01 12:06:39 -08:00
Kubernetes Submit Queue 914c57eb52 Merge pull request #40749 from deads2k/generic-35-options
Automatic merge from submit-queue

remove unneeded storage options

Cleanup of some storage serialization options that only kube and federation api server (and maybe not even that one) need.

You may have called it a snip, but this moves the options out of generic entirely.
2017-02-01 01:53:27 -08:00
deads2k aee2378c68 add deads2k to some cmd packages 2017-01-31 13:56:49 -05:00
deads2k 384c873914 remove unneeded storage options 2017-01-31 13:44:39 -05:00
mbohlool 239169a5a4 Use full package path as definition name in OpenAPI 2017-01-30 20:05:18 -08:00
Wojciech Tyczynski dae29625da Enable protobufs in etcd by default 2017-01-30 20:14:06 +01:00
deads2k 9775269fb9 move genericapiserver/server/filters to apiserver 2017-01-27 08:49:30 -05:00
deads2k b511741df7 remove pkg/feature dependency from genericapiserver. 2017-01-26 14:53:05 -05:00
Dr. Stefan Schimanski 2b8e938128 Update generated files 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski 82826ec273 pkg/util/flag: move to k8s.io/apiserver 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski a6b2ebb50c pkg/flag: make feature gate extensible and split between generic and kube 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski 3d9449a353 genericapiserver: fix imports 2017-01-19 13:06:47 +01:00
deads2k 01b3b2b461 move admission to genericapiserver 2017-01-18 08:15:19 -05:00
deads2k 52ec66ee85 remove api dependency from admission 2017-01-18 08:09:48 -05:00
deads2k de725e56e2 prevent anonymous auth and allow all 2017-01-17 10:16:33 -05:00
Kubernetes Submit Queue 73c900b598 Merge pull request #38272 from xingzhou/kube-38143
Automatic merge from submit-queue

Added validation for API server's 'apiserver-count' flag.

Added validation for API server's 'apiserver-count' flag. The value of this flag should be a positive number, otherwise, will cause error while reconciling endpoints in MasterCountEndpointsReconciler. 

Fixed #38143
2017-01-16 19:14:40 -08:00
Dr. Stefan Schimanski 1a7242a84c Move BuildDefaultStorageFactory to kubeapiserver 2017-01-16 14:25:58 +01:00
Kubernetes Submit Queue e9165d3d46 Merge pull request #36397 from apelisse/owners-cmd-kube-apiserver
Automatic merge from submit-queue

Curating Owners: cmd/kube-apiserver

cc @lavalamp @smarterclayton @krousey @nikhiljindal

In an effort to expand the existing pool of reviewers and establish a
two-tiered review process (first someone lgtms and then someone
experienced in the project approves), we are adding new reviewers to
existing owners files.


If You Care About the Process:
------------------------------

We did this by algorithmically figuring out who’s contributed code to
the project and in what directories.  Unfortunately, that doesn’t work
well: people that have made mechanical code changes (e.g change the
copyright header across all directories) end up as reviewers in lots of
places.

Instead of using pure commit data, we generated an excessively large
list of reviewers and pruned based on all time commit data, recent
commit data and review data (number of PRs commented on).

At this point we have a decent list of reviewers, but it needs one last
pass for fine tuning.

Also, see https://github.com/kubernetes/contrib/issues/1389.

TLDR:
-----

As an owner of a sig/directory and a leader of the project, here’s what
we need from you:

1. Use PR https://github.com/kubernetes/kubernetes/pull/35715 as an example.

2. The pull-request is made editable, please edit the `OWNERS` file to
remove the names of people that shouldn't be reviewing code in the future in
the **reviewers** section. You probably do NOT need to modify the **approvers**
section. Names asre sorted by relevance, using some secret statistics.

3. Notify me if you want some OWNERS file to be removed.  Being an
approver or reviewer of a parent directory makes you a reviewer/approver
of the subdirectories too, so not all OWNERS files may be necessary.

4. Please use ALIAS if you want to use the same list of people over and
over again (don't hesitate to ask me for help, or use the pull-request
above as an example)
2017-01-13 10:56:45 -08:00
deads2k 9a8bf348a6 move tunneler out of generic 2017-01-12 08:21:58 -05:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Kubernetes Submit Queue addc6cae4a Merge pull request #38212 from mikedanese/kubeletauth
Automatic merge from submit-queue (batch tested with PRs 38212, 38792, 39641, 36390, 39005)

Generate a kubelet CA and kube-apiserver cert-pair for kubelet auth.

cc @cjcullen
2017-01-10 19:48:09 -08:00
Kubernetes Submit Queue de59ede6b2 Merge pull request #37784 from bruceauyeung/k8s-branch-fix-glog-message-typo
Automatic merge from submit-queue

fix glog message typo about init deserialization cache and watch cache

**What this PR does / why we need it**:
fix typo  `Initalizing` to `Initializing` 

Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2017-01-06 17:43:32 -08:00
Jeff Grafton 20d221f75c Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
Kubernetes Submit Queue f76fba0da0 Merge pull request #39435 from sttts/sttts-cloudprovider-to-master
Automatic merge from submit-queue

Move apiserver cloudprovider dep into kubeapiserver
2017-01-05 02:29:11 -08:00
Dr. Stefan Schimanski f96fa748d8 Move apiserver cloudprovider dep into kubeapiserver 2017-01-05 09:40:03 +01:00
Mike Danese 3ab0e37cc6 implement upgrades 2017-01-04 11:45:57 -08:00
CJ Cullen d0997a3d1f Generate a kubelet CA and kube-apiserver cert-pair for kubelet auth.
Plumb through to kubelet/kube-apiserver on gci & cvm.
2017-01-03 14:30:45 -08:00
deads2k 2861509b6d refactored admission to avoid internal client references 2017-01-03 15:50:12 -05:00
Mike Danese 161c391f44 autogenerated 2016-12-29 13:04:10 -08:00
deads2k ab1b77673f decouple genericapiserver from non-generic authenticator 2016-12-22 07:48:08 -05:00
deads2k a3564c0aa8 start kubeapiserver package for sharing between kubeapiserver and federation 2016-12-22 07:43:42 -05:00
Xing Zhou 2ae4ab4b7d Added validation for API server's 'apiserver-count' flag.
--apiserver-count should be a positive number, otherwise will cause
errors when reconciling endpoints in MasterCountEndpointsReconciler.
2016-12-19 02:04:38 +00:00
Kubernetes Submit Queue 5b2823adb9 Merge pull request #38191 from sttts/sttts-move-master-options
Automatic merge from submit-queue

Move non-generic apiserver code out of the generic packages
2016-12-17 01:25:45 -08:00
Maciej Szulik 9f064c57ce Remove extensions/v1beta1 Job 2016-12-17 00:07:24 +01:00
Dr. Stefan Schimanski 7adaac79ca Update bazel 2016-12-16 17:49:23 +01:00
Dr. Stefan Schimanski aa81e1d51d pkg/apiserver: move validation.go into pkg/registry 2016-12-16 17:49:22 +01:00
Dr. Stefan Schimanski 3be6b3c045 pkg/apiserver: remove unused code 2016-12-16 17:47:47 +01:00
Dr. Stefan Schimanski 5e8ca29a76 Clean up apiserver and federation defaulting and validation 2016-12-16 17:23:43 +01:00
Dr. Stefan Schimanski 7267299c3c genericapiserver: move MasterCount and service options into master 2016-12-16 17:23:43 +01:00
Kubernetes Submit Queue 6fa4042211 Merge pull request #38690 from sttts/sttts-swagger-postbuildhandler
Automatic merge from submit-queue

genericapiserver: unify swagger and openapi in config

- make swagger config customizable
- remove superfluous `Config.Enable*` flags for OpenAPI and Swagger.

This is necessary for downstream projects to tweak the swagger spec.
2016-12-14 11:11:02 -08:00
Dr. Stefan Schimanski cab89a67df genericapiserver: unify swagger and openapi in config 2016-12-14 18:41:04 +01:00
Dr. Stefan Schimanski e57ef4327f Document broken behaviour with KUBE_API_VERSIONS 2016-12-14 09:35:47 +01:00
Dr. Stefan Schimanski 543417dbf0 Replace apiserver glog.Fatals with fmt.Errorfs 2016-12-14 09:35:47 +01:00
Antoine Pelisse db0f04fa20 Update OWNERS approvers and reviewers: cmd/kube-apiserver 2016-12-12 16:02:39 -08:00
Mike Danese c87de85347 autoupdate BUILD files 2016-12-12 13:30:07 -08:00
Kubernetes Submit Queue cbf497b749 Merge pull request #38119 from liggitt/long-running
Automatic merge from submit-queue (batch tested with PRs 37032, 38119, 38186, 38200, 38139)

Detect long-running requests from parsed request info

Follow up to https://github.com/kubernetes/kubernetes/pull/36064

Uses parsed request info to more tightly match verbs and subresources

Removes regex-based long-running request path matching (which is easily fooled)

```release-note
The --long-running-request-regexp flag to kube-apiserver is deprecated and will be removed in a future release. Long-running requests are now detected based on specific verbs (watch, proxy) or subresources (proxy, portforward, log, exec, attach).
```
2016-12-06 18:29:35 -08:00
Kubernetes Submit Queue d4d6a32e9b Merge pull request #38123 from deads2k/api-48-remove-fields
Automatic merge from submit-queue (batch tested with PRs 38194, 37594, 38123, 37831, 37084)

remove unnecessary fields from genericapiserver config

Cleans up some unnecessary fields in the genericapiserver config.
2016-12-06 17:41:33 -08:00
deads2k b723333be3 move APIResourceConfigSource to master 2016-12-06 10:19:25 -05:00
deads2k 6ea1d5d53d join client CA bundles into the accept path for genericapiserver 2016-12-06 09:56:13 -05:00
deads2k fbb35b72ed update delegating auth to include front-proxy 2016-12-06 09:40:07 -05:00
deads2k 4f625db133 move client-ca to authentication args 2016-12-06 09:34:49 -05:00
Jordan Liggitt 4359054616
Detect long-running requests from parsed request info 2016-12-05 16:46:28 -05:00
deads2k 2923d09091 remove rbac super user 2016-12-05 13:49:54 -05:00
Dr. Stefan Schimanski 3f01c37b9d Update generated files 2016-12-05 16:05:52 +01:00
Dr. Stefan Schimanski a4cf364dbd Replace glog.Fatals with "return fmt.Errorf" in apiservers 2016-12-05 16:05:52 +01:00
Dr. Stefan Schimanski 5b1d45bc15 Stratify certificate loading and self-sign cert generation
This removes all dependencies on Config during cert generation, only operating
on ServerRunOptions. This way we get rid of the repeated call of Config.Complete
and cleanly stratify the GenericApiServer bootstrapping.
2016-12-05 14:58:15 +01:00
Dr. Stefan Schimanski eeb582e53f Move DefaultServiceIPRange into pkg/master 2016-12-03 18:34:22 +01:00
bruceauyeung 84fd2f2f76 fix glog message typo
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-12-01 15:24:44 +08:00
deads2k ab9a842f3c add loopback auth defaulting to generic apiserver 2016-11-29 11:02:35 -05:00
deads2k 6846855929 add delegating authorization flags and options 2016-11-29 10:59:43 -05:00
deads2k ca2b5f136e split authorization from main options struct 2016-11-29 10:59:43 -05:00
deads2k 5cea15ac9f add delegating auth options 2016-11-29 10:59:43 -05:00
deads2k 7c0e48f544 split out authentication options 2016-11-29 10:59:43 -05:00
deads2k 56b7a8b02b remove some options from mega-struct 2016-11-29 10:59:43 -05:00
deads2k 18074d7606 split insecure serving options 2016-11-29 10:59:42 -05:00
deads2k a08f3ba521 split secure serving options 2016-11-29 10:59:42 -05:00
deads2k a9af8206cb split generic etcdoption out of main struct 2016-11-29 10:59:42 -05:00
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Chao Xu 643f0bbd34 other cmd/ 2016-11-23 15:53:09 -08:00
Kubernetes Submit Queue 860cae0933 Merge pull request #35488 from dixudx/keystone-ca-cert
Automatic merge from submit-queue

specify custom ca file to verify the keystone server

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**:

Sometimes the keystone server's certificate is self-signed, mainly used for internal development, testing and etc.

For this kind of ca, we need a way to verify the keystone server.

Otherwise, below error will occur.

> x509: certificate signed by unknown authority

This patch provide a way to pass in a ca file to verify the keystone server when starting `kube-apiserver`.

**Which issue this PR fixes** : fixes #22695, #24984

**Special notes for your reviewer**:

**Release note**:

<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->

``` release-note
```
2016-11-08 13:13:00 -08:00
Maciej Szulik 41d88d30dd Rename ScheduledJob to CronJob 2016-11-07 10:14:12 +01:00
Di Xu dd6c980949 specify custom ca file to verify the keystone server 2016-11-04 15:11:41 +08:00
deads2k d82f98c9b3 remove non-generic options from genericapiserver.Config 2016-11-03 11:48:33 -04:00
deads2k f56cbfa8d5 add healthz to genericapiserver 2016-11-01 14:39:33 -04:00
Dr. Stefan Schimanski d0b3981f07 Make GenericApiServer.Run interruptable and fail on first listen 2016-11-01 09:50:56 +01:00
Jordan Liggitt 1a7f7c5399
Allow apiserver to choose preferred kubelet address type 2016-10-31 16:02:38 -04:00
Dr. Stefan Schimanski ab3ce27f01 Make master+federation ServerRunOptions embeddings explicit 2016-10-31 11:04:58 +01:00
Dr. Stefan Schimanski b798527793 Rename master/options/{APIServer -> ServerRunOptions} 2016-10-31 10:55:19 +01:00
Dr. Stefan Schimanski d6dc0e561f Apiserver cleanups
- remove unused genericapiserver Config.MasterServiceNamespace
- move init code into ApplyOptions
- initialize genericapiserver Config.MaxRequestsInFlight
- move ServiceReadWritePort to master
2016-10-31 10:55:19 +01:00
deads2k 3f9a4d51d5 wire up authenticating front proxy: 2016-10-28 08:36:46 -04:00
Dr. Stefan Schimanski 05fcc6b56a Update bazel 2016-10-22 14:31:56 +02:00
Dr. Stefan Schimanski cca05af615 Move swagger+openapi setup to routes and decouple from run 2016-10-22 13:42:22 +02:00
mbohlool 3e67cf8b9b Add authentication to openapi Spec 2016-10-22 02:43:42 -07:00
Mike Danese 3b6a067afc autogenerated 2016-10-21 17:32:32 -07:00
deads2k 9578523180 move proxytransport config out of the genericapiserver 2016-10-20 11:23:53 -04:00
Kubernetes Submit Queue f39e86c0a5 Merge pull request #34474 from liggitt/connection-info-refactor
Automatic merge from submit-queue

Remove static kubelet client, refactor ConnectionInfoGetter

Follow up to https://github.com/kubernetes/kubernetes/pull/33718

* Collapses the multi-valued return to a `ConnectionInfo` struct
* Removes the "raw" connection info method and interface, since it was only used in a single non-test location (by the "real" connection info method)
* Disentangles the node REST object from being a ConnectionInfoProvider itself by extracting an implementation of ConnectionInfoProvider that takes a node (using a provided NodeGetter) and determines ConnectionInfo
* Plumbs the KubeletClientConfig to the point where we construct the helper object that combines the config and the node lookup. I anticipate adding a preference order for choosing an address type in https://github.com/kubernetes/kubernetes/pull/34259
2016-10-18 13:20:25 -07:00
deads2k 5a9b16d40a make version an explicit choice so zero config and customized work 2016-10-17 16:10:07 -04:00
deads2k 14c164a328 add ownerref permission checks 2016-10-17 09:38:05 -04:00
Jordan Liggitt a082a2e749
Remove static kubelet client, refactor ConnectionInfoGetter 2016-10-15 22:15:04 -04:00
Kubernetes Submit Queue 864a7bacaa Merge pull request #34828 from deads2k/api-26-apiserver-annoyance
Automatic merge from submit-queue

default serializer

Everyone uses the same serializer.  Set it as the default, but still allow someone to take control if they want.

Found while trying to use genericapiserver for composition.
2016-10-15 07:29:59 -07:00
Kubernetes Submit Queue 19848dddfd Merge pull request #24980 from aveshagarwal/master-project-node-selector
Automatic merge from submit-queue

Add support for admission controller based on namespace node selectors.

This work is to upstream openshift's project node selectors based admission controller.

Fixes https://github.com/kubernetes/kubernetes/issues/17151
2016-10-14 18:37:33 -07:00
deads2k 7412be4465 default serializer 2016-10-14 11:27:32 -04:00
Kubernetes Submit Queue c3742a8fbe Merge pull request #34047 from deads2k/rbac-11-informer-cache
Automatic merge from submit-queue

Run rbac authorizer from cache

RBAC authorization can be run very effectively out of a cache.  The cache is a normal reflector backed cache (shared informer).

I've split this into three parts:
 1. slim down the authorizer interfaces
 1. boilerplate for adding rbac shared informers and associated listers which conform to the new interfaces
 1. wiring

@liggitt @ericchiang @kubernetes/sig-auth
2016-10-14 08:12:28 -07:00
Avesh Agarwal b902f857c6 Add support for admission controller based on namespace node selectors.
This work is to upstream openshift's project node selectors based admission controller.

Addresses #17151.
2016-10-13 13:14:19 -04:00
deads2k fbd5032da2 split genericapiserver configuration apart so that you can run without flag options 2016-10-13 13:09:53 -04:00
deads2k e1638f11a3 run authorization from a cache 2016-10-13 07:53:40 -04:00
Kubernetes Submit Queue ca75b47657 Merge pull request #32555 from pweil-/admission-authorizer
Automatic merge from submit-queue

WantsAuthorizer admission plugin support

The next step of PSP admission is to be able to limit the PSPs used based on user information.  To do this the admission plugin would need to make authz checks for the `user.Info` in the request.  This code allows a plugin to request the injection of an authorizer to allow it to make the authz checks.

Note:  this could be done with a SAR, however since admission is running in the api server using the SAR would incur an extra hop vs using the authorizer directly.

@deads2k @derekwaynecarr
2016-10-13 03:40:11 -07:00
mbohlool 5ba06cf2bc Make Kubernetes OpenAPI operation IDs unique 2016-10-12 14:54:12 -07:00
pweil- 5c66dcb526 inject authorizer when admission controller requests it 2016-10-12 13:05:34 -04:00
Kubernetes Submit Queue 8a72f11596 Merge pull request #33842 from deads2k/api-19-clean-structs
Automatic merge from submit-queue

clean api server cruft

Some cruft has developed over refactors.  Remove that cruft.

@liggitt probably last in the chain so far
2016-10-11 18:56:15 -07:00
deads2k 406c0a36ae cleanup cruft from API server structs 2016-10-11 10:56:05 -04:00
Kubernetes Submit Queue 1837914d8e Merge pull request #34029 from liggitt/service-account-rotation
Automatic merge from submit-queue

Enable service account signing key rotation

fixes #21007

```release-note
The kube-apiserver --service-account-key-file option can be specified multiple times, or can point to a file containing multiple keys, to enable rotation of signing keys.
```

This PR enables the apiserver authenticator to verify service account tokens signed by different private keys. This can be done two different ways:
* including multiple keys in the specified keyfile (e.g. `--service-account-key-file=keys.pem`)
* specifying multiple key files (e.g. `--service-account-key-file current-key.pem --service-account-key-file=old-key.pem`)

This is part of enabling signing key rotation:

1. update apiserver(s) to verify tokens signed with a new public key while still allowing tokens signed with the current public key (which is what this PR enables)
2. give controllermanager the new private key to sign new tokens with
3. remove old service account tokens (determined by verifying signature or by checking creationTimestamp) once they are no longer in use (determined using garbage collection or magic) or some other algorithm (24 hours after rotation, etc). For the deletion to immediately revoke the token, `--service-account-lookup` must be enabled on the apiserver.
4. once all old tokens are gone, update apiservers again, removing the old public key.
2016-10-10 21:54:03 -07:00
Kubernetes Submit Queue bd3664cbef Merge pull request #34000 from wojtek-t/set_cache_size
Automatic merge from submit-queue

Set deserialization cache size based on target memory usage

**Special notes for your reviewer**:

This is the PR we talked about yesterday.

**Release note**:

```release-note
To reduce memory usage to reasonable levels in smaller clusters, kube-apiserver now sets the deserialization cache size based on the target memory usage.
```
2016-10-05 14:23:39 -07:00
Wojciech Tyczynski 2bfcb1a850 Set deserialization cache size based on target memory usage 2016-10-05 10:00:02 +02:00
Jordan Liggitt 3c92eb75b3
Enable service account signing key rotation 2016-10-04 14:16:38 -04:00
deads2k 8eddc7158b stop plumbing options to start 2016-10-03 13:35:00 -04:00
Kubernetes Submit Queue 6a1622a723 Merge pull request #33785 from deads2k/api-16-pass-config-to-hook
Automatic merge from submit-queue

pass loopback config to poststart hooks

Updates post start hooks to take a clientconfig with the new loopback credentials for bootstrapping.

@ericchiang This is a little bit of plumbing, but mainly auth I think.
2016-10-01 10:27:04 -07:00
Kubernetes Submit Queue 30ca344361 Merge pull request #33565 from liggitt/ecdsa
Automatic merge from submit-queue

Add ECDSA support for service account tokens

Fixes #28180

```release-note
ECDSA keys can now be used for signing and verifying service account tokens.
```
2016-10-01 08:42:53 -07:00
deads2k 57039cfdfa make well-known users and groups into constants 2016-09-30 10:34:33 -04:00
deads2k 4c8959df59 pass loopback config to posthooks 2016-09-30 10:34:33 -04:00
deads2k 5080a575ad add anytoken authenticator 2016-09-29 14:14:06 -04:00
Kubernetes Submit Queue d187997c94 Merge pull request #32386 from liggitt/anonymous-authenticated-groups
Automatic merge from submit-queue

Allow anonymous API server access, decorate authenticated users with system:authenticated group

When writing authorization policy, it is often necessary to allow certain actions to any authenticated user. For example, creating a service or configmap, and granting read access to all users

It is also frequently necessary to allow actions to any unauthenticated user. For example, fetching discovery APIs might be part of an authentication process, and therefore need to be able to be read without access to authentication credentials.

This PR:
* Adds an option to allow anonymous requests to the secured API port. If enabled, requests to the secure port that are not rejected by other configured authentication methods are treated as anonymous requests, and given a username of `system:anonymous` and a group of `system:unauthenticated`. Note: this should only be used with an `--authorization-mode` other than `AlwaysAllow`
* Decorates user.Info returned from configured authenticators with the group `system:authenticated`.

This is related to defining a default set of roles and bindings for RBAC (https://github.com/kubernetes/features/issues/2). The bootstrap policy should allow all users (anonymous or authenticated) to request the discovery APIs.

```release-note
kube-apiserver learned the '--anonymous-auth' flag, which defaults to true. When enabled, requests to the secure port that are not rejected by other configured authentication methods are treated as anonymous requests, and given a username of 'system:anonymous' and a group of 'system:unauthenticated'. 

Authenticated users are decorated with a 'system:authenticated' group.

NOTE: anonymous access is enabled by default. If you rely on authentication alone to authorize access, change to use an authorization mode other than AlwaysAllow, or or set '--anonymous-auth=false'.
```

c.f. https://github.com/kubernetes/kubernetes/issues/29177#issuecomment-244191596
2016-09-29 10:47:49 -07:00
Dr. Stefan Schimanski 61409c821b Turn embedding into composition: master.Config.{Config -> GenericConfig} 2016-09-29 08:09:39 +02:00
Dr. Stefan Schimanski 8391a19b57 Decouple defaulting from genericapiserver and master 2016-09-28 23:16:09 +02:00
Dr. Stefan Schimanski b4c6a68036 Unify genericapiserver Config.New() and master Config.New() 2016-09-28 19:19:54 +02:00
Jordan Liggitt 6333d8fd86
Add ECDSA support 2016-09-27 12:44:54 -04:00
Jordan Liggitt 0c36c5e556
Add anonymous auth to the auth chain 2016-09-26 17:19:00 -04:00
Jordan Liggitt 2ac293a0bd
Put loopback authn/authz first in chain 2016-09-25 20:33:25 -04:00
deads2k f6882e8465 remove storage related fields from genericapiserver 2016-09-22 09:21:34 -04:00
Kubernetes Submit Queue c46bc88f04 Merge pull request #31491 from dims/fixes-issue-13598
Automatic merge from submit-queue

Allow secure access to apiserver from Admission Controllers

* Allow options.InsecurePort to be set to 0 to switch off insecure access
* In NewSelfClient, Set the TLSClientConfig to the cert and key files
  if InsecurePort is switched off
* Mint a bearer token that allows the client(s) created in NewSelfClient
  to talk to the api server
* Add a new authenticator that checks for this specific bearer token

Fixes #13598
2016-09-21 21:31:56 -07:00
mbohlool 38b2567d8b Move generated openAPI specs out of genericapiserver and make it configurable 2016-09-20 14:06:10 -07:00
Davanum Srinivas 25d4a70827 Allow secure access to apiserver from Admission Controllers
* Allow options.InsecurePort to be set to 0 to switch off insecure access
* In NewSelfClient, Set the TLSClientConfig to the cert and key files
  if InsecurePort is switched off
* Mint a bearer token that allows the client(s) created in NewSelfClient
  to talk to the api server
* Add a new authenticator that checks for this specific bearer token

Fixes #13598
2016-09-20 10:42:21 -04:00
deads2k a2a6423574 separate RESTStorage by API group 2016-09-20 08:00:50 -04:00
Kubernetes Submit Queue 12d916750e Merge pull request #32387 from sttts/sttts-handler-cleanup
Automatic merge from submit-queue

Cleanup non-rest apiserver handlers

- rename MuxHelper -> PathRecorderMux
- move non-rest handlers into routes packages within genericapiserver and `pkg/routes` (those from master)
- move ui and logs handlers out of genericapiserver (they are
  not generic)
- make version handler configurable (`config.EnableVersion`)
2016-09-16 08:58:06 -07:00
Mike Danese a765d59932 move informer and controller to pkg/client/cache
Signed-off-by: Mike Danese <mikedanese@google.com>
2016-09-15 12:50:08 -07:00
Dr. Stefan Schimanski 7f78661d0b Cleanup non-rest apiserver handlers
- rename MuxHelper -> PathRecorderMux
- move non-rest handlers into routes packages within genericapiserver and
  `pkg/routes` (those from master)
- move ui and logs handlers out of genericapiserver (they are
  not generic)
- make version handler configurable (`config.EnableVersion`)
2016-09-15 13:22:45 +02:00
Clayton Coleman acb4c00b39
EnableGarbageCollection should be a struct member on RESTOptions
Not a global. Now that we have RESTOptions this was an easy change.
2016-09-15 00:09:28 -04:00
Daniel Smith a291846cd1 Revert "Remove deprecated Namespace admission plug-ins" 2016-08-28 10:20:44 -07:00
derekwaynecarr c727fdc81f Remove deprecated namespace admission controllers 2016-08-26 11:14:55 -04:00
Kris 1740358573 Split the version metric out to its own package 2016-08-24 11:47:16 -07:00
Kubernetes Submit Queue ef2718620c Merge pull request #30900 from jsafrane/pvc-admission
Automatic merge from submit-queue

Add admission controller for default storage class.

The admission controller adds a default class to PVCs that do not require any
specific class. This way, users (=PVC authors) do not need to care about
storage classes, administrator can configure a default one and all these PVCs
that do not care about class will get the default one.

The marker of default class is annotation "volume.beta.kubernetes.io/storage-class", which must be set to "true" to work. All other values (or missing annotation) makes the class non-default.

Based on @thockin's code, added tests and made it not to reject a PVC when no class is marked as default.
. 
@kubernetes/sig-storage
2016-08-24 03:32:46 -07:00
Quintin Lee 2be0b40c55 Actually link in ImagePolicyWebhook and run initialization. 2016-08-22 16:54:03 -07:00
Jan Safranek 5f6efefc40 [squash] Rename and move to storageclass/ 2016-08-22 14:11:01 +02:00
Kubernetes Submit Queue b51d5c3cc0 Merge pull request #30638 from krousey/metrics_registration
Automatic merge from submit-queue

Remove implicit Prometheus metrics from client

**What this PR does / why we need it**: This PR starts to cut away at dependencies that the client has.

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
The implicit registration of Prometheus metrics for request count and latency have been removed, and a plug-able interface was added. If you were using our client libraries in your own binaries and want these metrics, add the following to your imports in the main package: "k8s.io/pkg/client/metrics/prometheus". 
```

cc: @kubernetes/sig-api-machinery @kubernetes/sig-instrumentation @fgrzadkowski  @wojtek-t
2016-08-21 16:47:05 -07:00
Kubernetes Submit Queue 7979801e54 Merge pull request #28860 from ericchiang/separate-apiserver-authz-options
Automatic merge from submit-queue

pkg/genericapiserver/options: don't import pkg/apiserver

Refactor the authorization options for the API server so
pkg/apiserver isn't directly imported by the options package.

Closes #28544

cc @smarterclayton

@madhusudancs, @nikhiljindal I've updated `federation/cmd/federation-apiserver/app/server.go` to include the RBAC options with this change. I don't know if this was intentionally left out in the first place but would like your feedback.
2016-08-21 09:49:14 -07:00
Chao Xu f7a1ef8189 enable gc by default 2016-08-19 10:42:05 -07:00
Kris 8d6ce0dcc6 Remove implicit Prometheus metrics from client 2016-08-19 10:11:45 -07:00
mbohlool c5f1d63d6f Generates OpenAPI (aka Swagger 2.0) Spec on /swagger.json path 2016-08-18 15:32:04 -07:00
Eric Chiang b4eaf625a0 pkg/genericapiserver/options: don't import pkg/apiserver
Refactor the authorization options for the API server so
pkg/apiserver isn't directly imported by the options package.
2016-08-18 13:01:50 -07:00
Jan Safranek 82d35fb461 Add admission controller for default storage class.
The admission controller adds a default class to PVCs that do not require any
specific class. This way, users (=PVC authors) do not need to care about
storage classes, administrator can configure a default one and all these PVCs
that do not care about class will get the default one.
2016-08-18 18:55:35 +02:00
Hongchao Deng d0938094d9 move new etcd storage into cacher 2016-08-12 18:40:20 -07:00
Kubernetes Submit Queue f53a35fb76 Merge pull request #29147 from caesarxuchao/cut-client-repo-staging
Automatic merge from submit-queue

Cut the client repo, staging it in the main repo

Tracking issue: #28559
ref: https://github.com/kubernetes/kubernetes/pull/25978#issuecomment-232710174

This PR implements the plan a few of us came up with last week for cutting client into its own repo:
1. creating "_staging" (name is tentative) directory in the main repo, using a script to copy the client and its dependencies to this directory
2. periodically publishing the contents of this staging client to k8s.io/client-go repo
3. converting k8s components in the main repo to use the staged client. They should import the staged client as if the client were vendored. (i.e., the import line should be `import "k8s.io/client-go/<pacakge name>`). This requirement is to ease step 4.
4. In the future, removing the staging area, and vendoring the real client-go repo.

The advantage of having the staging area is that we can continuously run integration/e2e tests with the latest client repo and the latest main repo, without waiting for the client repo to be vendored back into the main repo. This staging area will exist until our test matrix is vendoring both the client and the server.

In the above plan, the tricky part is step 3. This PR achieves it by creating a symlink under ./vendor, pointing to the staging area, so packages in the main repo can refer to the client repo as if it's vendored. To prevent the godep tool from messing up the staging area, we export the staged client to GOPATH in hack/godep-save.sh so godep will think the client packages are local and won't attempt to manage ./vendor/k8s.io/client-go.

This is a POC. We'll rearrange the directory layout of the client before merge.

@thockin @lavalamp @bgrant0607 @kubernetes/sig-api-machinery

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/29147)
<!-- Reviewable:end -->
2016-08-09 17:12:14 -07:00
mksalawa a806351cc3 Extract etcd options from genericapiserver. 2016-08-09 13:35:53 +02:00
Wojciech Tyczynski 8a8cd06ea4 Configurable cache sizes of cachers 2016-08-09 09:41:48 +02:00
Chao Xu a771578a1c move pkg/util/ files to their own package to reduce client-go dependencies 2016-08-05 23:32:02 -07:00
Maciej Szulik e6c327048e Forced using batch/v2alpha1 for storing ScheduledJob 2016-08-03 17:25:37 +02:00
k8s-merge-robot 2817674715 Merge pull request #29557 from deads2k/make-prefx-configurable
Automatic merge from submit-queue

make the resource prefix in etcd configurable for cohabitation

This looks big, its not as bad as it seems.

When you have different resources cohabiting, the resource name used for the etcd directory needs to be configurable.  HPA in two different groups worked fine before.  Now we're looking at something like RC<->RS.  They normally store into two different etcd directories.  This code allows them to be configured to store into the same location.

To maintain consistency across all resources, I allowed the `StorageFactory` to indicate which `ResourcePrefix` should be used inside `RESTOptions` which already contains storage information.

@lavalamp affects cohabitation.
@smarterclayton @mfojtik prereq for our rc<->rs and d<->dc story.
2016-07-28 03:01:28 -07:00
deads2k aa3db4d995 make the resource prefix in etcd configurable for cohabitation 2016-07-27 07:51:40 -04:00
k8s-merge-robot 0724a9c4dc Merge pull request #28828 from zte-cloud/failmodify
Automatic merge from submit-queue

modify Failure to failed

use 'failed' is more suitable than 'Failure'
2016-07-25 12:56:15 -07:00
Dominika Hodovska 037d116add Factory for SharedIndexInformers 2016-07-21 14:04:48 +02:00
Dominika Hodovska ba40a528e1 PluginInitializer as a new part of NewFromPlugins method 2016-07-20 12:53:52 +02:00
Dominika Hodovska fc0a3c6dcb Allow shareable resources for admission control plugins 2016-07-20 12:53:52 +02:00
k8s-merge-robot 411c32bc98 Merge pull request #27520 from olegshaldybin/format-apiserver-options
Automatic merge from submit-queue

Format apiserver options

Trivial change, code formatting only: it was hard to read long lines, and my editor was really slow when scrolling through them.
2016-07-19 19:58:01 -07:00
Lucas Käldström 88ea80b572 Remove GOMAXPROCS() calls because they are unnecessary 2016-07-19 11:08:21 +03:00
lojies 77c6176157 modify Failure to failed 2016-07-12 19:11:24 +08:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Oleg Shaldybin e722a41c40 Format apiserver options
Trivial change, code formatting only: it was really hard to read
apiserver options definition, formatted to follow the same pattern
throughout.
2016-06-28 12:34:22 -07:00
Alex Mohr edda837142 Merge pull request #25599 from caesarxuchao/orphaning-finalizer
Add orphaning finalizer logic to GC
2016-05-26 13:19:19 -07:00
Eric Chiang ef40aa9572 pkg/master: enable certificates API and add rbac authorizer 2016-05-25 14:24:47 -07:00
Chao Xu 1665546d2d add finalizer logics to the API server and the garbage collector; handling DeleteOptions.OrphanDependents in the API server 2016-05-24 13:07:28 -07:00
k8s-merge-robot 346f965871 Merge pull request #25694 from cjcullen/authncache
Automatic merge from submit-queue

Cache Webhook Authentication responses

Add a simple LRU cache w/ 2 minute TTL to the webhook authenticator.

Kubectl is a little spammy, w/ >= 4 API requests per command. This also prevents a single unauthenticated user from being able to DOS the remote authenticator.
2016-05-21 10:48:38 -07:00
CJ Cullen 57f96a932f Add expiration LRU cache for webhook token authenticator. 2016-05-18 11:58:11 -07:00
Clayton Coleman 633683c08d
kube-apiserver options should be decoupled from impls
A few months ago we refactored options to keep it independent of the
implementations, so that it could be used in CLI tools to validate
config or to generate config, without pulling in the full dependency
tree of the master.  This change restores that by separating
server_run_options.go back to its own package.

Also, options structs should never contain non-serializable types, which
storagebackend.Config was doing with runtime.Codec. Split the codec out.

Fix a typo on the name of the etcd2.go storage backend.

Finally, move DefaultStorageMediaType to server_run_options.
2016-05-18 10:39:21 -04:00
nikhiljindal 5dffe4a969 Moving federation apiserver to use genericapiserver.ServerRunOptions 2016-05-11 23:42:55 -07:00
k8s-merge-robot 0ef4c6407b Merge pull request #24902 from cjcullen/webhookAuthn
Automatic merge from submit-queue

Webhook Token Authenticator

Add a webhook token authenticator plugin to allow a remote service to make authentication decisions.
2016-05-11 22:08:58 -07:00
Paul Weil 4970f0c02d PSP admission 2016-05-11 18:07:36 -04:00
CJ Cullen eb3b0e78b4 Add a webhook token authenticator plugin. 2016-05-10 14:54:35 -07:00
nikhiljindal 2ffa3b4586 Moving StorageFactory building logic to genericapiserver 2016-05-10 00:57:11 -07:00
Kevin b7014561c1 Add admission controller to limit pod anti affinity topologykey to node level 2016-05-09 12:23:41 +00:00
Clayton Coleman e0ebcf4216
Split the storage and negotiation parts of Codecs
The codec factory should support two distinct interfaces - negotiating
for a serializer with a client, vs reading or writing data to a storage
form (etcd, disk, etc). Make the EncodeForVersion and DecodeToVersion
methods only take Encoder and Decoder, and slight refactoring elsewhere.

In the storage factory, use a content type to control what serializer to
pick, and use the universal deserializer. This ensures that storage can
read JSON (which might be from older objects) while only writing
protobuf. Add exceptions for those resources that may not be able to
write to protobuf (specifically third party resources, but potentially
others in the future).
2016-05-05 12:08:23 -04:00
nikhiljindal 16c0e0a21c Deleting duplicate code from federated-apiserver 2016-05-03 14:04:09 -07:00
Hongchao Deng c0071a1595 add flags to enable etcd3 2016-04-28 09:48:16 +08:00
nikhiljindal f9f1e21e08 Moving master.SSHTunneler to genericapiserver 2016-04-22 11:47:05 -07:00
deads2k 6670b73b18 make storage enablement, serialization, and location orthogonal 2016-04-21 08:18:55 -04:00
Prashanth Balasubramanian 0ac10c6cc2 PetSet type, apps apigroup 2016-04-20 18:49:31 -07:00
nikhiljindal 50a9aceabb Moving more logic to genericapiserver 2016-04-19 00:03:28 -07:00
k8s-merge-robot 62fd60565a Merge pull request #24048 from liggitt/apiserver-defaults
Automatic merge from submit-queue

Use correct defaults when binding apiserver flags

defaults should be set in the struct-creating function, then the current struct field value used as the default when binding the flag
2016-04-17 20:59:38 -07:00
k8s-merge-robot a275a045d1 Merge pull request #23914 from sky-uk/make-etcd-cache-size-configurable
Automatic merge from submit-queue

Make etcd cache size configurable

Instead of the prior 50K limit, allow users to specify a more sensible size for their cluster.

I'm not sure what a sensible default is here. I'm still experimenting on my own clusters. 50 gives me a 270MB max footprint. 50K caused my apiserver to run out of memory as it exceeded >2GB. I believe that number is far too large for most people's use cases.

There are some other fundamental issues that I'm not addressing here:
- Old etcd items are cached and potentially never removed (it stores using modifiedIndex, and doesn't remove the old object when it gets updated)
- Cache isn't LRU, so there's no guarantee the cache remains hot. This makes its performance difficult to predict. More of an issue with a smaller cache size.
- 1.2 etcd entries seem to have a larger memory footprint (I never had an issue in 1.1, even though this cache existed there). I suspect that's due to image lists on the node status.

This is provided as a fix for #23323
2016-04-17 00:06:31 -07:00
Jordan Liggitt 6c1bcfa28d Use correct defaults when binding apiserver flags 2016-04-14 10:12:51 -04:00
k8s-merge-robot 429228d403 Merge pull request #23953 from nikhiljindal/u8sServer
Automatic merge from submit-queue

moving genericapiserver command line flags to genericapiserver

cc @kubernetes/sig-api-machinery
2016-04-13 23:15:24 -07:00
goltermann a3104ba96c Final vet fixes; enabling vet checks in verify scripts. 2016-04-13 13:51:51 -07:00
nikhiljindal 8d7a8c6ae6 moving genericapiserver command line flags to genericapiserver 2016-04-13 13:28:18 -07:00
James Ravn 5bb0595260 Make deserialization cache size configurable
Instead of the default 50K entries, allow users to specify more sensible
sizes for their cluster.
2016-04-12 13:42:27 +01:00
deads2k e8fb35d4d8 refactor resource overrides as positive logic interface 2016-03-28 09:24:49 -04:00
k8s-merge-robot 4e4ad61260 Merge pull request #23366 from goltermann/vet
Auto commit by PR queue bot
2016-03-24 21:50:56 -07:00
nikhiljindal 1cccfc7074 Disabling swagger ui by default. Adding a flag to enable it 2016-03-23 13:19:22 -07:00
k8s-merge-robot 76369c42be Merge pull request #22939 from resouer/util-sub-dir
Auto commit by PR queue bot
2016-03-23 03:34:33 -07:00
k8s-merge-robot 4af38b52b9 Merge pull request #22736 from resouer/fix-util-dev
Auto commit by PR queue bot
2016-03-22 19:54:58 -07:00
goltermann 34d4eaea08 Fixing several (but not all) go vet errors. Most are around string formatting, or unreachable code. 2016-03-22 17:26:50 -07:00
Marc Lough 27c6224abe The --etcd-config option has been removed from kube-apiserver so also remove the mention about it. 2016-03-22 20:14:48 +00:00
harry 343b1927d1 Refactor config map into sub pkg 2016-03-21 14:50:57 +08:00
harry f19d59cf35 Move flag into sub pkg 2016-03-14 21:30:38 +08:00
Brian Grant 532ba5a3c6 Merge pull request #21535 from AdoHe/restore_secure_etcd
restore ability to run against secured etcd
2016-03-11 12:14:06 -08:00
AdoHe 7228b9b987 restore ability to run against secured etcd 2016-03-11 11:21:16 -05:00
Wojciech Tyczynski 2f6d034cea Workaround long latency of POST pods 2016-03-03 10:45:43 +01:00