Commit Graph

285 Commits (5981aa8b377b792676daceeee3a793a19121a184)

Author SHA1 Message Date
jianhuiz 494129b089 add generated files 2016-08-22 23:00:23 -07:00
Quintin Lee 19c0c676d8 Adding imagepolicy group non-autogenerated code. 2016-08-17 12:25:42 -07:00
Daniel Smith bd7d7cc02a changes to generators 2016-08-11 17:06:54 -07:00
Daniel Smith f1fd638962 fix register.go files up + add test import 2016-08-11 17:06:54 -07:00
Daniel Smith d7e4028437 modify generators 2016-08-10 16:55:05 -07:00
bindata-mockuser d1a37f5ce2 Simplify canonical element term in deepcopy 2016-08-10 09:07:40 +02: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
Timothy St. Clair 24993b0343 Update generated files due to dependency shift.
Also minor bug fix in federation api.
2016-08-09 10:41:09 -05: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
deads2k 32920b5617 add subjectaccessreviews resource 2016-08-05 11:20:56 -04:00
Tim St. Clair f4ce5583c2
Adjust verbosity levels of go2idl logging 2016-08-04 22:01:35 -07:00
deads2k d50506345c fix String protobuf generator 2016-08-03 08:37:45 -04:00
deads2k 60dd4a5d26 interesting changes to add tokenreviews endpoint to implement webhook 2016-08-03 08:37:45 -04:00
Chao Xu 81858d755e add validateListType to pkg/api/meta/schema_test.go 2016-08-02 15:47:24 -07:00
jianhuiz 41b409b24e support included-types-overrides without version provided (group/type) 2016-07-21 14:00:35 -07:00
Wojciech Tyczynski 4d0d115690 Revert "add tokenreviews endpoint to implement webhook" 2016-07-21 09:40:35 +02:00
deads2k 2256c6e619 fix String protobuf generator 2016-07-20 15:11:57 -04:00
deads2k 2c4a9f2e8d interesting changes to add tokenreviews endpoint to implement webhook 2016-07-20 15:11:56 -04:00
k8s-merge-robot a3ce4513ad Merge pull request #28934 from smarterclayton/optional_slice
Automatic merge from submit-queue

Unable to have optional message slice

When making a message slice optional, we need to handle one more
conditional case in the rewriter.

@wojtek-t
2016-07-19 12:55:19 -07:00
Davanum Srinivas 2b0ed014b7 Use Go canonical import paths
Add canonical imports only in existing doc.go files.
https://golang.org/doc/go1.4#canonicalimports

Fixes #29014
2016-07-16 13:48:21 -04:00
k8s-merge-robot 5844145795 Merge pull request #28815 from smarterclayton/fix_stringer
Automatic merge from submit-queue

Generate a better Stringer method for proto types

This replaces the bad string output generated by golang/proto with gogo/protobuf stringer generation. Makes the output similar to %#v and more debuggable. We have to have a String() method to implement proto.Message, so this is strictly better.

@wojtek-t, @thockin for after your PR merges

Fixes #28756
2016-07-15 05:49:40 -07:00
k8s-merge-robot ff998ab566 Merge pull request #28810 from smarterclayton/keep_proto_name
Automatic merge from submit-queue

Allow proto tag to define field name

When we introduce a new field for backwards compatibility, we may want
to specify a different protobuf field name (one that matches JSON) than
the automatic transformation applied to the struct field. This allows an
API field to define the name of its protobuf tag.

@wojtek-t hit this while adding protobuf to OpenShift - we have fields we
keep for backward compatibility that need to be assigned a field by name.
Has no impact on existing (already tagged) fields.
2016-07-15 03:17:33 -07:00
Clayton Coleman 8c17b48824
Generate gogo stringer instead of proto stringer
Similar to %#v.
2016-07-14 12:43:33 -04:00
k8s-merge-robot bea382c124 Merge pull request #28932 from smarterclayton/fix_protobuf_error
Automatic merge from submit-queue

Fail correctly in go-to-protobuf

We need to return earlier.

@wojtek-t
2016-07-14 09:09:42 -07:00
Clayton Coleman 0d26c2efd4
Unable to have optional message slice
When making a message slice optional, we need to handle one more
conditional case in the rewriter.
2016-07-13 23:10:44 -04:00
Clayton Coleman c55f47c4c9
Fail correctly in go-to-protobuf
We need to return earlier.
2016-07-13 23:02:45 -04:00
Clayton Coleman f5975afc06
genconversion=false should skip fields during conversion generation
Currently it only skips if the fields don't match, but that leaves no
way for callers to say "no really, ignore this field".
2016-07-13 22:20:40 -04:00
k8s-merge-robot 6b6141f812 Merge pull request #28820 from caesarxuchao/patch-subresource
Automatic merge from submit-queue

[client-gen] Allow passing subresources in Patch method

Expand the Patch() method from:
```
Patch(name string, pt api.PatchType, data []byte)
```
to
```
Patch(name string, pt api.PatchType, data []byte, subresources ...string)
```

Continue on #27293. Fixes #26580.

cc @Random-Liu @lavalamp
2016-07-13 16:09:01 -07:00
Wojciech Tyczynski 16bf8c4008 Unify logging in generators and avoid annoying logs. 2016-07-13 15:06:44 +02:00
Tim Hockin 9dd337d119 s/deep_copy/deepcopy/
Just a naming nit that was too hard to fixup-and-rebase.
2016-07-12 21:52:54 -07:00
Tim Hockin 58441e8775 Don't check in generated deep-copy code
This mostly takes the previously checked in files and removes them, and moves
the generation to be on-demand instead of manual.  Manually verified no change
in generated output.
2016-07-12 21:52:54 -07:00
k8s-merge-robot 708e753c72 Merge pull request #28679 from sttts/sttts-deepcopy-pointer-in
Automatic merge from submit-queue

Deepcopy: avoid struct copies and reflection Call

- make signature of generated deepcopy methods symmetric with `in *type, out *type`, avoiding copies of big structs on the stack
- switch to `in interface{}, out interface{}` which allows us to call them with without `reflect.Call`

The first change reduces runtime of BenchmarkPodCopy-4 from `> 3500ns` to around `2300ns`.

The second change reduces runtime to around `1900ns`.
2016-07-12 21:45:43 -07:00
Chao Xu c2fb39102b generated changes 2016-07-12 11:09:28 -07:00
Chao Xu dc2e12d2f8 manual changes to patch subresource 2016-07-12 11:09:27 -07:00
Dr. Stefan Schimanski 61cde63622 Switch to typeless generated deepcopy functions for less reflection 2016-07-12 18:05:43 +02:00
Dr. Stefan Schimanski 6049623a13 Turn first deepcopy parameter into a pointer 2016-07-12 18:05:43 +02:00
Clayton Coleman 68bfba29b9
Allow proto tag to define field name
When we introduce a new field for backwards compatibility, we may want
to specify a different protobuf field name (one that matches JSON) than
the automatic transformation applied to the struct field. This allows an
API field to define the name of its protobuf tag.
2016-07-11 22:14:20 -04:00
Clayton Coleman 29046db6ff
Name check for go-to-protobuf in wrong spot 2016-07-08 11:31:39 -04:00
Tim Hockin 355794c303 Log errors or fail if conversion fail to generate
This fixes PodSpec to generate cleanly.  No other types only half-generate (so
now we Fatalf), though several fail to generate at all (only Errorf for now).
2016-07-07 22:09:08 -07:00
Tim Hockin f63f168b51 Comment and simplify a bit of conversion
There are ample opportunities to optimize and streamline here.  For example,
there's no reason to have a function to convert IntStr to IntStr. Removing the
function does generate the right assignment, but it is unclear whether the
registered function is needed or not.  I opted to leave it alone for now.
Another example is Convert_Slice_byte_To_Slice_byte, which just seems silly.
2016-07-07 22:09:08 -07:00
Tim Hockin 291b51ec50 Use file tags to generate conversions
This drives conversion generation from file tags like:
  // +conversion-gen=k8s.io/my/internal/version
.. rather than hardcoded lists of packages.

The only net change in generated code can be explained as correct.  Previously
it didn't know that conversion was available.
2016-07-07 22:09:08 -07:00
Tim Hockin 80490e0a55 go2idl: Allow generators to AddDir() at runtime
This is used subsequently to simplify the conversion generation, so each
package can declare what peer-packages it uses, and have those imported
dynamically, rather than having one mega list of packages to import and not
really being clear why, for any given list item.
2016-07-07 22:09:08 -07:00
Tim Hockin 7fa1e87d66 Simplify convertible check - same type is OK
This is to clarify the code.  No actual effect at the moment, but I manually
verified this in the case of identical types.
2016-07-07 22:09:08 -07:00
Tim Hockin ed59210f04 Renames for clarity in conversion-gen
This is to clarify the intent of the code for new readers (me).
2016-07-07 22:09:08 -07:00
Tim Hockin ab16ccc158 go2idl: don't mutate a map being iterated
This was causing us to process packages we didn't really want, which was only
visible when debugging was enabled.
2016-07-07 22:09:08 -07:00
Tim Hockin 96c0284e91 go2idl: clarify comments wrt get-or-create
This is just comment clarity.
2016-07-07 22:09:08 -07:00
Tim Hockin 82b2d2c87b Clarify copyable vs in-bounds
This make it clearer where "is copyable" is needed and where "is in bounds" is
needed.  No effect on generated code.
2016-07-07 16:49:46 -07:00
Tim Hockin 1ba6f5df9e go2idl: Allow ... pkg specs
This is closer to standard Go semantics and obsoletes our custom --recursive
flag.
2016-07-07 16:49:46 -07:00
Tim Hockin dc10f10e48 Recreate the opt-in/opt-out logic for deepcopy
This is the last piece of Clayton's #26179 to be implemented with file tags.
All diffs are accounted for.  Followup will use this to streamline some
packages.

Also add some V(5) debugging - it was helpful in diagnosing various issues, it
may be helpful again.
2016-07-07 16:49:46 -07:00
Tim Hockin 28af54138d Use file tags to generate deep-copies
This drives most of the logic of deep-copy generation from tags like:
  // +deepcopy-gen=package
..rather than hardcoded lists of packages.  This will make it possible to
subsequently generate code ONLY for packages that need it *right now*, rather
than all of them always.

Also remove pkgs that really do not need deep-copies (no symbols used
anywhere).
2016-07-07 16:49:46 -07:00