Skip to content

Commit 8100b57

Browse files
committed
🐛 Unconditionally set NegotiatedSerializer
We currently only set the NegotiatedSerializer when there is none set yet. Unfortunately, various things will break if someone sets their own in the rest config, hence always set it.
1 parent 386c2b5 commit 8100b57

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pkg/client/apiutil/apimachinery.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,12 @@ func createRestConfig(gvk schema.GroupVersionKind, isUnstructured bool, baseConf
158158
protobufSchemeLock.RUnlock()
159159
}
160160

161-
if cfg.NegotiatedSerializer == nil {
162-
if isUnstructured {
163-
// If the object is unstructured, we need to preserve the GVK information.
164-
// Use our own custom serializer.
165-
cfg.NegotiatedSerializer = serializerWithDecodedGVK{serializer.WithoutConversionCodecFactory{CodecFactory: codecs}}
166-
} else {
167-
cfg.NegotiatedSerializer = serializerWithTargetZeroingDecode{NegotiatedSerializer: serializer.WithoutConversionCodecFactory{CodecFactory: codecs}}
168-
}
161+
if isUnstructured {
162+
// If the object is unstructured, we need to preserve the GVK information.
163+
// Use our own custom serializer.
164+
cfg.NegotiatedSerializer = serializerWithDecodedGVK{serializer.WithoutConversionCodecFactory{CodecFactory: codecs}}
165+
} else {
166+
cfg.NegotiatedSerializer = serializerWithTargetZeroingDecode{NegotiatedSerializer: serializer.WithoutConversionCodecFactory{CodecFactory: codecs}}
169167
}
170168

171169
return cfg

0 commit comments

Comments
 (0)