-
Notifications
You must be signed in to change notification settings - Fork 719
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
unable to get: x/y because of unknown namespace for the cache #4168
Comments
This message comes from the multi-namespace cache in controller runtime. Any user running ECK in restricted mode with access to only a subset of namespaces will run into this. So it seems that the controllers get the events for edits on all instances of our CRDs no matter whether they are inside one of the relevant namespaces. We could implement our own Predicate that filters out any event for irrelevant namespaces. Also I wonder if this is something we should raise as an issue against controller runtime. |
I would appreciate this being filtered out by default - it causes a large amount of noise which makes other issues more difficult to identify. |
Just to add some context and explain what is happening (it took me a moment to get it): this issue happens iif the following 2 conditions are met:
In that particular case we add an empty namespace ( log.Info("Operator configured to manage multiple namespaces", "namespaces", managedNamespaces, "operator_namespace", operatorNamespace)
// The managed cache should always include the operator namespace so that we can work with operator-internal resources.
managedNamespaces = append(managedNamespaces, operatorNamespace)
// Add the empty namespace to allow watching cluster-scoped resources if storage class validation is enabled.
if viper.GetBool(operator.ValidateStorageClassFlag) {
managedNamespaces = append(managedNamespaces, "")
}
opts.NewCache = cache.MultiNamespacedCacheBuilder(managedNamespaces) The operator then watches all the resources on the cluster (even the ones which are not managed) while the Note the odd entry |
Note that kubernetes-sigs/controller-runtime#244 is solved thanks to kubernetes-sigs/controller-runtime#1435 and kubernetes-sigs/controller-runtime#1602. |
kubernetes-sigs/controller-runtime#1435 introduced // New constructs a brand new cluster.
func New(config *rest.Config, opts ...Option) (Cluster, error) {
...
options := Options{}
for _, opt := range opts {
opt(&options)
}
options = setOptionsDefaults(options)
...
// Create the cache for the cached read client and registering informers
cache, err := options.NewCache(config, cache.Options{Scheme: options.Scheme, Mapper: mapper, Resync: options.SyncPeriod, Namespace: options.Namespace})
if err != nil {
return nil, err
} 🤔 |
I observed this error in our e2e tests, it seems to be harmless but it makes the logs harder to read and I think we should understand where it comes from:
The text was updated successfully, but these errors were encountered: