Implement support for CacheableObject

Kubernetes-commit: 970f103e2c079da98743db35e38fd411a64e2e04
This commit is contained in:
wojtekt 2019-08-15 22:02:33 +02:00 committed by Kubernetes Publisher
parent f186d58ea0
commit 94a2664cd3
1 changed files with 7 additions and 0 deletions

View File

@ -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 {