Skip to content

Commit 5b1a27c

Browse files
authored
Merge pull request #6069 from devtron-labs/fix-ns-list-informer
fix: cluster namespace list informer
2 parents 06e4c5d + 9cdef42 commit 5b1a27c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/cluster/ClusterService.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,13 @@ func (impl *ClusterServiceImpl) FindAllNamespacesByUserIdAndClusterId(userId int
752752
}
753753
namespaceListGroupByCLuster := impl.K8sInformerFactory.GetLatestNamespaceListGroupByCLuster()
754754
namespaces := namespaceListGroupByCLuster[clusterBean.ClusterName]
755-
755+
if len(namespaces) == 0 {
756+
// TODO: Verify if this is a valid scenario, if yes, then handle it
757+
// ideally, all clusters should have at least one `default` namespace
758+
// this is a fallback scenario, for handling the namespace informer failure at start up...
759+
impl.logger.Warnw("no namespaces found for cluster", "clusterName", clusterBean.ClusterName)
760+
impl.SyncNsInformer(clusterBean)
761+
}
756762
if isActionUserSuperAdmin {
757763
for namespace, value := range namespaces {
758764
if value {

0 commit comments

Comments
 (0)