Skip to content

Commit f549afb

Browse files
committed
Remove UntypedListObjectWrapper for now
Signed-off-by: Igor Suleymanov <[email protected]>
1 parent 18aca36 commit f549afb

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

k8s/negotiator.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,8 @@ func (*GenericJSONDecoder) Decode(
106106
}
107107

108108
return into, defaults, nil
109-
case chk.Items != nil: // Fallback to UntypedList
110-
l := &UntypedListObjectWrapper{}
111-
if err := json.Unmarshal(data, l); err != nil {
112-
logging.DefaultLogger.Error("error unmarshalling into *k8s.UntypedListObjectWrapper", "error", err)
113-
return into, defaults, fmt.Errorf("error unmarshalling into *k8s.UntypedListObjectWrapper: %w", err)
114-
}
115-
116-
l.items = data
117-
into = l
109+
case chk.Items != nil: // TODO: the codecs don't know how to handle lists yet.
110+
return nil, nil, fmt.Errorf("unsupported list object")
118111
case chk.Kind != "": // Fallback to UntypedObject
119112
o := &UntypedObjectWrapper{}
120113
if err := json.Unmarshal(data, o); err != nil {

k8s/wrappers.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,6 @@ func (o *UntypedObjectWrapper) Into(into resource.Object, codec resource.Codec)
7070
return codec.Read(bytes.NewReader(o.object), into)
7171
}
7272

73-
// UntypedListObjectWrapper wraps a list of UntypedObjectWrappers, and implements runtime.Object
74-
type UntypedListObjectWrapper struct {
75-
metav1.TypeMeta `json:",inline"`
76-
metav1.ListMeta `json:"metadata"`
77-
items json.RawMessage
78-
}
79-
80-
// DeepCopyObject copies the object
81-
func (o *UntypedListObjectWrapper) DeepCopyObject() runtime.Object {
82-
val := reflect.ValueOf(o).Elem()
83-
84-
cpy := reflect.New(val.Type())
85-
cpy.Elem().Set(val)
86-
87-
// Using the <obj>, <ok> for the type conversion ensures that it doesn't panic if it can't be converted
88-
if obj, ok := cpy.Interface().(runtime.Object); ok {
89-
return obj
90-
}
91-
92-
return nil
93-
}
94-
9573
// UntypedWatchObject implements runtime.Object, and keeps the Object part of a kubernetes watch event as bytes
9674
// when unmarshaled, so that it can later be marshaled into a concrete type with Into().
9775
type UntypedWatchObject struct {

0 commit comments

Comments
 (0)