Skip to content

Commit

Permalink
Changelog, better loop for setting default namespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles-Garnsey committed May 22, 2024
1 parent 20dfb93 commit 88a8c2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG/CHANGELOG-1.17.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* [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.
18 changes: 7 additions & 11 deletions controllers/config/clientconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 88a8c2b

Please sign in to comment.