Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Revert "Refactor dyamic cache to use namespaced informers"
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Foo <[email protected]>
  • Loading branch information
GuessWhoSamFoo authored and Sam Foo committed Jun 16, 2021
1 parent b803286 commit e3252fc
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 191 deletions.
6 changes: 3 additions & 3 deletions internal/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import (
type ClientInterface interface {
DefaultNamespace() string
ResourceExists(schema.GroupVersionResource) bool
Resource(schema.GroupVersionKind) (schema.GroupVersionResource, bool, error)
Resource(schema.GroupKind) (schema.GroupVersionResource, bool, error)
ResetMapper()
KubernetesClient() (kubernetes.Interface, error)
DynamicClient() (dynamic.Interface, error)
Expand Down Expand Up @@ -169,8 +169,8 @@ func (c *Cluster) ResourceExists(gvr schema.GroupVersionResource) bool {
return err == nil
}

func (c *Cluster) Resource(gvk schema.GroupVersionKind) (schema.GroupVersionResource, bool, error) {
restMapping, err := c.restMapper.RESTMapping(gvk.GroupKind(), gvk.Version)
func (c *Cluster) Resource(gk schema.GroupKind) (schema.GroupVersionResource, bool, error) {
restMapping, err := c.restMapper.RESTMapping(gk)
if err != nil {
return schema.GroupVersionResource{}, false, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cluster/fake/mock_client_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion internal/describer/crd_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type DefaultCRDWatcher struct {
var _ config.CRDWatcher = (*DefaultCRDWatcher)(nil)

// NewDefaultCRDWatcher creates an instance of DefaultCRDWatcher.
func NewDefaultCRDWatcher(_ context.Context, clusterClient cluster.ClientInterface, objectStore store.Store, errorStore oerrors.ErrorStore) (*DefaultCRDWatcher, error) {
func NewDefaultCRDWatcher(ctx context.Context, clusterClient cluster.ClientInterface, objectStore store.Store, errorStore oerrors.ErrorStore) (*DefaultCRDWatcher, error) {
if objectStore == nil {
return nil, errors.New("object store is nil")
}
Expand All @@ -62,6 +62,7 @@ var (
// Watch watches for CRDs given a configuration.
func (cw *DefaultCRDWatcher) Watch(ctx context.Context) error {
logger := log.From(ctx)

handler := &kcache.ResourceEventHandlerFuncs{
AddFunc: func(object interface{}) {
cw.mu.Lock()
Expand Down
1 change: 1 addition & 0 deletions internal/describer/describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func LoadObjects(ctx context.Context, objectStore store.Store, errorStore oerror
if name, ok := fields["name"]; ok && name != "" {
objectStoreKey.Name = name
}

storedObjects, _, err := objectStore.List(ctx, objectStoreKey)
if err != nil {
var ae *oerrors.AccessError
Expand Down
Loading

0 comments on commit e3252fc

Please sign in to comment.