Commit Graph

77 Commits

Author SHA1 Message Date
Clayton Coleman
35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Clayton Coleman
051382687d
Unversioned types should decode no matter what the requested version is
Status is exposed as v1 in the current schema (so all groups are
returning v1.Status).  However, if you give a codec only "mygroup"
"myversion", it will fail to convert Status to v1. For now, unversioned
types should be allowed to be projected into all group versions, and
when we add the server group we'll rip out the unversioned concept
entirely.
2016-11-01 22:55:59 -04:00
Clayton Coleman
68a9983ec7
Add a new Default() method on Scheme
Allow defaulter functions to be registered with the scheme.
2016-10-18 21:07:32 -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
Chao Xu
4d2350632c only store typeMeta and objectMeta in the gc store 2016-08-08 17:23:13 -07:00
Dr. Stefan Schimanski
61cde63622 Switch to typeless generated deepcopy functions for less reflection 2016-07-12 18:05:43 +02:00
David McMahon
ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -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
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
Clayton Coleman
236925be87
Avoid allocations and a reflect.Call in conversion
reflect.Call is fairly expensive, performing 8 allocations and having to
set up a call stack. Using a fairly straightforward to generate switch
statement, we can bypass that early in conversion (as long as the
function takes responsibility for invocation). We may also be able to
avoid an allocation for the conversion scope, but not positive yet.

```
benchmark                    old ns/op     new ns/op     delta
BenchmarkPodConversion-8     14713         12173         -17.26%

benchmark                    old allocs     new allocs     delta
BenchmarkPodConversion-8     80             72             -10.00%

benchmark                    old bytes     new bytes     delta
BenchmarkPodConversion-8     9133          8712          -4.61%
```
2016-04-26 16:42:12 -04:00
k8s-merge-robot
c3a962bff5 Merge pull request #20351 from krousey/dynamic_client
Auto commit by PR queue bot
2016-02-19 10:00:54 -08:00
laushinka
7ef585be22 Spelling fixes inspired by github.com/client9/misspell 2016-02-18 06:58:05 +07:00
Kris
4c58302b5b Adding dynamic client 2016-02-12 11:49:00 -08:00
Clayton Coleman
60b66665e1 Move conversion.Scheme to runtime
There is only one type registry to rule them all
2016-01-30 14:12:40 -05:00
Clayton Coleman
63a7a41ddf Simplify Codec and split responsibilities
Break Codec into two general purpose interfaces, Encoder and Decoder,
and move parameter codec responsibilities to ParameterCodec.

Make unversioned types explicit when registering - these types go
through conversion without modification.

Switch to use "__internal" instead of "" to represent the internal
version. Future commits will also add group defaulting (so that "" is
expanded internally into a known group version, and only cleared during
set).

For embedded types like runtime.Object -> runtime.RawExtension, put the
responsibility on the caller of Decode/Encode to handle transformation
into destination serialization. Future commits will expand RawExtension
and Unknown to accept a content encoding as well as bytes.

Make Unknown a bit more powerful and use it to carry unrecognized types.
2016-01-21 23:18:32 -05:00
k8s-merge-robot
266ab4a796 Merge pull request #18487 from smarterclayton/guard_encode_decode
Auto commit by PR queue bot
2015-12-13 23:08:18 -08:00
Clayton Coleman
1e21054134 Hide common codec methods under helpers
The pending codec -> conversion split changes the signature of
Encode and Decode to be more complicated. Create a stub helper
with the exact semantics of today and do the simple mechanical
refactor here to reduce the cost of that change.
2015-12-09 21:15:02 -05:00
deads2k
519b4e80d1 update NewObject for groupversionkind 2015-12-09 08:13:15 -05:00
deads2k
f764e0099c Update ObjectTyper to GroupVersion 2015-12-07 08:35:05 -05:00
deads2k
ed95a6d77f update scheme to use GroupVersion 2015-11-25 12:15:48 -05:00
deads2k
68b0572974 internal versions 2015-11-25 12:14:06 -05:00
deads2k
6231404682 update decoder to use GroupVersion 2015-11-25 12:14:06 -05:00
Wojciech Tyczynski
d7b098b0e9 Add DecodeParametersInto method to Codec. 2015-11-18 09:56:04 +01:00
feihujiang
eac8d6a997 Cleanup the content of deprecated V1beta1 2015-11-06 13:42:51 +08:00
Brendan Burns
8998219686 Add a method for encoding directly to a io.Writer and use it for HTTPx 2015-09-24 15:52:09 -07:00
Marek Grabowski
5f9cefc1d8 Merge pull request #12441 from vlajos/typofixes-vlajos-20150807
typofix - https://github.com/vlajos/misspell_fixer
2015-08-10 16:33:52 +02:00
Veres Lajos
9f77e49109 typofix - https://github.com/vlajos/misspell_fixer 2015-08-08 22:31:48 +01:00
Kris Rousey
6e64a63a84 Adding a way to decode to a specified version.
This is largely needed as a way to get a versioned client without
requiring everyone to switch to versioned types at once.
2015-08-07 14:16:24 -07:00
Mike Danese
8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
Chao Xu
664d20c572 Add DecodeIntoWithSpecifiedVersionKind() to Decoder interface.
The function validate/default the body with the passed in apiVersion and Kind.
It's called in createHandler and UpdateResource
2015-08-03 15:30:00 -07:00
Clayton Coleman
6970dda54e Use runtime.Copier instead of hardcoding api.Scheme
Allow other schemes to be supported by etcd_helper.go

runtime.Scheme.Copy() should be using the built in DeepCopy()
2015-06-26 14:50:33 -04:00
Daniel Smith
47294dd326 Revert "Revert "Test Service creation -> endpoint generation latency""
This reverts commit 654857114e.
2015-06-11 18:34:31 -07:00
Brendan Burns
654857114e Revert "Test Service creation -> endpoint generation latency" 2015-06-09 21:24:00 -07:00
Daniel Smith
aa9bdcbc4a add missing endpoints field label conversion function 2015-06-08 16:23:21 -07:00
Wojciech Tyczynski
b2280db724 Deep-copy functions autogeneration. 2015-05-26 21:16:26 +02:00
Eric Paris
6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Clayton Coleman
12ba4e2452 Do not automatically decode runtime.RawExtension
Make clients opt in to decoding objects that are stored
in the generic api.List object by invoking runtime.DecodeList()
with a set of schemes. Makes it easier to handle unknown
schema objects because decoding is in the control of the code.

Add runtime.Unstructured, which is a simple in memory
representation of an external object.
2015-04-29 12:53:07 -04:00
Wojciech Tyczynski
7f919a44c2 Generate conversions for v1beta3 package. 2015-04-24 09:18:12 +02:00
Wojciech Tyczynski
ea314d55f7 Create benchmarks for conversions. 2015-04-22 16:27:23 +02:00
Clayton Coleman
545a5a865f List output with differing types should be more resilient
kubectl get can output a series of objects as a List in versioned
form, but not all API objects are available in the same schema.
Make the act of converting a []runtime.Object to api.List more
robust and add a test to verify its behavior in Get.

Makes it easier for client code to output unified objects.
2015-04-20 14:44:16 -04:00
Prashanth Balasubramanian
a7864aa230 Scheduler uses TTLStore for assumed pods 2015-04-08 15:01:04 -07:00
Clayton Coleman
1618c39a46 Convert List query parameters via object conversion
Convert url.Values -> an object, with appropriate versioning. ListOptions
should also expose parameter names to swagger.
2015-03-27 15:03:57 -04:00
Clayton Coleman
ea32b89e5e Allow map[string][]string to be converted to an object
Will allow query parameters to be converted to versioned objects.
2015-03-24 17:25:45 -04:00
nikhiljindal
790a8bbd23 Adding conversion functions for event field selectors 2015-03-12 14:10:51 -07:00
Daniel Smith
1fdf749211 fix e2e failure 2015-03-02 15:03:56 -08:00
Daniel Smith
c4822dc060 Revert "Revert "Adding converter functions to convert field label selectors to internal version before matching""
This reverts commit 5f35a67002.
2015-03-02 15:00:09 -08:00
Zach Loafman
5f35a67002 Revert "Adding converter functions to convert field label selectors to internal version before matching" 2015-02-28 11:42:49 -08:00