This is an automated email from the ASF dual-hosted git repository.

baze pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9d9a13a  move need watch ns to readConfig func
     new ca6b03e  Merge pull request #977 from sxllwx/fix/issue813
9d9a13a is described below

commit 9d9a13a2bebad54aa4bcb87f01dcdf7134db8d05
Author: scott <scottwangs...@gmail.com>
AuthorDate: Thu Dec 31 17:59:42 2020 +0800

    move need watch ns to readConfig func
---
 remoting/kubernetes/registry_controller.go | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/remoting/kubernetes/registry_controller.go 
b/remoting/kubernetes/registry_controller.go
index f66163d..e659e7e 100644
--- a/remoting/kubernetes/registry_controller.go
+++ b/remoting/kubernetes/registry_controller.go
@@ -203,6 +203,17 @@ func (c *dubboRegistryController) readConfig() error {
        if len(c.namespace) == 0 {
                return perrors.New("read value from env by key (NAMESPACE)")
        }
+
+       // read need watched namespaces list
+       needWatchedNameSpaceList, ok := os.LookupEnv(needWatchedNameSpaceKey)
+       if ok {
+               for _, ns := range strings.Split(needWatchedNameSpaceList, 
",")[1:] {
+                       logger.Debugf("adding need watched ns: %s", ns)
+                       c.needWatchedNamespace[ns] = struct{}{}
+               }
+       }
+       // current work namespace should be watched
+       c.needWatchedNamespace[c.namespace] = struct{}{}
        return nil
 }
 
@@ -242,17 +253,6 @@ func (c *dubboRegistryController) initPodInformer() error {
                return nil
        }
 
-       // read need watched namespaces list
-       needWatchedNameSpaceList := os.Getenv(needWatchedNameSpaceKey)
-       if len(needWatchedNameSpaceList) == 0 {
-               return perrors.New("read value from env by key 
(DUBBO_NAMESPACE)")
-       }
-       for _, ns := range strings.Split(needWatchedNameSpaceList, ",") {
-               c.needWatchedNamespace[ns] = struct{}{}
-       }
-       // current work namespace should be watched
-       c.needWatchedNamespace[c.namespace] = struct{}{}
-
        c.queue = workqueue.New()
 
        // init all watch needed pod-informer

Reply via email to