Skip to content

Commit f10a6b5

Browse files
Rename fileter.go to objectutil.go
Signed-off-by: varshaprasad96 <[email protected]>
1 parent 6a42f89 commit f10a6b5

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

pkg/cache/multi_namespace_cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
type NewCacheFunc func(config *rest.Config, opts Options) (Cache, error)
3737

3838
// a new global namespaced cache to handle cluster scoped resources
39-
var globalCache = "cluster-scope"
39+
var globalCache = "_cluster-scope"
4040

4141
// MultiNamespacedCacheBuilder - Builder function to create a new multi-namespaced cache.
4242
// This will scope the cache to a list of namespaces. Listing for all namespaces
@@ -135,7 +135,7 @@ func (c *multiNamespaceCache) IndexField(ctx context.Context, obj client.Object,
135135
}
136136

137137
func (c *multiNamespaceCache) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error {
138-
isNamespaced, err := objectutil.IsNamespacedObject(obj, c.Scheme, c.RESTMapper)
138+
isNamespaced, err := objectutil.IsAPINamespaced(obj, c.Scheme, c.RESTMapper)
139139
if err != nil {
140140
return err
141141
}
@@ -158,7 +158,7 @@ func (c *multiNamespaceCache) List(ctx context.Context, list client.ObjectList,
158158
listOpts := client.ListOptions{}
159159
listOpts.ApplyOptions(opts)
160160

161-
isNamespaced, err := objectutil.IsNamespacedObject(list, c.Scheme, c.RESTMapper)
161+
isNamespaced, err := objectutil.IsAPINamespaced(list, c.Scheme, c.RESTMapper)
162162
if err != nil {
163163
return err
164164
}

pkg/client/namespaced_client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func (n *namespacedClient) RESTMapper() meta.RESTMapper {
5757

5858
// isNamespaced returns true if the object is namespace scoped.
5959
// For unstructured objects the gvk is found from the object itself.
60+
// TODO: this is repetitive code. Remove this and use ojectutil.IsNamespaced.
6061
func isNamespaced(c Client, obj runtime.Object) (bool, error) {
6162
var gvk schema.GroupVersionKind
6263
var err error

pkg/internal/objectutil/filter.go renamed to pkg/internal/objectutil/objectutil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ func FilterWithLabels(objs []runtime.Object, labelSel labels.Selector) ([]runtim
4848
return outItems, nil
4949
}
5050

51-
// IsNamespacedObject returns true if the object is namespace scoped.
51+
// IsAPINamespaced returns true if the object is namespace scoped.
5252
// For unstructured objects the gvk is found from the object itself.
53-
func IsNamespacedObject(obj runtime.Object, scheme *runtime.Scheme, restmapper apimeta.RESTMapper) (bool, error) {
53+
func IsAPINamespaced(obj runtime.Object, scheme *runtime.Scheme, restmapper apimeta.RESTMapper) (bool, error) {
5454
var gvk schema.GroupVersionKind
5555
var err error
5656

0 commit comments

Comments
 (0)