Commit Graph

142 Commits (bb460c04ddb25245906e80ec5e42ee5675782c92)

Author SHA1 Message Date
Muhammed Uluyol ab83ad2e4b Update documentation for deep copy functions 2015-07-27 16:47:41 -07:00
Mike Danese 2906f85227 allow conversions.Scheme to expose intermidiate versioned api object 2015-06-25 11:53:17 -07:00
Rodolfo Carvalho b216d09a8d Fix typo 2015-06-04 11:44:10 +02:00
Wojciech Tyczynski 33318f0162 Use generated DeepCopy methods. 2015-05-28 09:03:27 +02:00
Wojciech Tyczynski b2280db724 Deep-copy functions autogeneration. 2015-05-26 21:16:26 +02:00
feihujiang d36173e855 Check json format firstly
Check json format firstly

check json format firstly

check json format firstly
2015-05-18 10:44:29 +08:00
Wojciech Tyczynski e1d9694558 Remove gob 2015-05-15 13:44:37 +02:00
Victor Marmol 8bc3e5121f Merge pull request #8188 from krousey/deep_copy
Changing the implementation of DeepCopy to use reflection
2015-05-14 18:25:30 -07:00
Kris Rousey 4d031abc16 Changing the implementation of DeepCopy to use reflection instead of Gob encode/decode. 2015-05-14 13:46:31 -07:00
Wojciech Tyczynski b00020884c DeepCopy benchmarks 2015-05-14 09:43:21 +02:00
Wojciech Tyczynski 5578dc99e3 Improvements for conversions generator 2015-05-11 12:21:11 +02:00
Cesar Wong 619332d58e Utility to convert versioned runtime objects to a set query parameters
JSON struct tags are used as parameter names, fields that do not have
the omitempty marker are always included.
2015-05-07 14:25:14 -04:00
Wojciech Tyczynski 156795f298 Update conversion functions 2015-05-07 09:27:58 +02:00
Wojciech Tyczynski 5173ee07e1 Chain conversion functions while generation 2015-05-07 09:27:58 +02:00
Wojciech Tyczynski d4b32a8371 Support both manual and generate conversions 2015-05-06 16:43:15 +02:00
deads2k 0d796c184d fix DeepCopy to properly support runtime.EmbeddedObject 2015-05-05 10:36:39 -04:00
Wojciech Tyczynski e225a2e777 Merge pull request #7644 from liggitt/conversion_test
Output generated conversion functions/names
2015-05-04 08:17:03 +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 1a8845af61 Merge pull request #7490 from smarterclayton/alter_list
Do not automatically decode runtime.RawExtension
2015-05-01 16:48:26 -04:00
Jordan Liggitt 26caf9e0de Output generated conversion functions/names 2015-05-01 16:28:08 -04:00
Clayton Coleman 32dfd3e07b Correct the capitalization of KubeProxyVersion 2015-04-30 15:43:14 -04:00
Wojciech Tyczynski 3b84bae544 Auto-generated conversion not manually edited 2015-04-30 14:05:42 +02: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 8eca76298f Improvements to conversions generator. 2015-04-29 16:32:31 +02:00
Wojciech Tyczynski 922555f048 Improvements to generator of conversion methods. 2015-04-27 13:33:38 +02:00
Wojciech Tyczynski 7f919a44c2 Generate conversions for v1beta3 package. 2015-04-24 09:18:12 +02:00
Wojciech Tyczynski c4a27f5c0f Generating conversion methods. 2015-04-23 18:26:24 +02:00
Wojciech Tyczynski 7e2724e14b Avoid benchmarks from being optimized 2015-04-23 08:57:29 +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
Clayton Coleman f95cc2b8f2 Reuse gob.Encoder and Decoder in DeepCopy 2015-04-13 13:52:38 -04:00
Daniel Smith 395d69641e fix race 2015-04-10 16:02:51 -07:00
Daniel Smith f591873af7 Add DeepCopy! Also-- optimize conversion for []byte 2015-04-10 13:26:46 -07:00
Daniel Smith 2c93080373 Fix licensing for forked code. 2015-04-03 17:06:24 -07:00
Tim Hockin c63f4c71ba Remove dead, buggy code 2015-04-01 21:25:49 -07:00
Tim Hockin b07ed62910 Fix deep equal to not panic on bad slice lengths
Also test it more throughly and test DeepDerivative.
2015-03-26 11:47:30 -07: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
Clayton Coleman 6918a4d32e Replace automatic YAML decoding with opt-in YAML decoding
Base codecs no longer automically handle YAML.  Instead, clients
must convert to JSON first via yaml.ToJSON and runtime.YAMLDecoder.
2015-03-20 00:03:56 -04:00
Daniel Smith 3ef3777192 Make unexported fields panic (informatively)
...Also fix some incorrect calls to semantic.DeepEqual, and a bug where
it returned true incorrectly.
2015-03-05 21:40:37 -08:00
Brendan Burns 877f605dc0 Add specific errors for missing kind and version. 2015-02-26 11:19:04 -08:00
Andy Goldstein 5bd0e9ab05 Add streaming command execution & port forwarding
Add streaming command execution & port forwarding via HTTP connection
upgrades (currently using SPDY).
2015-02-20 09:57:02 -05:00
Yu-Ju Hong 4a72addaeb Factor out API defaulting from validation logic
Currently, the validation logic validates fields in an object and supply default
values wherever applies. This change factors out defaulting to a set of
defaulting callback functions for decoding (see #1502 for more discussion).

 * This change is based on pull request 2587.

 * Most defaulting has been migrated to defaults.go where the defaulting
   functions are added.

 * validation_test.go and converter_test.go have been adapted to not testing the
   default values.

 * Fixed all tests with that create invalid objects with the absence of
   defaulting logic.
2015-02-03 00:55:42 -08:00
Tim Hockin 1ddb68d8d7 Sketch: a third take on defaulting values 2015-02-02 22:35:58 -08:00
Daniel Smith 37f5a9df07 make conversion do deep copies 2015-01-15 12:02:22 -08:00
Joe Beda dcd00c936e Move all kubernetes to posix flags 2015-01-15 09:12:19 -08:00
Clayton Coleman 8f65442c2f Client should not include ns/ for non-namespaced calls in v1beta3 2015-01-08 12:44:07 -05:00
Daniel Smith 0d628b3bff Make semantic deep equal public feature
* Use semantic deep equal when validating
* More test cases for deep equal
2015-01-07 15:21:34 -08:00
Clayton Coleman 3b5c3ec786 Merge pull request #3220 from lavalamp/deepEqual
Add *useful* DeepEqual
2015-01-07 14:24:26 -05:00
Jordan Liggitt 2da1865fc2 Make default conversion behavior available to conversion funcs 2015-01-06 13:38:57 -05:00
Daniel Smith f0b7743402 Add useful DeepEqual 2015-01-05 10:37:50 -08:00
Clayton Coleman 7fde4583f2 v1beta1 should return Minion as kind, rather than Node
This changes the internal name logic (for conversion) to prefer the
internal registered preferred name for a resource, and then makes
v1beta1 and v1beta2 prefer Minion.

Fixes #3010
2014-12-17 19:55:56 -05:00
Daniel Smith f3148e9965 Fix taking addr() of map value/key 2014-12-12 15:26:17 -08:00
Daniel Smith f81ec248d0 Merge pull request #2786 from smarterclayton/load_opaque_objects
Allow runtime.Object to be encoded as runtime.RawExtension
2014-12-10 16:24:05 -08:00
Clayton Coleman 279df03377 Allow mismatched type names on all conversions
Allows v1beta3.Node to be converted to api.Minion
2014-12-10 11:48:41 -05:00
Daniel Smith 3c1d51b19d refactor to hide structs behind an interface 2014-12-08 17:12:40 -08:00
Daniel Smith 564c087062 produce more readable error messages 2014-12-08 17:12:38 -08:00
Daniel Smith 77521a33d3 Add stack of previous values to converter 2014-12-08 17:12:07 -08:00
Clayton Coleman dd24b013cb Use if err := ; err != nil instead of two lines 2014-12-07 20:48:16 -05:00
Clayton Coleman 84d84c50c2 Add a strongly typed error for unrecognized kind/type/version 2014-12-07 20:48:16 -05:00
Jordan Liggitt 22eee15fe7 Remove uint64 bitshift workaround 2014-12-04 15:00:23 -08:00
Sam Ghods 6399854240 Remove unused YAML tags and GetYAML/SetYAML methods
Unneeded after move to ghodss/yaml.
2014-12-02 16:25:28 -08:00
Sam Ghods 9a9a1e0939 Move from go-yaml/yaml to ghodss/yaml 2014-12-02 16:24:05 -08:00
Daniel Smith f1c21c8fdf add boilerplate reduction struct field copier 2014-11-24 12:57:34 -08:00
Tim Hockin 95a9098311 fix 'go vet' warnings 2014-11-21 09:45:28 +08:00
Tim Hockin ea960711ff Clean up error logs.
Use %v for errors, tidy some messages, make error messages start lowe-case
(as per go guidelines).  Just accumulated nits.
2014-11-21 09:45:26 +08:00
Clayton Coleman 811f77894c Not having Kind set in Decode(1) is an error 2014-11-18 20:22:05 -05:00
Clayton Coleman 9f15e96bd6 Better logging when a type is invalid during conversion 2014-11-10 11:33:31 -05:00
Clayton Coleman ad92ff6952 When explicitly converting two objects, allow names to differ 2014-11-10 11:33:31 -05:00
Clayton Coleman 778a50d00b Introduce ObjectConvertor for conversion to known API versions
Will allow clients to transform internal objects to a version
suitable for external output.
2014-11-04 10:34:15 -05:00
Daniel Smith 94e736e286 Merge pull request #2009 from smarterclayton/unify_meta
Unify Accessor for ObjectMeta/TypeMeta/ListMeta
2014-10-29 09:58:46 -07:00
Vojtech Vitek (V-Teq) 90809c270d Use conversion.EnforcePtr() where appropriate
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
2014-10-28 16:36:09 +01:00
Vojtech Vitek (V-Teq) 8969f0df7e Handle nil values in conversion.EnforcePtr()
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
2014-10-28 16:36:04 +01:00
Vojtech Vitek (V-Teq) 6a6f24b126 Fix reflect panic in runtime/conversion
Fixes `panic: reflect: call of reflect.Value.Type on zero Value`
when calling conversion.EnforcePtr() or
runtime.Scheme.ObjectVersionAndKind() from default type switch.

Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
2014-10-27 06:01:14 +01:00
Clayton Coleman 52b582271b Typo in conversion Godoc 2014-10-26 22:21:11 -04:00
Clayton Coleman bc748fadfa Whitespace and old comment removal 2014-10-24 11:22:21 -04:00
Vojtech Vitek (V-Teq) 755d4d441a Fix typos 2014-10-21 18:57:20 +02:00
Daniel Smith 71126e79d1 Don't accept empty input in DecodeInto 2014-10-16 13:38:18 -07:00
Clayton Coleman 13992837ea Use one copy of EnforcePtr 2014-10-13 23:29:39 -04:00
Clayton Coleman d488e238dd Genericize MetaInsertionFactory into a simpler interface
The common path code for MIF goes through a conversion cycle - it
can also be done through reflection. This simplifies the Create/Update
methods into Interpret (return version) and Update (through reflection).

In addition it uses only one MetaFactory implementation across all of
our packages which reduces a bit of duplication.
2014-10-13 23:29:39 -04:00
Clayton Coleman 96f0c37a31 Allow multiple names to resolve to a type in a Scheme
Allows decoding multiple names into a single type, necessary for
v1beta3 (rename of Minion -> Node)
2014-10-09 17:14:55 -04:00
Clayton Coleman 338ee1e458 Add additional debugging output on mistyped conversion 2014-10-07 14:09:01 -04:00
Clayton Coleman 305db35422 Add a Log method on Scheme for better debugging 2014-10-05 17:17:25 -04:00
Clayton Coleman 61e3ce7ddc Make runtime less global for Codec
* Make Codec separate from Scheme
* Move EncodeOrDie off Scheme to take a Codec
* Make Copy work without a Codec
* Create a "latest" package that imports all versions and
  sets global defaults for "most recent encoding"
  * v1beta1 is the current "latest", v1beta2 exists
  * Kill DefaultCodec, replace it with "latest.Codec"
  * This updates the client and etcd to store the latest known version
* EmbeddedObject is per schema and per package now
* Move runtime.DefaultScheme to api.Scheme
* Split out WatchEvent since it's not an API object today, treat it
like a special object in api
* Kill DefaultResourceVersioner, instead place it on "latest" (as the
  package that understands all packages)
* Move objDiff to runtime.ObjectDiff
2014-09-16 16:26:43 -04:00
Daniel Smith b8c955ea17 Fixes:
* Fix kubecfg test, which was writing an internal object straight to yaml
* Address review comments
2014-09-15 13:15:46 -07:00
Daniel Smith 71e547124c Make needed changes in conversion package to support pluggability 2014-09-15 13:15:46 -07:00
Daniel Smith 0c6adde92e Change conversion package so that AddKnownTypes takes pointers. 2014-09-07 22:19:24 -07:00
Daniel Smith 2ba6503511 Add continuation to conversion routines 2014-09-07 22:19:24 -07:00
Vojtech Vitek (V-Teq) 59f58cd043 Unify Godoc formatting, fix various typos
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
2014-09-02 13:41:03 +02:00
Paul Morie c69160059b Change CreationTimestamp to a util.Time and set in each storage implementation
Because time.Time doesn't work correctly with our YAML package, it is necessary
to introduce a type, util.Time, which serializes correctly to JSON and YAML.

Eventually we would like timestamping to cut across storage implementations;
for now, we set it in each storage.
2014-08-14 16:26:29 -04:00
Daniel Smith 079c9043bd Switch to new external fuzz package 2014-08-08 15:54:09 -07:00
Daniel Smith 1cc7fce523 Add documentation and tests to conversion. 2014-08-01 14:26:36 -07:00
Daniel Smith a73e4f4623 Separate generic parts of api library into conversion package. 2014-08-01 14:25:42 -07:00