From 88a8c2b1a7ea58083c2b34fcabe5a4cf0accfe69 Mon Sep 17 00:00:00 2001 From: Miles Garnsey Date: Wed, 22 May 2024 19:17:56 +1000 Subject: [PATCH] Changelog, better loop for setting default namespaces. --- CHANGELOG/CHANGELOG-1.17.md | 4 +++- controllers/config/clientconfig_controller.go | 18 +++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/CHANGELOG/CHANGELOG-1.17.md b/CHANGELOG/CHANGELOG-1.17.md index 26f74749c..c6293b520 100644 --- a/CHANGELOG/CHANGELOG-1.17.md +++ b/CHANGELOG/CHANGELOG-1.17.md @@ -15,4 +15,6 @@ When cutting a new release, update the `unreleased` heading to the tag being gen ## unreleased -* [CHANGE] [1313](https://github.com/k8ssandra/k8ssandra-operator/issues/1313)upgrade controller-runtime to 1.17 series, Go to 1.21. \ No newline at end of file +* [CHANGE] [1313](https://github.com/k8ssandra/k8ssandra-operator/issues/1313) upgrade controller-runtime to 1.17 series, Go to 1.21. +* [CHANGE] [1317](https://github.com/k8ssandra/k8ssandra-operator/issues/1317) Fix issues with caches in cluster scoped deployments where they were continuing to use a multi-namespace scoped cache and not an informer cache. +* [CHANGE] [1316](https://github.com/k8ssandra/k8ssandra-operator/issues/1316) Fix interchanged intervals and timeouts in tests. \ No newline at end of file diff --git a/controllers/config/clientconfig_controller.go b/controllers/config/clientconfig_controller.go index 3520145ed..4d9e78dad 100644 --- a/controllers/config/clientconfig_controller.go +++ b/controllers/config/clientconfig_controller.go @@ -117,7 +117,10 @@ func (r *ClientConfigReconciler) InitClientConfigs(ctx context.Context, mgr ctrl uncachedClient := r.ClientCache.GetLocalNonCacheClient() clientConfigs := make([]configapi.ClientConfig, 0) - namespaces := strings.Split(watchNamespace, ",") + namespaces := []string{} + if watchNamespace != "" { + namespaces = strings.Split(watchNamespace, ",") + } for _, ns := range namespaces { cConfigs := configapi.ClientConfigList{} @@ -194,20 +197,13 @@ func (r *ClientConfigReconciler) initAdditionalClusterConfig(ctx context.Context var c cluster.Cluster c, err = cluster.New(cfg, func(o *cluster.Options) { o.Scheme = r.Scheme - nsConfig := make(map[string]cache.Config) - for _, i := range namespaces { - if i != "" { - logger.V(1).Info(fmt.Sprintf("adding namespace %s for client %s to cache", i, cCfg.GetContextName())) + if len(namespaces) > 0 { + nsConfig := make(map[string]cache.Config) + for _, i := range namespaces { nsConfig[i] = cache.Config{} } - } - if len(nsConfig) > 0 { - logger.V(1).Info(fmt.Sprintf("Setting namespaces %#v for client %s", namespaces, cCfg.GetContextName())) o.Cache.DefaultNamespaces = nsConfig - } else { - logger.V(1).Info(fmt.Sprintf("Setting all namespaces for client %s, namespaces was %#v", cCfg.GetContextName(), namespaces)) } - }) if err != nil {