Skip to content

Commit

Permalink
fix(client): support custom negotiated serializer
Browse files Browse the repository at this point in the history
The Kubernetes client allows for users to configure a serializer which
is used to encode and decode resources exchanged with the Kubernetes API
server.

This changeset modifies the controller-runtime client to only set the
default serializer if the NegotiatedSerializer option is nil.

Signed-off-by: Terin Stock <terin@cloudflare.com>
  • Loading branch information
terinjokes committed Apr 3, 2019
1 parent 90226f9 commit 7f0fb8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/client/apiutil/apimachinery.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ func GVKForObject(obj runtime.Object, scheme *runtime.Scheme) (schema.GroupVersi
// with the given GroupVersionKind.
func RESTClientForGVK(gvk schema.GroupVersionKind, baseConfig *rest.Config, codecs serializer.CodecFactory) (rest.Interface, error) {
cfg := createRestConfig(gvk, baseConfig)
cfg.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: codecs}
if cfg.NegotiatedSerializer == nil {
cfg.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: codecs}
}
return rest.RESTClientFor(cfg)
}

Expand Down

0 comments on commit 7f0fb8f

Please sign in to comment.