Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
wrap up comments
Signed-off-by: YuChen <[email protected]>
  • Loading branch information
YuChen committed Feb 29, 2024
commit e20cb657bc2ea79170594536d1c352b831ec43ac
6 changes: 3 additions & 3 deletions controllers/bootstrap/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -1185,14 +1185,14 @@ func (b *Bootstrap) CleanNamespaceScopeResources() error {
if err != nil {
klog.Errorf("Failed to get %s configmap: %v", constant.NamespaceScopeConfigmapName, err)
return err
} else if nssCmNs == nil && err == nil {
klog.Infof("The %s configmap is not found in the %s namespace, skip cleaning up", constant.NamespaceScopeConfigmapName, b.CSData.OperatorNs)
} else if nssCmNs == nil {
klog.Infof("The %s configmap is not found in the %s namespace, skip cleaning the NamespaceScope resources", constant.NamespaceScopeConfigmapName, b.CSData.OperatorNs)
return nil
}

// If the topology is (NOT ALL NS Mode) and (NOT Simple) , return
if b.CSData.WatchNamespaces != "" && len(nssCmNs) > 1 {
klog.Infof("The topology is not All Namespaces Mode or Simple Topology, skip cleaning up")
klog.Infof("The topology is not All Namespaces Mode or Simple Topology, skip cleaning the NamespaceScope resources")
return nil
}

Expand Down
22 changes: 9 additions & 13 deletions controllers/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,21 +747,17 @@ func GetCmOfNss(r client.Reader, operatorNs string) (*corev1.ConfigMap, error) {
cmNs := operatorNs
nssConfigmap := &corev1.ConfigMap{}

for {
if err := utilwait.PollImmediate(time.Second*5, time.Second*30, func() (done bool, err error) {
err = r.Get(context.TODO(), types.NamespacedName{Name: cmName, Namespace: cmNs}, nssConfigmap)
if err != nil {
if errors.IsNotFound(err) {
klog.Infof("waiting for configmap %v/%v", operatorNs, constant.NamespaceScopeConfigmapName)
}
return false, err
if err := utilwait.PollImmediate(time.Second*5, time.Second*30, func() (done bool, err error) {
err = r.Get(context.TODO(), types.NamespacedName{Name: cmName, Namespace: cmNs}, nssConfigmap)
if err != nil {
if errors.IsNotFound(err) {
klog.Infof("waiting for configmap %v/%v", operatorNs, constant.NamespaceScopeConfigmapName)
}
return true, nil
}); err == nil {
break
} else {
return nil, err
return false, err
}
return true, nil
}); err != nil {
return nil, err
}

return nssConfigmap, nil
Expand Down