-
Notifications
You must be signed in to change notification settings - Fork 82
Check scoped namespaces from nss ConfigMap instead of watch_namespace #1815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1180,8 +1180,19 @@ func (b *Bootstrap) DeployCertManagerCR() error { | |||||
| // NamespaceScope resources include common-service, nss-managedby-odlm, nss-odlm-scope, and odlm-scope-managedby-odlm | ||||||
| func (b *Bootstrap) CleanNamespaceScopeResources() error { | ||||||
|
|
||||||
| // get namespace-scope ConfigMap in operatorNamespace | ||||||
| nssCmNs, err := util.GetNssCmNs(b.Reader, b.CSData.OperatorNs) | ||||||
| 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) | ||||||
|
||||||
| klog.Infof("The %s configmap is not found in the %s namespace, skip cleaning up", constant.NamespaceScopeConfigmapName, b.CSData.OperatorNs) | |
| klog.Infof("The %s configmap is not found in the %s namespace, skip cleaning the NamespaceScope resources", constant.NamespaceScopeConfigmapName, b.CSData.OperatorNs) |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -726,6 +726,9 @@ func GetRequestNs(r client.Reader) (requestNs []string) { | |
| func GetNssCmNs(r client.Reader, cpfsNamespace string) ([]string, error) { | ||
| nssConfigMap, err := GetCmOfNss(r, cpfsNamespace) | ||
| if err != nil { | ||
| if errors.IsNotFound(err) { | ||
| return nil, nil | ||
| } | ||
| return nil, err | ||
| } | ||
| nssNsMems, ok := nssConfigMap.Data["namespaces"] | ||
|
|
@@ -745,7 +748,7 @@ func GetCmOfNss(r client.Reader, operatorNs string) (*corev1.ConfigMap, error) { | |
| nssConfigmap := &corev1.ConfigMap{} | ||
|
|
||
| for { | ||
|
||
| if err := utilwait.PollImmediate(time.Second*10, time.Second*60, func() (done bool, err error) { | ||
| 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) { | ||
|
|
@@ -757,7 +760,6 @@ func GetCmOfNss(r client.Reader, operatorNs string) (*corev1.ConfigMap, error) { | |
| }); err == nil { | ||
| break | ||
| } else { | ||
| klog.Errorf("Failed to get configmap %v/%v: %v", operatorNs, constant.NamespaceScopeConfigmapName, err) | ||
| return nil, err | ||
| } | ||
|
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we do not need to check
err == nil, it has been checked byerr != nilalready.