ExtractList should handle v1.RawExtension correctly

Also fixes CustomColumnPrinter to pass decoder in, and ensures a test
case tests the combined path.
This commit is contained in:
Clayton Coleman
2016-01-27 14:14:27 -05:00
parent 738eae88f8
commit 71a13f7f4b
6 changed files with 56 additions and 15 deletions

View File

@@ -72,12 +72,17 @@ func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
for i := range list {
raw := items.Index(i)
switch item := raw.Interface().(type) {
case runtime.RawExtension:
switch {
case item.Object != nil:
list[i] = item.Object
case item.RawJSON != nil:
list[i] = &runtime.Unknown{RawJSON: item.RawJSON}
default:
list[i] = nil
}
case runtime.Object:
list[i] = item
case runtime.RawExtension:
list[i] = &runtime.Unknown{
RawJSON: item.RawJSON,
}
default:
var found bool
if list[i], found = raw.Addr().Interface().(runtime.Object); !found {