Skip to content

Commit aa2b3e6

Browse files
authored
Merge pull request #1700 from iawia002/cherry-pick-1664-release-0.9
🐛 [release-0.9] Unconditionally set NegotiatedSerializer
2 parents 2d2f85f + 96e131b commit aa2b3e6

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
@@ -157,14 +157,12 @@ func createRestConfig(gvk schema.GroupVersionKind, isUnstructured bool, baseConf
157157
protobufSchemeLock.RUnlock()
158158
}
159159

160-
if cfg.NegotiatedSerializer == nil {
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 = serializer.WithoutConversionCodecFactory{CodecFactory: codecs}
167-
}
160+
if isUnstructured {
161+
// If the object is unstructured, we need to preserve the GVK information.
162+
// Use our own custom serializer.
163+
cfg.NegotiatedSerializer = serializerWithDecodedGVK{serializer.WithoutConversionCodecFactory{CodecFactory: codecs}}
164+
} else {
165+
cfg.NegotiatedSerializer = serializer.WithoutConversionCodecFactory{CodecFactory: codecs}
168166
}
169167

170168
return cfg

0 commit comments

Comments
 (0)