Skip to content

fix: build a cluster-wide cache when watching all namespaces - #2124

Open
Kitio-Tek wants to merge 1 commit into
Altinity:0.28.0from
Kitio-Tek:cache-namespace-all-cluster-wide
Open

Kitio-Tek wants to merge 1 commit into
Altinity:0.28.0from
Kitio-Tek:cache-namespace-all-cluster-wide

Conversation

@Kitio-Tek

Copy link
Copy Markdown

Fixes #2117

With watch.namespaces unset, GetCacheNamespaces() returns [""] and newCacheNamespaces() (cmd/operator/app/init_retry.go) turns it into DefaultNamespaces{"": {}}. controller-runtime v0.18.7 builds a multi-namespace cache whenever DefaultNamespaces has an entry, and its List returns "unknown namespace for the cache" for any namespace that isn't a key. Get falls back to the "" cache but List doesn't, so the CHK discovery lists fail in every namespace.

This makes newCacheNamespaces() return nil when the only entry is NamespaceAll, so cache.New builds one cluster-wide cache. The keeper and backup managers both use the helper. Named namespaces and the regexp fallback don't change.

TestCacheOptionsWatchAllNamespacesBuildsClusterWideCache fails on 0.28.0 and passes with the fix.

cc @alex-zaitsev

With watch.namespaces unset, GetCacheNamespaces returns only
NamespaceAll, and newCacheNamespaces turned that into a single "" key
in cache.Options.DefaultNamespaces. controller-runtime v0.18 builds a
multi-namespace cache whenever DefaultNamespaces has an entry, and its
List rejects any namespace that is not a key, so every namespaced list
in CHK discovery failed with "unknown namespace for the cache".

Return nil for NamespaceAll alone, so the keeper and backup managers
get one cluster-wide cache.

Signed-off-by: Myrian Koumgang <kmyriantek@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant