Commit Graph

270 Commits (361b99bfddf9928f24255843914d7458d8488a3a)

Author SHA1 Message Date
Clayton Coleman 12d7032c39
Encoding nested objects must support unregistered runtime.Objects
The nested object could be using a different scheme, or want to handle
runtime.Unknown.
2016-08-18 14:45:40 -04:00
Clayton Coleman 5f8366aac3
Convert() should accept the new conversion Context value
Allows Convert() to reuse the same conversions as ConvertToVersion
without being overly coupled to the version.
2016-08-18 14:45:20 -04:00
Clayton Coleman ce57455de6
Allow objects to serialize their nested objects
Introduce an optional interface for callers to encode themselves.
2016-08-18 14:45:01 -04: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
Kris 361f13ddf0 Add JSON encoding handlers to unstructured objects 2016-08-15 22:07:53 -07:00
Kris 69e0740b93 Properly decode lists into VersionedObjects 2016-08-15 14:18:40 -07:00
Daniel Smith f1fd638962 fix register.go files up + add test import 2016-08-11 17:06:54 -07:00
Daniel Smith caed8d85f4 add scheme builder 2016-08-11 13:18:26 -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 4d2350632c only store typeMeta and objectMeta in the gc store 2016-08-08 17:23:13 -07:00
pweil- f51c1301f2 add asserts for RecognizingDecoder and update protobuf serializer to implement interface 2016-08-03 17:26:31 -04:00
k8s-merge-robot fa174bcdaf Merge pull request #29042 from dims/fixup-imports
Automatic merge from submit-queue

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-18 07:23:38 -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
Tim Hockin 3384e03920 Commit generated files
There's been enough people broken by not committing generated code, that we
should undo that until we have a proper client that is `go get` compatible.

This is temporary.
2016-07-15 10:27:51 -07:00
k8s-merge-robot 0af6d321e8 Merge pull request #28935 from smarterclayton/avoid_double_encode
Automatic merge from submit-queue

Don't double encode protobuf runtime.Unknown

When using runtime.Object and runtime.RawExtension, passing
runtime.Unknown to protobuf serializer should result in the raw message
being serialized (since all normal protobuf objects are
runtime.Unknown).

Also, avoid setting a content-type when decoding a protobuf object
except when the content appears to be proto.

@wojtek-t
2016-07-15 07:43:09 -07:00
Clayton Coleman b9845e7cb5
Don't double encode protobuf runtime.Unknown
When using runtime.Object and runtime.RawExtension, passing
runtime.Unknown to protobuf serializer should result in the raw message
being serialized (since all normal protobuf objects are
runtime.Unknown).

Also, avoid setting a content-type when decoding a protobuf object
except when the content appears to be proto.
2016-07-14 13:09:16 -04:00
Clayton Coleman 866e788aba
generate: New Stringers 2016-07-14 12:43:36 -04:00
k8s-merge-robot ae990defcf Merge pull request #26956 from joe2far/fix-typos
Automatic merge from submit-queue

Fixed several typos
2016-07-14 04:13:15 -07:00
Michael Taufen d3f3bedbb7 Fix typo in pkg/runtime/serializer/codec_factory.go 2016-07-13 10:41:02 -07:00
joe2far 5ead89b5bb Fixed several typos 2016-07-13 15:06:24 +01: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
Dr. Stefan Schimanski 629b25daf9 Run hack/update-all.sh 2016-07-12 20:36:48 +02:00
Dr. Stefan Schimanski 61cde63622 Switch to typeless generated deepcopy functions for less reflection 2016-07-12 18:05:43 +02:00
Tim Hockin 51394e862d Make runtime opt in to deepcopy
This minimizes the number of functions generated.  It also breaks the chain of
symbol dependencies to pkg/conversion, so we can remove now-unreferenced
(previously unused but referenced) conversion deep-copies.
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
Tim Hockin e18b2f3a2e Revert Clayton's #26179 so I can recreate it
His PR cam during the middle of this development cycle, and it was easier to
burn it down and recreate it than try to patch it into an existing series and
re-test every assumption.  This behavior will be re-introduced in subsequent
commits.
2016-07-07 16:49:46 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Clayton Coleman 36a5ffbe2f
Remove EncodeToStream(..., []unversioned.GroupVersion)
Was not being used.
2016-06-10 18:43:12 -04:00
Clayton Coleman e1dc3ef933
Remove unused deep_copies 2016-06-06 17:18:22 -04:00
Clayton Coleman 0181ac61da
DeepCopy should only generate types in k8s.io/kubernetes
Also make generation more selective (require opt in) to prevent lots of
unnecessary generated deep copies.
2016-06-06 17:18:22 -04:00
k8s-merge-robot cf234ab67d Merge pull request #26251 from caesarxuchao/add-serializer
Automatic merge from submit-queue

Add direct serializer

Fix #25589. Implemented a direct codec that doesn't do conversion, but sets the group, version and kind before serialization as Clayton suggested [here](https://github.com/kubernetes/kubernetes/issues/25589#issuecomment-219168009).

First commit is cherry-picked from #24826.

@kubernetes/sig-api-machinery
2016-06-01 23:31:47 -07:00
gmarek 778b1df717 Add Controller to api/meta 2016-05-31 20:21:05 +02:00
Chao Xu f32f3966d6 add DirectCodec; use it in release_1_3 clientset 2016-05-31 10:14:24 -07:00
k8s-merge-robot 14a6fb7d0f Merge pull request #26018 from gyuho/slice_append
Automatic merge from submit-queue

pkg/runtime: preallocate slice in unstructured.go
2016-05-29 07:20:50 -07:00
k8s-merge-robot e543bd6452 Merge pull request #26007 from smarterclayton/watch_opt
Automatic merge from submit-queue

Additional optimizations to the encode/decode paths

Builds on top of #25983 with a number of other optimizations.
2016-05-28 06:27:00 -07:00
Gyu-Ho Lee c3fc714ec2 pkg/runtime: preallocate slice in unstructured.go
To avoid slice growth when appending.
2016-05-27 14:54:25 -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
Clayton Coleman c6961d6fd6
Remove runtime.Typer, reduce to ObjectKinds(1) (3)
Remove the unnecessary variants, which avoids allocations in several
core paths.
2016-05-21 23:55:42 -04:00
Clayton Coleman a9c3edc613
Avoid allocating an array for EncodeToVersion 2016-05-21 23:55:41 -04:00
k8s-merge-robot c05c1d24ae Merge pull request #25540 from krousey/discovery_mapper
Automatic merge from submit-queue

Adding support objects for integrating dynamic client the kubectl builder

Kubectl will try to decode into `runtime.VersionedObjects`, so the `UnstructuredJSONScheme` needs to handle that intelligently.

Kubectl's builder also needs a `meta.RESTMapper` and `runtime.Typer`. The `meta.RESTMapper` requires a `runtime.ObjectConvertor` (spelling?) that works with `runtime.Unstructured`. The mapper and typer required discovery info, so I just put that in the kubectl util package since it didn't really seem to fit anywhere else. 

Subsequent PRs will be using these in kubectl.

cc @kubernetes/sig-api-machinery @smarterclayton @liggitt @lavalamp
2016-05-21 07:13:49 -07:00
Kris db515f47bd Provide a dumb ObjectConverter for Unstructured 2016-05-16 12:43:39 -07:00
Chao Xu c73406bcfe the garbage collector controller 2016-05-15 16:04:19 -07:00
Kris 6cd2fa6b42 Make unstructured scheme aware of VersionedObjects
UnstructuredJSONScheme now handles decoding into VersionedObjects
properly by decoding into Unstructured and putting it in the object list.
2016-05-13 14:04:39 -07:00
Jeff Lowdermilk 1616239b4a Merge pull request #25436 from smarterclayton/defend_proto
Add a defensive sanity check to protobuf marshal
2016-05-13 10:45:58 -07:00
Clayton Coleman ea7e7a18cb
Create a new method UnsafeConvertToVersion for faster convert
Only encode/decode will call this path, to allow us to optimize for
unsafe operations.
2016-05-12 10:10:35 -04:00
Clayton Coleman 51b624103f
Change ConvertToVersion to use GroupVersion
Long delayed refactor, avoids a few more allocations.
2016-05-12 10:10:35 -04:00
Clayton Coleman a84e62d9e6
Change ObjectKind signature to avoid allocations
We don't need to pass a pointer into SetGroupKindVersion() - a
struct works just as well.
2016-05-12 10:10:35 -04:00
Clayton Coleman bffbc112f0
Remove src and dest version - they are not used (now)
We will probably readd these as an opaque object passed down to
conversions that lets the caller get access to more info (like
a negotiated serializer).
2016-05-12 10:10:35 -04:00
Ed Robinson afdbad078a
Corrects some misspellings in comments
This should help to make
https://goreportcard.com/report/k8s.io/kubernetes#misspell
look a little nicer.
2016-05-11 08:16:13 +01:00