Commit Graph

314 Commits (67cb2704c5e2f16942f4bd14cf35216148adea4c)

Author SHA1 Message Date
Kubernetes Submit Queue fa14198bb2 Merge pull request #41083 from deads2k/apiserver-02-audit
Automatic merge from submit-queue (batch tested with PRs 38796, 40823, 40756, 41083, 41105)

Add more options to the RecommendedOptions struct.

Builds on https://github.com/kubernetes/kubernetes/pull/41028

Adds `AuditOptions` to the `RecommendedOptions`

@sttts @kubernetes/sig-api-machinery-pr-reviews
2017-02-08 00:49:49 -08:00
Kubernetes Submit Queue 79e333afe0 Merge pull request #40823 from liggitt/edit-tests
Automatic merge from submit-queue (batch tested with PRs 38796, 40823, 40756, 41083, 41105)

Add unit tests for interactive edit command

Before updating edit to use unstructured objects and use generic JSON patching, we need better test coverage of the existing paths. This adds unit tests for the interactive edit scenarios. 

This PR adds:
* Simple framework for recording tests for interactive edit:
  * record.go is a tiny test server that records editor and API inputs as test expectations, and editor and API outputs as playback stubs
  * record_editor.sh is a shell script that sends the before/after of an interactive `vi` edit to the test server
  * record_testcase.sh (see README) starts up the test server, sets up a kubeconfig to proxy to the test server, sets EDITOR to invoke record_editor.sh, then opens a shell that lets you use `kubectl edit` normally
* Adds test cases for the following scenarios:
  - [x] no-op edit (open and close without making changes)
  - [x] try to edit a missing object
  - [x] edit single item successfully
  - [x] edit list of items successfully
  - [x] edit a single item, submit with an error, re-edit, submit fixed successfully
  - [x] edit list of items, submit some with errors and some good, re-edit errors, submit fixed
  - [x] edit trying to change immutable things like name/version/kind, ensure preconditions prevent submission
  - [x] edit in "create mode" successfully (`kubectl create -f ... --edit`)
  - [x] edit in "create mode" introducing errors (`kubectl create -f ... --edit`)
* Fixes a bug with edit printing errors to stdout (caught when testing stdout/stderr against expected output)

Follow-ups:
- [ ] clean up edit code path
- [ ] switch edit to use unstructured objects
- [ ] make edit fall back to jsonmerge for objects without registered go structs (TPR, unknown versions of pods, etc)
- [ ] add tests:
  - [ ] edit TPR
  - [ ] edit mix of TPR and known objects
  - [ ] edit known object with extra field from server
  - [ ] edit known object with new version from server
2017-02-08 00:49:46 -08:00
Kubernetes Submit Queue 01c45f7de1 Merge pull request #41085 from deads2k/apiserver-07-move-runtime-config
Automatic merge from submit-queue (batch tested with PRs 41061, 40888, 40664, 41020, 41085)

move --runtime-config to kubeapiserver

`--runtime-config` is only useful if you have a lot of API groups in one server.  If you have a single API group in your server (the vast majority of aggregated API servers), then the flag is unneeded and relatively complex.  This moves it to closer to point of use.

@sttts
2017-02-07 23:06:43 -08:00
Kubernetes Submit Queue bc60def8a8 Merge pull request #40664 from smarterclayton/etcd_data_wrapper
Automatic merge from submit-queue (batch tested with PRs 41061, 40888, 40664, 41020, 41085)

Allow values to be wrapped prior to serialization in etcd

This adds a new value transformer to the etcd2 store that can transform
the value from etcd on read and write. This will allow the store to
implement encryption at rest or otherwise transform the value prior to
persistence.

* [x] etcd3 store
* [x] example of transformation
* [x] partial error handling

This is in support of #12742
2017-02-07 23:06:40 -08:00
deads2k b410b387ee move storage serialization type to etcd options 2017-02-07 13:56:19 -05:00
deads2k cc75d51897 add feature enablement options to recommendedoptions 2017-02-07 13:56:19 -05:00
deads2k 226af4adc4 move --runtime-config to kubeapiserver 2017-02-07 13:43:13 -05:00
deads2k 51b5d5a51b move auditoptions to separate struct 2017-02-07 13:03:08 -05:00
deads2k cfbdbb4450 add recommended aggregated api server options 2017-02-07 12:55:39 -05:00
Kubernetes Submit Queue 42973b0523 Merge pull request #40947 from deads2k/apiserver-04-invert
Automatic merge from submit-queue (batch tested with PRs 41023, 41031, 40947)

apiserver command line options lead to config

Logically command line options lead to config, not the other way around.  We're clean enough now we can actually do the inversion.

WIP because I have some test cycles to fix, but this is all the meat.

@kubernetes/sig-api-machinery-misc
2017-02-07 09:04:41 -08:00
Kubernetes Submit Queue 03db7eac03 Merge pull request #41023 from deads2k/apiserver-05-config-move
Automatic merge from submit-queue (batch tested with PRs 41023, 41031, 40947)

move admission read logic to apiserver

Promised followup to https://github.com/kubernetes/kubernetes/pull/40943

@sttts @kubernetes/sig-api-machinery-misc
2017-02-07 09:04:38 -08:00
Kubernetes Submit Queue 3f6dd889f3 Merge pull request #40985 from p0lyn0mial/add_shortnames_to_discovery_api
Automatic merge from submit-queue (batch tested with PRs 40980, 40985)

added short names for resources which are exposed during discovery

**What this PR does / why we need it**:
The changes add short names for resources. The short names will be delivered to kubectl during discovery.
2017-02-07 06:21:10 -08:00
deads2k 250408ee9c apiserver command line options lead to config 2017-02-07 07:57:11 -05:00
deads2k 58992ce8d2 move admission read logic 2017-02-07 07:44:14 -05:00
Wojciech Tyczynski 8985c6ba4f Fix incorrect watch cache sizes 2017-02-07 09:44:31 +01:00
Kubernetes Submit Queue 821e171247 Merge pull request #35950 from nikhiljindal/nsdelreuse
Automatic merge from submit-queue

federation: Refactoring namespaced resources deletion code from kube ns controller and sharing it with fed ns controller

Ref https://github.com/kubernetes/kubernetes/issues/33612

Refactoring code in kube namespace controller to delete all resources in a namespace when the namespace is deleted. Refactored this code into a separate NamespacedResourcesDeleter class and calling it from federation namespace controller.
This is required for enabling cascading deletion of namespaced resources in federation apiserver.
Before this PR, we were directly deleting the namespaced resources and assuming that they go away immediately. With cascading deletion, we will have to wait for the corresponding controllers to first delete the resources from underlying clusters and then delete the resource from federation control plane. NamespacedResourcesDeleter has this waiting logic.

cc @kubernetes/sig-federation-misc @caesarxuchao @derekwaynecarr @mwielgus
2017-02-06 18:10:58 -08:00
p0lyn0mial b2cce0ac8e added short names for resources which are exposed during discovery 2017-02-06 23:35:07 +01:00
Kubernetes Submit Queue 44a3cd123f Merge pull request #40930 from deads2k/kubectl-01-negotiation
Automatic merge from submit-queue (batch tested with PRs 40930, 40951)

update negotiation to reflect current kubectl state

Very few things actually require negotiation, but the client-cache attempts it all the time.  If you've explicitly requested one, you still fail.  If you haven't requested one and the server doesn't have one, you still get the client behavior.  After this, if you haven't requested one and the client and server don't have one, you simply get an empty you can interpret how you choose.

@lavalamp without this, you're unable to use `kubectl` against arbitrary servers.
2017-02-06 14:27:04 -08:00
Kubernetes Submit Queue b87adb21b1 Merge pull request #40943 from deads2k/apiserver-01-admission-types
Automatic merge from submit-queue (batch tested with PRs 40943, 40967)

switch admission serialized config to an apiserver type

Switches the kube admission config from componentconfig to the new `apiserver.k8s.io` group so that all API servers can use the shared configuration.  This switch external serialization, but it does not move the code that reads the config.  I'd like to do that as a follow-on.

@kubernetes/sig-api-machinery-misc @kubernetes/api-reviewers @smarterclayton 
@derekwaynecarr ptal
@sttts
2017-02-06 12:22:54 -08:00
nikhiljindal 74676f6995 Updating federation namespace controller to share namespaced resources deletion code with kube namespace controller 2017-02-06 10:50:40 -08:00
deads2k 75841dc4f1 switch admission serialized config to an apiserver type 2017-02-06 11:38:08 -05:00
deads2k ce86ef5518 add apiserver API group for structured configuration 2017-02-06 11:22:45 -05:00
Wojciech Tyczynski f616f06764 Revert "Avoid unnecessary copies in cacher" 2017-02-06 16:50:44 +01:00
Kubernetes Submit Queue 6f37347fce Merge pull request #40931 from deads2k/owners-05-liggitt
Automatic merge from submit-queue

add liggitt to apimachinery/apiserver packages

Add @liggitt to apimachinery and apiserver packages.
2017-02-06 06:45:26 -08:00
Clayton Coleman bc4b50640b
Allow ValueTransformer to indicate resource is stale
Allows a transformer (such as an encrypter) to force an update if a new
key is in use, thus allowing simple writes to the REST layer to
trivially migrate keys.
2017-02-05 22:47:30 -05:00
Clayton Coleman 4313bc6df3
Allow values to be wrapped prior to serialization in etcd3 2017-02-05 22:47:29 -05:00
Clayton Coleman 36df93826a
Allow values to be wrapped prior to serialization in etcd2
This adds a new value transformer to the etcd2 store that can transform
the value from etcd on read and write. This will allow the store to
implement encryption at rest or otherwise transform the value prior to
persistence.
2017-02-05 22:47:29 -05:00
Kubernetes Submit Queue 2541c16692 Merge pull request #40942 from ymqytw/extract_util_from_SMPatch
Automatic merge from submit-queue (batch tested with PRs 40289, 40877, 40879, 39972, 40942)

Extract util used by jsonmergepatch and SMPatch

followup  https://github.com/kubernetes/kubernetes/pull/40666#discussion_r99198931

Extract some util out of the `strategicMergePatch` to make `jsonMergePatch` doesn't depend on `strategicMergePatch`.

```release-note
None
```

cc: @liggitt
2017-02-04 04:43:10 -08:00
Kubernetes Submit Queue b40fed9eef Merge pull request #40906 from du2016/checkAPIVersions
Automatic merge from submit-queue (batch tested with PRs 40906, 40924, 40938, 40902, 40911)

Check whether apiversions is empty

What this PR does / why we need it:
#39719 check whether apisversions get from /api is empty
Special notes for your reviewer:
@caesarxuchao
2017-02-04 03:49:50 -08:00
Jordan Liggitt af3505f53c
Add unit test framework for edit command 2017-02-04 00:11:29 -05:00
Kubernetes Submit Queue 55480054f7 Merge pull request #40894 from MHBauer/groupmetafactoryargs-doc
Automatic merge from submit-queue

GroupMetaFactoryArgs documentation

**What this PR does / why we need it**:
Documentation for people writing new API-Groups.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: documentation

**Special notes for your reviewer**:
@deads2k @pmorie my thoughts from writing the service-catalog apiserver.

**Release note**:

```release-note
NONE
```
2017-02-03 16:22:46 -08:00
ymqytw a910284e17 extract util used by jsonmergepatch and SMPatch 2017-02-03 15:28:42 -08:00
deads2k 2b5b04d074 update negotiation to reflect current kubectl state 2017-02-03 14:43:58 -05:00
deads2k 0a536544b4 add liggitt to apimachinery/apiserver packages 2017-02-03 12:24:22 -05:00
Kubernetes Submit Queue 1271802692 Merge pull request #40909 from caesarxuchao/no-vendor-apimachinery
Automatic merge from submit-queue (batch tested with PRs 40862, 40909)

Remove apimachinery from staging client-go/Godeps/Godeps.json

The publishing robot will add the latest version of apimachinery to Godeps.json.

This is part of the effort to allow update staging apimachinery and staging client-go in a same PR.

The robot change is here: https://github.com/kubernetes/test-infra/pull/1784

@deads2k @stts @lavalamp
2017-02-03 06:48:47 -08:00
Dr. Stefan Schimanski 6af3210d6f Update generated files 2017-02-03 08:15:46 +01:00
Dr. Stefan Schimanski 536460e1d9 Mechanical fixup imports: pkg/genericapiserver 2017-02-03 08:15:45 +01:00
Dr. Stefan Schimanski 03beed51d6 Mechanical move: pkg/genericapiserver -> k8s.io/apiserver 2017-02-03 07:33:43 +01:00
Dr. Stefan Schimanski 80b96b441b Mechanical import fixup: pkg/storage 2017-02-03 07:33:43 +01:00
Dr. Stefan Schimanski abe993a808 Mechanical move: pkg/storage -> k8s.io/apiserver 2017-02-03 07:33:43 +01:00
Chao Xu 13f72310c4 remove apimachinery from client-go/Godeps/Godeps.json; the publishing
robot will add the latest version of apimachinery to Godeps.json.
2017-02-02 21:36:03 -08:00
dutianpeng 4acb99df52 Check whether apiversions is empty 2017-02-03 11:33:06 +08:00
ymqytw 8aa16e09d4 support generic 3-way json merge patch 2017-02-02 15:18:44 -08:00
Morgan Bauer 1169868d7b
GroupMetaFactoryArgs documentation 2017-02-02 15:11:13 -08:00
Dr. Stefan Schimanski 812e52019c client-go: add staging/copy.sh testing 2017-02-02 20:28:33 +01:00
Dr. Stefan Schimanski abeabeb7a6 client-go: fix examples 2017-02-02 20:28:32 +01:00
Dr. Stefan Schimanski 7aebe7c079 client-go: initial examples import 2017-02-02 20:28:32 +01:00
Kubernetes Submit Queue 62c9cb4684 Merge pull request #40853 from sttts/sttts-more-cutoffs-7
Automatic merge from submit-queue (batch tested with PRs 35782, 35831, 39279, 40853, 40867)

genericapiserver: cut off more dependencies – episode 7

Follow-up of https://github.com/kubernetes/kubernetes/pull/40822

approved based on #40363
2017-02-02 09:53:52 -08:00
Kubernetes Submit Queue 70c97b2c28 Merge pull request #40810 from deads2k/generic-37-generic-validation
Automatic merge from submit-queue (batch tested with PRs 40810, 40695)

move genericvalidation to apimachinery

Moves genericvalidation to apimachinery.  The first commit shows the snip I made.

@sttts
2017-02-02 08:07:47 -08:00
Dr. Stefan Schimanski 1834013f3e pkg/genericapiserver/registry/generic/registry: cut off pkg/api dependency 2017-02-02 15:17:34 +01:00