File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -136,3 +136,32 @@ func NewClusterAwareMapperProvider(c *rest.Config) (meta.RESTMapper, error) {
136
136
137
137
return apiutil .NewDynamicRESTMapper (mapperCfg )
138
138
}
139
+
140
+ // ClusterAwareBuilderWithOptions returns a cluster aware Cache constructor that will build
141
+ // a cache honoring the options argument, this is useful to specify options like
142
+ // SelectorsByObject
143
+ // WARNING: If SelectorsByObject is specified, filtered out resources are not
144
+ // returned.
145
+ // WARNING: If UnsafeDisableDeepCopy is enabled, you must DeepCopy any object
146
+ // returned from cache get/list before mutating it.
147
+ func ClusterAwareBuilderWithOptions (options cache.Options ) cache.NewCacheFunc {
148
+ return func (config * rest.Config , opts cache.Options ) (cache.Cache , error ) {
149
+ if options .Scheme == nil {
150
+ options .Scheme = opts .Scheme
151
+ }
152
+ if options .Mapper == nil {
153
+ options .Mapper = opts .Mapper
154
+ }
155
+ if options .Resync == nil {
156
+ options .Resync = opts .Resync
157
+ }
158
+ if options .Namespace == "" {
159
+ options .Namespace = opts .Namespace
160
+ }
161
+ if opts .Resync == nil {
162
+ opts .Resync = options .Resync
163
+ }
164
+
165
+ return NewClusterAwareCache (config , options )
166
+ }
167
+ }
You can’t perform that action at this time.
0 commit comments