@@ -19,13 +19,13 @@ package client
1919import (
2020 "context"
2121
22+ "k8s.io/apimachinery/pkg/api/meta"
2223 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2324 "k8s.io/apimachinery/pkg/runtime"
2425)
2526
2627// NewDelegatingClientInput encapsulates the input parameters to create a new delegating client.
2728type NewDelegatingClientInput struct {
28- Scheme * runtime.Scheme
2929 CacheReader Reader
3030 Client Client
3131}
@@ -37,7 +37,8 @@ type NewDelegatingClientInput struct {
3737// cache and writes to the API server.
3838func NewDelegatingClient (in NewDelegatingClientInput ) Client {
3939 return & delegatingClient {
40- scheme : in .Scheme ,
40+ scheme : in .Client .Scheme (),
41+ mapper : in .Client .RESTMapper (),
4142 Reader : & delegatingReader {
4243 CacheReader : in .CacheReader ,
4344 ClientReader : in .Client ,
@@ -53,13 +54,19 @@ type delegatingClient struct {
5354 StatusClient
5455
5556 scheme * runtime.Scheme
57+ mapper meta.RESTMapper
5658}
5759
5860// Scheme returns the scheme this client is using.
5961func (d * delegatingClient ) Scheme () * runtime.Scheme {
6062 return d .scheme
6163}
6264
65+ // RESTMapper returns the rest mapper this client is using.
66+ func (d * delegatingClient ) RESTMapper () meta.RESTMapper {
67+ return d .mapper
68+ }
69+
6370// delegatingReader forms a Reader that will cause Get and List requests for
6471// unstructured types to use the ClientReader while requests for any other type
6572// of object with use the CacheReader. This avoids accidentally caching the
0 commit comments