You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: "RawExtension is used to hold extensions in external versions.\n\nTo use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.\n\n// Internal package: type MyAPIObject struct {\n\truntime.TypeMeta `json:\",inline\"`\n\tMyPlugin runtime.Object `json:\"myPlugin\"`\n} type PluginA struct {\n\tAOption string `json:\"aOption\"`\n}\n\n// External package: type MyAPIObject struct {\n\truntime.TypeMeta `json:\",inline\"`\n\tMyPlugin runtime.RawExtension `json:\"myPlugin\"`\n} type PluginA struct {\n\tAOption string `json:\"aOption\"`\n}\n\n// On the wire, the JSON will look something like this: {\n\t\"kind\":\"MyAPIObject\",\n\t\"apiVersion\":\"v1\",\n\t\"myPlugin\": {\n\t\t\"kind\":\"PluginA\",\n\t\t\"aOption\":\"foo\",\n\t},\n}\n\nSo what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)",
11056
+
Properties: map[string]spec.Schema{
11057
+
"Raw": {
11058
+
SchemaProps: spec.SchemaProps{
11059
+
Description: "Raw is the underlying serialization of this object.",
11060
+
Type: []string{"string"},
11061
+
Format: "byte",
11062
+
},
11063
+
},
11064
+
},
11065
+
Required: []string{"Raw"},
11066
+
},
11067
+
},
11068
+
Dependencies: []string{},
11069
+
},
11070
+
"k8s.io/apimachinery/pkg/runtime.TypeMeta": {
11071
+
Schema: spec.Schema{
11072
+
SchemaProps: spec.SchemaProps{
11073
+
Description: "TypeMeta is shared by all top level objects. The proper way to use it is to inline it in your type, like this: type MyAwesomeAPIObject struct {\n runtime.TypeMeta `json:\",inline\"`\n ... // other fields\n} func (obj *MyAwesomeAPIObject) SetGroupVersionKind(gvk *metav1.GroupVersionKind) { metav1.UpdateTypeMeta(obj,gvk) }; GroupVersionKind() *GroupVersionKind\n\nTypeMeta is provided here for convenience. You may use it directly from this package or define your own with the same fields.",
11074
+
Properties: map[string]spec.Schema{
11075
+
"apiVersion": {
11076
+
SchemaProps: spec.SchemaProps{
11077
+
Type: []string{"string"},
11078
+
Format: "",
11079
+
},
11080
+
},
11081
+
"kind": {
11082
+
SchemaProps: spec.SchemaProps{
11083
+
Type: []string{"string"},
11084
+
Format: "",
11085
+
},
11086
+
},
11087
+
},
11088
+
},
11089
+
},
11090
+
Dependencies: []string{},
11091
+
},
11092
+
"k8s.io/apimachinery/pkg/runtime.Unknown": {
11093
+
Schema: spec.Schema{
11094
+
SchemaProps: spec.SchemaProps{
11095
+
Description: "Unknown allows api objects with unknown types to be passed-through. This can be used to deal with the API objects from a plug-in. Unknown objects still have functioning TypeMeta features-- kind, version, etc. metadata and field mutatation.",
11096
+
Properties: map[string]spec.Schema{
11097
+
"apiVersion": {
11098
+
SchemaProps: spec.SchemaProps{
11099
+
Type: []string{"string"},
11100
+
Format: "",
11101
+
},
11102
+
},
11103
+
"kind": {
11104
+
SchemaProps: spec.SchemaProps{
11105
+
Type: []string{"string"},
11106
+
Format: "",
11107
+
},
11108
+
},
11109
+
"Raw": {
11110
+
SchemaProps: spec.SchemaProps{
11111
+
Description: "Raw will hold the complete serialized object which couldn't be matched with a registered type. Most likely, nothing should be done with this except for passing it through the system.",
11112
+
Type: []string{"string"},
11113
+
Format: "byte",
11114
+
},
11115
+
},
11116
+
"ContentEncoding": {
11117
+
SchemaProps: spec.SchemaProps{
11118
+
Description: "ContentEncoding is encoding used to encode 'Raw' data. Unspecified means no encoding.",
11119
+
Type: []string{"string"},
11120
+
Format: "",
11121
+
},
11122
+
},
11123
+
"ContentType": {
11124
+
SchemaProps: spec.SchemaProps{
11125
+
Description: "ContentType is serialization method used to serialize 'Raw'. Unspecified means ContentTypeJSON.",
0 commit comments