Commit Graph

340 Commits (0c669fe6cc48208ebcdd43fa2ff425fce3c359a0)

Author SHA1 Message Date
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 df713b478c fix tests by declaring testdata 2016-10-21 17:32:32 -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 8290366a8f Merge pull request #33966 from dims/fix-issue-33375
Automatic merge from submit-queue

Enable local-up-cluster.sh to start with the secured port

related to #33375
2016-10-19 05:40:32 -07:00
Davanum Srinivas 20d1818d78 Enable local-up-cluster.sh to start with the secured port
Generate a kubeconfig for use with controller-manager, kubelet,
scheduler etc. This kubeconfig should use the secure https
port of the api server with appropriate ca cert for the components
to talk to api server.

With this change, one can set API_PORT=0 to completely switch off
insecure access for testing admission controllers etc.

Fixes #33375
2016-10-19 06:36:01 -04:00
Dr. Stefan Schimanski 08d4fa5c4f Turn APIGroupPrefix into a constant 2016-10-19 11:52:15 +02:00
Kubernetes Submit Queue 67732d7383 Merge pull request #34967 from deads2k/api-27-fix-version
Automatic merge from submit-queue

make version an explicit choice so zero config and customized work

Makes `/version` key off of setting the version.  This allows composers to add a version that is correct.
2016-10-18 05:07:02 -07:00
deads2k 5a9b16d40a make version an explicit choice so zero config and customized work 2016-10-17 16:10:07 -04:00
deads2k cd59d9b99f remove write only field 2016-10-17 15:33:43 -04: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
deads2k fbd5032da2 split genericapiserver configuration apart so that you can run without flag options 2016-10-13 13:09:53 -04:00
Kubernetes Submit Queue dd529f3c4a Merge pull request #34551 from deads2k/api-23-remove-legacy-prefixy
Automatic merge from submit-queue

Change legacy API resource registration

Updates the legacy API resource registration to emphasize its different-ness and to simplify supporting objects.  The option has to remain in the genericapiserverconfig for multiple prefixes to enable cases where composers/extenders had composed additional groupless APIs. See OpenShift as an example.

However this is now transparent to "normal" composers.

@ncdc since sttts is out.
2016-10-13 08:23:35 -07:00
deads2k e1638f11a3 run authorization from a cache 2016-10-13 07:53:40 -04:00
mbohlool 5ba06cf2bc Make Kubernetes OpenAPI operation IDs unique 2016-10-12 14:54:12 -07:00
mbohlool 221a620a14 Move Trie to util package 2016-10-12 12:57:50 -07:00
deads2k 6406aacb59 remove legacy API prefix from generic 2016-10-12 15:32:27 -04:00
deads2k 406c0a36ae cleanup cruft from API server structs 2016-10-11 10:56:05 -04:00
deads2k 5d3a210321 convert bootstrap controller to posthook to tighten master.go 2016-10-10 08:15:45 -04: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
Dr. Stefan Schimanski 68cee1d9ac Make genericapiserver handler chain customizable 2016-10-05 10:32:36 -04:00
Dr. Stefan Schimanski 7cfd0150e4 Turn RequestInfoResolver into a RequestInfoFactory 2016-10-05 10:32:36 -04:00
Wojciech Tyczynski 2bfcb1a850 Set deserialization cache size based on target memory usage 2016-10-05 10:00:02 +02:00
deads2k 07d78f3d46 fix apiserver startup check 2016-10-04 12:30:07 -04:00
Kubernetes Submit Queue 649f6dbf61 Merge pull request #33846 from deads2k/api-20-server-needs-serving-info
Automatic merge from submit-queue

stop plumbing options to start

The API server should have sufficient information to start itself without relying on an `options` object from a different packages focused on CLI interaction.  This provides that separation

@liggitt distinct from other changes
2016-10-04 08:46:08 -07:00
deads2k 8eddc7158b stop plumbing options to start 2016-10-03 13:35:00 -04:00
deads2k 8c20af79a4 fix loopback authorizer 2016-10-03 12:46:39 -04:00
deads2k 4c8959df59 pass loopback config to posthooks 2016-09-30 10:34:33 -04:00
Kubernetes Submit Queue cfb833e86a Merge pull request #33628 from mbohlool/co2
Automatic merge from submit-queue

Add OpenAPI specs to source tree

Similar to swagger spec, adding openapi specs in a separate folder api/openapi-spec

To make sure we generate a consistent spec, parameters need to be sorted first.
2016-09-29 19:52:32 -07:00
mbohlool 35b5174bf1 Generate and verify openapi specs in source tree at api/openapi-spec 2016-09-29 17:03:31 -07: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
mbohlool 15fbbacc33 Sort OpenAPI operation and path parameters 2016-09-29 03:10:48 -07:00
Kubernetes Submit Queue 50e12ff5a2 Merge pull request #33575 from sttts/sttts-defaulted-config
Automatic merge from submit-queue

Decouple genericapiserver setDefault from New()
2016-09-29 01:52:46 -07:00
Dr. Stefan Schimanski 6f781625db Make genericapiserver Config.Complete type safe 2016-09-29 08:09:39 +02:00
Davanum Srinivas 1b67df90fa Support Access-Control-Expose-Headers in CORS Handler
Our typical HTTP Response has a "Date" Header, if we don't add an
additional http header "Access-Control-Expose-Headers: Date" then
the browser based clients cannot use the Date HTTP Header.

Fixes #33231
2016-09-28 19:32:25 -04:00
Kubernetes Submit Queue 9b1e2069a6 Merge pull request #33490 from sttts/sttts-requestinfo-via-context
Automatic merge from submit-queue

Store RequestInfo in Context instead of RequestInfoResolver dependency injection

**Depends on https://github.com/kubernetes/kubernetes/pull/33478**

The `RequestInfoResolver` is used in the proxy handler and in the authorization code. It is passed through half of the apiserver code base to be available at those locations. This PR uses the context instead, which is our natural dependency injection mechanism in the handlers.

`RequestInfo` and all tooling around is moved to `pkg/apiserver/request` temporarily to avoid dependency cycles. This is necessary as long as `pkg/apiserver` implements the proxy and other handlers. Those might move to `pkg/apiserver/handlers` probably later.
2016-09-28 16:09:42 -07:00
Dr. Stefan Schimanski 8391a19b57 Decouple defaulting from genericapiserver and master 2016-09-28 23:16:09 +02:00
Dr. Stefan Schimanski 6c75e922f3 Decouple NewRequestInfoResolver from GenericApiServer instance 2016-09-28 18:51:34 +02:00
Dr. Stefan Schimanski 10cbaf7ce0 Store RequestInfo in Context
... in order to replace the manual RequestInfoResolver dependency injection
through out the code.
2016-09-28 18:51:34 +02:00
Dr. Stefan Schimanski bda1c76f39 Simplify genericapiserver tests 2016-09-28 17:25:43 +02:00
Kubernetes Submit Queue 9e1960c507 Merge pull request #33365 from sttts/sttts-custom-handler-chain
Automatic merge from submit-queue

Towards custom handler chains in genericapiserver

**Based on https://github.com/kubernetes/kubernetes/pull/33478**

This PR makes the handler chain construction independent from the genericapiserver instance (with the exception of the `RequestInfoFilter` which will be fixed in https://github.com/kubernetes/kubernetes/pull/33490), i.e. the `Config` is enough to create a custom handler chain.
2016-09-28 01:02:16 -07:00
Kubernetes Submit Queue 1854bdcb0c Merge pull request #29048 from justinsb/volumes_nodename_not_hostname
Automatic merge from submit-queue

Use strongly-typed types.NodeName for a node name

We had another bug where we confused the hostname with the NodeName.

Also, if we want to use different values for the Node.Name (which is
an important step for making installation easier), we need to keep
better control over this.

A tedious but mechanical commit therefore, to change all uses of the
node name to use types.NodeName
2016-09-27 17:58:41 -07:00
Justin Santa Barbara 54195d590f Use strongly-typed types.NodeName for a node name
We had another bug where we confused the hostname with the NodeName.

To avoid this happening again, and to make the code more
self-documenting, we use types.NodeName (a typedef alias for string)
whenever we are referring to the Node.Name.

A tedious but mechanical commit therefore, to change all uses of the
node name to use types.NodeName

Also clean up some of the (many) places where the NodeName is referred
to as a hostname (not true on AWS), or an instanceID (not true on GCE),
etc.
2016-09-27 10:47:31 -04:00
Dr. Stefan Schimanski 157dcda8cc Move longrunning predicate into Config instead of RE
... in order to be available for custom handler chains.
2016-09-27 16:04:35 +02:00
Dr. Stefan Schimanski b806116e40 Move service error handler installer 2016-09-27 16:04:35 +02:00
Dr. Stefan Schimanski e2c17d69f7 Move one-time svg mime init code into Run() 2016-09-27 16:04:35 +02:00
Dr. Stefan Schimanski b48ac54e1c Make audit writer accessible from Config
... such that it can be used for a custom handler chain.
2016-09-27 16:04:34 +02:00
Dr. Stefan Schimanski 6dc2f6337b Separate apiserver handler filters 2016-09-27 09:57:59 +02:00
Dr. Stefan Schimanski a2f943e7c1 Move panic handler into genericapiserver 2016-09-27 09:52:50 +02:00
Kubernetes Submit Queue a845c92207 Merge pull request #33368 from sttts/sttts-prune-serviceerrorhandler
Automatic merge from submit-queue

Prune unused parameters and call only once

Two parameters of `InstallServiceErrorHandler` were not used. Pruning them allows us to move the service error handler installation for each api group to be moved into the constructor.
2016-09-26 22:29:52 -07:00
Jordan Liggitt 0c36c5e556
Add anonymous auth to the auth chain 2016-09-26 17:19:00 -04:00
Timothy St. Clair 009f87719b Fix server initialization for http2 and go 1.7 2016-09-26 10:28:18 -05:00
Kubernetes Submit Queue 33eabe675b Merge pull request #33332 from ericchiang/oidc-allow-string-as-group-claim
Automatic merge from submit-queue

oidc authenticator: allow string value as groups claim

Allow the group claim to be a single string instead of an array of
strings. This means the following claim

    {
      "role": "admin"
    }

Will be mapped to the groups

    ["admin"]

cc @kubernetes/sig-auth @mlbiam

closes #33290
2016-09-23 12:41:27 -07:00
Kubernetes Submit Queue 331eb83585 Merge pull request #33376 from luxas/fix_arm_atomics_2
Automatic merge from submit-queue

Move HighWaterMark to the top of the struct in order to fix arm, second time

ref: #33117

Sorry for not fixing everyone at once, but I seriously wasn't prepared for that quick LGTM 😄, so here's the other half.

@lavalamp 

> lgtm, but seriously, this is terrible, we probably have this bug all over. And what if someone embeds the etcdWatcher struct in something else not at the top? We need the compiler to enforce things like this, it just can't be done manually. Can you file or link a golang issue for this?

I totally agree! There isn't currently a way of programmatically detecting this unfortunately.
I guess @davecheney or @minux can explain better to you why it's so hard.

This is noted in https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/multi-platform.md as a corner case indeed.

@pwittrock This should be cherrypicked toghether with #33117
2016-09-23 12:05:09 -07:00
Lucas Käldström 06917531b3 Move HighWaterMark to the top of the struct in order to fix arm, second time 2016-09-23 20:58:28 +03:00
Dr. Stefan Schimanski acf0a5264a Prune unused parameters and call only once 2016-09-23 14:53:09 +02:00
Dr. Stefan Schimanski 87356c0623 Cleanup handler chain 2016-09-23 12:03:58 +02:00
Dr. Stefan Schimanski 3799ffa0a8 Simplify genericapiserver.Run() 2016-09-23 12:00:30 +02:00
Dr. Stefan Schimanski 8b33a9ed42 Move TimeoutHandler+MaxInFlightLimit to Config.New() 2016-09-23 12:00:30 +02:00
Kubernetes Submit Queue 1063903d01 Merge pull request #33266 from sttts/sttts-one-installapigroups
Automatic merge from submit-queue

Reduce genericapiserver api surface
2016-09-23 02:32:07 -07:00
Dr. Stefan Schimanski 0898f62b5c Add locking around apiGroupsForDiscovery 2016-09-23 08:37:50 +02:00
Kubernetes Submit Queue ad2224c968 Merge pull request #33264 from sttts/sttts-private-postStartHooks
Automatic merge from submit-queue

Make genericapiserver.PostStartHooks private

Better do not leak members to downstream if not necessary.
2016-09-22 21:18:46 -07:00
Kubernetes Submit Queue 6b3f5c4147 Merge pull request #33038 from deads2k/api-11-push-deps-down
Automatic merge from submit-queue

remove storage related fields from genericapiserver

Removes `StorageFactory` and `StorageDecorator` from from `genericapiserver` since both constructs are related to building a `RESTStorage`, which should be provided fully formed (or via factory func) to a truly generic API server.

I found this while trying to move the creation API routes earlier.
2016-09-22 17:04:13 -07:00
Eric Chiang 065ddab5d1 oidc authenticator: allow string value as groups claim
Allow the group claim to be a single string instead of an array of
strings. This means the following claim

    {
      "role": "admin"
    }

Will be mapped to the groups

   ["admin"]
2016-09-22 14:23:56 -07:00
Kubernetes Submit Queue 3149a2b7c6 Merge pull request #33286 from PhilibertDugas/fix/32747_stacktrace-log-from-apiserver
Automatic merge from submit-queue

Apiserver don't log stacktrace when proxying

<!--  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**:

When we are proxying unexpected status from a service or a pod, we print the stack traces (which is not the wanted behaviour). This is an attempt at fixing the issue #32747,

With the `RequestInfoResolver` struct, it's possible to inspect the request and get the `Verb`. In this case, the `proxy` value is what I was looking for to avoid logging stack traces.

I'm wrapping the `.Log()` call with an `if` statement to remove all stack traces logging when the call is a proxy from a service or a pod

Another approach would have been to add another kind of `StacktracePred` in the `httplog` package. I found this path to be trickier to code as it's currently only accepting int values.

**Which issue this PR fixes** : fixes #32747

**Special notes for your reviewer**: N/A

**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-09-22 13:05:21 -07:00
Kubernetes Submit Queue a8053c7c59 Merge pull request #33238 from mbohlool/openapi
Automatic merge from submit-queue

Move openapi common code to genericapiserver/openapi/common

a follow up to #32622

Reference: #13414
2016-09-22 10:20:48 -07:00
Philibert Dugas 9c2705a5a2
Apiserver don't log stacktrace when proxying
Attempt at closing #32747,

With the `RequestInfoResolver` struct, it's possible to inspect the
request and get the `Verb`. In this case, the `proxy` value is what I
was looking for to avoid logging stacktraces.

I'm wrapping the `.Log()` call with an `if` statement to remove all
stacktrace logging when we proxied through the apiserver

Another approach would have been to add another kind of
`StacktracePred` in the `httplog` package. I found this path to be
trickier to code as it's currently only accepting int values.
2016-09-22 12:08:06 -04:00
deads2k f6882e8465 remove storage related fields from genericapiserver 2016-09-22 09:21:34 -04:00
Kubernetes Submit Queue aa935bb8a4 Merge pull request #33170 from soltysh/audit_improvements
Automatic merge from submit-queue

Remove closing audit log file and add error check when writing to audit

This picks the order fix from #33164. Additionally I've removed entirely closing the log file, since it didn't make sense where it was. I've also added error checks when actually writing to audit logs.

@sttts ptal

**1.4 justification:**

Risk: the code only runs if auditing is enabled with an apiserver flag. So the risk is low.
Rollback: nothing should depend on this
Cost: the auditing feature is broken because the impersonation filter is applied before and you might not see the proper user when using `--as` flag. Additionally no errors are logged if writing to audit fails.
2016-09-22 05:06:33 -07:00
Dr. Stefan Schimanski c727e27602 Reduce genericapiserver api surface 2016-09-22 13:43:32 +02:00
Dr. Stefan Schimanski 34365c1edd Make genericapiserver.PostStartHooks private 2016-09-22 12:38:47 +02:00
Kubernetes Submit Queue 5af04d1dd1 Merge pull request #32876 from errordeveloper/more-cert-utils
Automatic merge from submit-queue

Refactor cert utils into one pkg, add funcs from bootkube for kubeadm to use

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

We have ended-up with rather incomplete and fragmented collection of utils for handling certificates. It may be worse to consider using `cfssl` for doing all of these things, but for now there is some functionality that we need in `kubeadm` that we can borrow from bootkube. It makes sense to move the utils from bookube into core, as discussed in #31221.

**Special notes for your reviewer**: I've taken the opportunity to review names of existing funcs and tried to make some improvements in that area (with help from @peterbourgon).

**Release note**:

```release-note
NONE
```
2016-09-22 01:29:46 -07:00
Kubernetes Submit Queue e115a4282d Merge pull request #33169 from deads2k/api-12-move-groups
Automatic merge from submit-queue

move registry packages for all API groups

This continues the pattern of `registry/<group>/resource` for our backing storage.  This entire pull is nothing but moves.  I'll reswizzle the actual storage next, but these are cargo-culted everywhere, so I want to lay this down early.

@sttts @ncdc
2016-09-22 00:51:59 -07: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 c25ecc43ab Move openapi common code to genericapiserver/openapi/common 2016-09-21 17:01:54 -07:00
deads2k 561f8d75a5 move core resource registry packages 2016-09-21 10:11:50 -04:00
Maciej Szulik 5873c2679c Remove closing audit log file and add error check when writing to audit 2016-09-21 15:23:38 +02:00
Kubernetes Submit Queue 735fca1c03 Merge pull request #32622 from mbohlool/openapi
Automatic merge from submit-queue

Move generated openAPI specs out of genericapiserver and make it configurable

A follow up to #31468

Generated OpenAPI Spec does not belong to genericapiserver package. A new package "generated" created in hope of all generated codes goes into it in future. Openapi folder of that package contains generated definitions and generic API server will accept the definition map as a configuration parameter.

Reference: #13414
2016-09-20 21:42:57 -07:00
Davanum Srinivas 364dd1a752 New command line flag - Set CA file for apiserver in-process client 2016-09-20 18:59:35 -04:00
mbohlool 38b2567d8b Move generated openAPI specs out of genericapiserver and make it configurable 2016-09-20 14:06:10 -07:00
mbohlool 02e0d5ab75 Generated OpenAPI definitions 2016-09-20 14:06:09 -07:00
Kubernetes Submit Queue 2580157597 Merge pull request #33064 from lojies/spellmistake
Automatic merge from submit-queue

fix a spell mistake

**What this PR does / why we need it**:
this should be "every" not 'ever'

**Which issue this PR fixes**: 

**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-09-20 12:38:42 -07:00
Kubernetes Submit Queue 650715d231 Merge pull request #32903 from yujuhong/enable_docker_shim
Automatic merge from submit-queue

kubelet: Add a hidden flag to enable docker CRI integration for testing
2016-09-20 11:19:26 -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
lojies 5c532dc683 fix a spell mistake 2016-09-20 11:21:25 +08:00
Yu-Ju Hong 1c3c1ac514 kubelet: Add a hidden flag to enable docker CRI integration
The new flag, if specified, and if --container-runtime=docker, switches
kubelet to use the new CRI implementation for testing. This is hidden flag
since the feature is still under heavy development and the flag may be changed
in the near future.
2016-09-19 13:09:00 -07:00
deads2k 7d1f13d3e0 add GenericAPIServer posthooks for initialization 2016-09-19 14:58:27 -04:00
Ilya Dmitrichenko 386fae4592
Refactor utils that deal with certs
- merge `pkg/util/{crypto,certificates}`
- add funcs from `github.com/kubernetes-incubator/bootkube/pkg/tlsutil`
- ensure naming of funcs is fairly consistent
2016-09-19 09:03:42 +01:00
Brandon Philips 080b3d0a8c api: types: document NodeSpec ID fields
Document MachineID as the preferred field from the discussion here:
https://groups.google.com/d/msg/kubernetes-sig-node/_3mXXB1ohZs/EuYtCzHvBgAJ
2016-09-17 16:37:29 -07: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
Kubernetes Submit Queue a665002d80 Merge pull request #29684 from bprashanth/log_tun
Automatic merge from submit-queue

Change log level to reduce spam

Periodically dumping ips of all nodes in large clusters is a little spammy
2016-09-16 05:51:07 -07:00
Kubernetes Submit Queue e3f0ce2347 Merge pull request #32586 from deads2k/api-05-restrict-versions
Automatic merge from submit-queue

restrict discoverable versions to those that have resources

Prevents versions with no resources from appearing in discovery.

@soltysh ptal.  I think you have some issues for this, mind wiring them up?

```
kubectl api-versions
apps/v1alpha1
authentication.k8s.io/v1beta1
authorization.k8s.io/v1beta1
autoscaling/v1
batch/v1
certificates.k8s.io/v1alpha1
extensions/v1beta1
policy/v1alpha1
rbac.authorization.k8s.io/v1alpha1
storage.k8s.io/v1beta1
v1
```
Fixes  #29998.
2016-09-15 05:56:34 -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
deads2k 26558da40d restrict discoverable versions to those that have resources 2016-09-14 09:16:11 -04:00
Timothy St. Clair 9f3841b452 Revert "Revert "Enable v3 Client as the default on UTs""
This reverts commit 9dcef2e3cd.
2016-09-14 07:27:21 -05:00
gmarek 4f0129b023 Create a flag for route reconciliatio and deprecate unused node-sync-period one 2016-09-14 11:49:50 +02:00
Kubernetes Submit Queue e357b9a6f4 Merge pull request #32582 from jlowdermilk/api-all
Automatic merge from submit-queue

make --runtime-config=api/all=true|false work

`Passing --runtime-config=api/all=true|false to apiserver will enable/disable all registered api groups`

Previously, only api/all=false was recognized, and it only disabled groups with resources.
2016-09-13 20:27:34 -07:00
Jeff Lowdermilk e85f8d700c make --runtime-config=api/all=true|false work
Currently, only api/all=false does something (disables
all groups that have resources). Make api/all=false disable all groups
(not just those with resources), and make api/all=true enable
all groups
2016-09-13 12:03:25 -07:00
mbohlool 469c7d37f3 Generated open-api definition file 2016-09-12 23:23:59 -07:00
mbohlool 54fee8c253 Improvements on OpenAPI spec generation:
- Generating models using go2idl library (no reflection anymore)
- Remove dependencies on go-restful/swagger
- Generate one swagger.json file for each web-service
- Bugfix: fixed a bug in trie implementation
2016-09-12 18:47:03 -07:00
Kubernetes Submit Queue d06321f7fe Merge pull request #32166 from nikhiljindal/removeVar
Automatic merge from submit-queue

Remove DeprecatedStorageVersion

Its not used anymore.
Ref https://github.com/kubernetes/kubernetes/pull/24787#discussion_r61513902

cc @lavalamp @smarterclayton @deads2k
2016-09-11 04:27:11 -07:00
Maciej Szulik b19fcdce29 Fix namespace in audit logs 2016-09-09 11:43:28 +02:00
Kubernetes Submit Queue 943d7aa5aa Merge pull request #31247 from deads2k/api-03
Automatic merge from submit-queue

refactor genericapiserver new to combine initialization

Combines `New` and `init` since the two were inseparable before anyway.  `New` now has all the code to create the `GenericAPIServer`.

The rest of the change is a move.  I want to refactor the flow more, but I figured that doing it separately would simplify the review.

@sttts how do you feel about looking at this one?
2016-09-08 09:10:24 -07:00
Kubernetes Submit Queue 54243d4f1b Merge pull request #32258 from liggitt/ingress-prefix
Automatic merge from submit-queue

Pin ingresses etcd prefix for 1.3 compatibility

fixes https://github.com/kubernetes/kubernetes/issues/32255
2016-09-08 06:21:18 -07:00
deads2k b0d770ad7b refactor genericapiserver new to combine initialization 2016-09-08 08:57:10 -04:00
Kubernetes Submit Queue bf4e9e9db8 Merge pull request #31245 from deads2k/api-02
Automatic merge from submit-queue

privatize, document, and scrub GenericAPIServer

I've gone through more of the `GenericAPIServer` struct, started documenting what the fields do and privatizing ones that aren't used elsewhere or are only used by components that need some refactoring too.
2016-09-08 03:47:50 -07:00
Jordan Liggitt bd1c4e751e
Pin ingresses etcd prefix for 1.3 compatibility 2016-09-08 01:54:07 -04:00
nikhiljindal b5796dd172 Remove DeprecatedStorageVersion 2016-09-06 16:52:12 -07:00
deads2k 554ff48da2 privatize, document, and scrub GenericAPIServer 2016-08-30 09:53:33 -04:00
deads2k b1ebeffeb3 remove unnecessary fields from generic apiserver 2016-08-30 09:53:33 -04:00
PingWang d89868ba8f combine the ValidateRunOptions errors
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

replace Aggregate with []error

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

replace Aggregate with []error

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-27 15:08:57 +08:00
Daniel Smith 9dcef2e3cd Revert "Enable v3 Client as the default on UTs" 2016-08-24 13:16:40 -07:00
Timothy St. Clair 49b7ebd791 Switch UT default settings to leverage etcd3.v3client 2016-08-22 22:17:55 -05: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
Kubernetes Submit Queue a41e6e3817 Merge pull request #30922 from yifan-gu/tls_bootstrap_refactor
Automatic merge from submit-queue

Implement TLS bootstrap for kubelet using `--experimental-bootstrap-kubeconfig`  (2nd take)

Ref kubernetes/features#43 (comment)

cc @gtank @philips @mikedanese @aaronlevy @liggitt @deads2k @errordeveloper @justinsb 


Continue on the older PR https://github.com/kubernetes/kubernetes/pull/30094 as there are too many comments on that one and it's not loadable now.
2016-08-21 03:47:07 -07:00
Yifan Gu 2e631d811c crypto.go: Rename ShouldGenSelfSignedCerts() to FoundCertOrKey().
Since the function only tests whether the files are on the disk,
the original name is a little bit misleading.
2016-08-19 13:51:34 -07:00
Jeff Lowdermilk 51198f59da Add --feature-gates to kube-system components
apiserver,scheduler,controller-manager,proxy,kubelet all get
flag. Using one variable to plumb through config via salt/init
scripts for GCE and GKE
2016-08-19 09:07:43 -07:00
Kubernetes Submit Queue 5898f87722 Merge pull request #30233 from mbohlool/swagger2
Automatic merge from submit-queue

OpenAPI / Swagger2 spec generation

This is alpha version of OpenAPI spec generation. Generated "/swagger.json" file (accessible on api server) is a valid OpenAPI spec with some warnings that will be fixed in next versions of spec generation. Currently it is possible to generate a client using this spec though I did not test the clients.

reference: #13414

**Release note**:

```release-note
Alpha support for OpenAPI (aka. Swagger 2.0) specification serves on /swagger.json 
```
2016-08-19 04:21:48 -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
Clayton Coleman 12a5eeea17
Introduce GroupVersioner for capturing desired target version
Convert single GV and lists of GVs into an interface that can handle
more complex scenarios (everything internal, nothing supported). Pass
the interface down into conversion.
2016-08-18 14:45:00 -04:00
Kubernetes Submit Queue e800c391f5 Merge pull request #30050 from ping035627/ping035627-patch-0804
Automatic merge from submit-queue

Correct the url in comment and optimise the code style

The PR modified two aspects:
1) Correct the url in comment, the original url can't be accessed;
2) Optimise the code style according to the go style guide.
2016-08-17 00:53:53 -07:00
PingWang d902fd6cad correct the url in comment
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

optimise the style

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

update err define

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-16 10:41:12 +08:00
PingWang 8760ae697e implement restful for InstallLogsSupport
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

add ws.doc

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

run hack/update-swagger-spec.sh

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

update update-swagger-spec.sh

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

update apiserver_test.go

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

update comment

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-16 09:09:02 +08:00
Hongchao Deng d0938094d9 move new etcd storage into cacher 2016-08-12 18:40:20 -07:00
Maciej Szulik 24f1e1eaf6 Basic audit log 2016-08-12 12:27:19 +02:00
Xiang Li c995050ee3 apiserver: fix timeout handler
Protect access of the original writer. Panics if anything has wrote
into the original writer or the writer is hijacked when times out.
2016-08-09 12:39:40 -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
Kubernetes Submit Queue 7921a9ce67 Merge pull request #25816 from soltysh/scheduledjob_kubectl
Automatic merge from submit-queue

ScheduledJob kubectl

@erictune the last part (kubectl) of the ScheduledJob, as usual builds on top of previous PRs, so only last 2 commits matter (the kubectl one and storage leftovers).

```release-note
* Introducing ScheduledJobs as described in [the proposal](https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/scheduledjob.md) as part of `batch/v2alpha1` version (experimental feature).
```
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-08-04 17:36:07 -07:00
Kubernetes Submit Queue 0d53ef7b3b Merge pull request #29861 from xiangpengzhao/verify-secure-insecure-port-equal
Automatic merge from submit-queue

Verify if Secure and InsecurePort are equal for apiserver

If we specify the kube-apiserver flags `--secure-port` and `--insecure-port` with the same port, the server will print the below error info repeatedly. In fact, it's meaningless to do this. It should verify if the two flags are equal. If so, the server should give error info and exit directly.

```
root@vm:~# [restful] 2016/08/01 13:11:52 log.go:30: [restful/swagger] listing is available at https://172.16.1.11:8888/swaggerapi/
[restful] 2016/08/01 13:11:52 log.go:30: [restful/swagger] https://172.16.1.11:8888/swaggerui/ is mapped to folder /swagger-ui/
E0801 13:11:53.102232    2481 genericapiserver.go:733] Unable to listen for secure (listen tcp 0.0.0.0:8888: bind: address already in use); will try again.
E0801 13:12:08.116463    2481 genericapiserver.go:733] Unable to listen for secure (listen tcp 0.0.0.0:8888: bind: address already in use); will try again.
```

After fixing, the print is like this:
```
root@vm:~# F0801 11:51:44.308180    1921 genericapiserver.go:599] --secure-port and --insecure-port cannot use the same port.
goroutine 1 [running]:
k8s.io/kubernetes/vendor/github.com/golang/glog.stacks(0x4871d00, 0x0, 0x0, 0x0)
	/home/paas/zxp/code/k8s/fork/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/github.com/golang/glog/glog.go:766 +0xb8
k8s.io/kubernetes/vendor/github.com/golang/glog.(*loggingT).output(0x48517c0, 0xc800000003, 0xc820368000, 0x470aeab, 0x13, 0x257, 0x0)
	/home/paas/zxp/code/k8s/fork/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/github.com/golang/glog/glog.go:717 +0x259
k8s.io/kubernetes/vendor/github.com/golang/glog.(*loggingT).printf(0x48517c0, 0xc800000003, 0x3518280, 0x3b, 0x0, 0x0, 0x0)
	/home/paas/zxp/code/k8s/fork/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/github.com/golang/glog/glog.go:655 +0x1d4
k8s.io/kubernetes/vendor/github.com/golang/glog.Fatalf(0x3518280, 0x3b, 0x0, 0x0, 0x0)
	/home/paas/zxp/code/k8s/fork/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/github.com/golang/glog/glog.go:1145 +0x5d
k8s.io/kubernetes/pkg/genericapiserver.verifySecureAndInsecurePort(0xc820132800)
	/home/paas/zxp/code/k8s/fork/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/genericapiserver/genericapiserver.go:599 +0xad
k8s.io/kubernetes/pkg/genericapiserver.ValidateRunOptions(0xc820132800)
	/home/paas/zxp/code/k8s/fork/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/genericapiserver/genericapiserver.go:607 +0x4b
k8s.io/kubernetes/pkg/genericapiserver.DefaultAndValidateRunOptions(0xc820132800)
	/home/paas/zxp/code/k8s/fork/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/genericapiserver/genericapiserver.go:611 +0x4e
k8s.io/kubernetes/cmd/kube-apiserver/app.Run(0xc8202c9560, 0x0, 0x0)
	/home/paas/zxp/code/k8s/fork/kubernetes/_output/local/go/src/k8s.io/kubernetes/cmd/kube-apiserver/app/server.go:84 +0x8e
main.main()
	/home/paas/zxp/code/k8s/fork/kubernetes/_output/local/go/src/k8s.io/kubernetes/cmd/kube-apiserver/apiserver.go:48 +0x111

[2]+  Exit 255
```

This will fix the same issue of federation-apiserver.

cc @lavalamp @quinton-hoole
2016-08-03 23:28:50 -07:00
Kubernetes Submit Queue 15946ddd76 Merge pull request #29611 from ping035627/ping035627-patch-0726
Automatic merge from submit-queue

add DefaultServiceNodePortRange const

The PR add DefaultServiceNodePortRange const in server_run_options.go, and use it in genericapiserver.go and server_run_options.go.
2016-08-03 16:47:38 -07:00
Maciej Szulik e6c327048e Forced using batch/v2alpha1 for storing ScheduledJob 2016-08-03 17:25:37 +02:00
Kubernetes Submit Queue 24216fe02f Merge pull request #26958 from resouer/util-line
Automatic merge from submit-queue

Refactoring runner resource container linedelimiter to it's own pkg

Continuing my work ref #15634

Anyone is ok to review this fix.
2016-08-03 02:26:12 -07:00
PingWang eba0d125b9 add DefaultServiceNodePortRange const
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

update DefaultServiceNodePortRange define

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-03 12:39:46 +08:00
deads2k c30690a3bb separate out api group storage registration 2016-08-01 08:26:19 -04:00
xiangpengzhao 606feff2cb Verify if Secure and InsecurePort are equal for apiserver 2016-08-01 08:12:42 -04:00
Harry Zhang e0ab76019e Rename runnter pkg name 2016-07-29 02:37:00 -04:00
k8s-merge-robot eae90a3631 Merge pull request #26332 from resouer/util-debt
Automatic merge from submit-queue

Refactor util clock into it's own pkg

Continue my work ref #15634
2016-07-28 11:37:06 -07:00
Harry Zhang cb14b35bde Refactor util clock into it's own pkg 2016-07-28 02:29:04 -04:00
deads2k aa3db4d995 make the resource prefix in etcd configurable for cohabitation 2016-07-27 07:51:40 -04:00
Prashanth Balasubramanian 3d1805a54b Change log level to reduce spam 2016-07-25 09:25:04 -07:00
deads2k 6f7007afc5 make addition group registration easier 2016-07-25 08:23:24 -04:00
k8s-merge-robot 1784e99a1d Merge pull request #29102 from ping035627/ping035627-patch-0719
Automatic merge from submit-queue

Optimise getAPIGroupVersion function in genericapiserver.go

About the newAPIGroupVersion and the getAPIGroupVersion function  in genericapiserver.go, I think they can optimise.
2016-07-20 23:31:17 -07: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