Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non Watched Namespace Labeled selectors #515

Open
wants to merge 106 commits into
base: main
Choose a base branch
from
Open

Conversation

jackstine
Copy link
Contributor

@jackstine jackstine commented Aug 18, 2022

Adding expression label filters to non-watched namespaces.

  1. if watchNamespaces is empty and ExpressionSelector is empty
    • Select all resources in all namespaces
  2. If watchNamespaces is set and ExpressionSelector is empty
    • Select all resources in the watchNamespaces
  3. If watchNamespaces is empty and ExpressionSelector is not empty
    • Select all namespaces that fit the labels criteria in the ExpressionSelector
      • Watch and List all resources in these namespaces
    • Watch all new namespaces,
      • If a namespace is created that fits the criteria in the ExpressionSelector
        • watch and list all resources in that namespace
  4. If watchNamespaces is set and ExpressionSelector is set

@jackstine jackstine changed the title Labeled selectors Non Watched Namespace Labeled selectors Aug 19, 2022
Comment on lines +163 to +167
rc.namespaceLock.Lock()
rc.namespaceWhitelist = append(rc.namespaceWhitelist, namespace)
rc.namespaceLock.Unlock()
return nil
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we consider getting rid of this white list?

Comment on lines +107 to +109
// Note it might be best to use this as a Singleton instead of a Structure
// if a Singleton suggestion is proposed, then Register will no long be needed,
// and we can just use Register New Namespace. Also this would clear up some mutexes, that are being used.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to consider this idea, or at least consider registering and starting the resource client factory on NewFunction()?

Comment on lines +346 to +348
for _, ns := range missingNamespaces {
mockResourceChan <- mockResourceListWithNamespace{list: MockResourceList{}, namespace: ns}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a namespace is deleted, this causes the namespace to be empty. The entry in the map is never deleted. I think this is fine.

Deleting the entry would require a RemoveRegisteredNamespace() for the clients, and a deletion from the Kube-Controller. Since this was never handled originally, I think this is fine. Since clients make upgrades as well, I think this is fine as too.

@jackstine
Copy link
Contributor Author

adding this closed PR solo-io/gloo#7097

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fine-grained selector for watched CRs
6 participants