GoogleCloudPlatform/kubernetes — pull request #1239 by lavalamp (2014-09-09 20:55:01+00:00)
Title: Proposal for solving api plugability

Note that this is just a sketch and lacks test and not all details are implemented. That said, this proposal:

* In the conversion package, expose Src/Dest struct tags to conversionFuncs via the Scope.
* In runtime, add "RawExtension" which just stores raw JSON (or yaml?) for deferred unpacking.
* In runtime, add global named Schemes.
* In runtime, add to the DefaultScheme conversionFuncs which convert between RawExtension and EmbeddedObject. They use a struct tag on the *internal* structure to determine which scheme to use. They use a struct tag on the external versioned structure to determine what object version to emit.
* As an example of how this would look in practice, the VolumeSource field is updated to use this mechanism.

I think this is easy, readable, extensible, and will emit the JSON that we want.