From 94a2664cd38b0f2a5c283599439dae9acb8cb4bd Mon Sep 17 00:00:00 2001 From: wojtekt Date: Thu, 15 Aug 2019 22:02:33 +0200 Subject: [PATCH] Implement support for CacheableObject Kubernetes-commit: 970f103e2c079da98743db35e38fd411a64e2e04 --- pkg/endpoints/discovery/util.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/endpoints/discovery/util.go b/pkg/endpoints/discovery/util.go index fa63b19d2..2411a780d 100644 --- a/pkg/endpoints/discovery/util.go +++ b/pkg/endpoints/discovery/util.go @@ -64,6 +64,13 @@ func identifier(e runtime.Encoder) runtime.Identifier { } func (c stripVersionEncoder) Encode(obj runtime.Object, w io.Writer) error { + if co, ok := obj.(runtime.CacheableObject); ok { + return co.CacheEncode(c.Identifier(), c.doEncode, w) + } + return c.doEncode(obj, w) +} + +func (c stripVersionEncoder) doEncode(obj runtime.Object, w io.Writer) error { buf := bytes.NewBuffer([]byte{}) err := c.encoder.Encode(obj, buf) if err != nil {