You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/11/30 09:33:45 UTC

[GitHub] [apisix-ingress-controller] han6565 opened a new issue #778: request help: 新增namespace 然后删除,会一直报not found

han6565 opened a new issue #778:
URL: https://github.com/apache/apisix-ingress-controller/issues/778


   ### Issue description
   在k8集群内,启动apisix-ingress,新增namespace,然后删除会一直报
   ```
   sync namespace info failed, will retry	{"namespace": "xxx", "error": "namespaces \"xxx\" not found"}
   ```
   研究了一下,应该是删除namespace触发了delete事件后又触发了update事件,由于无法找到对应的namespace所以会一直报错。不知道大家是否也是这样。
   
   另外还有一个问题 
   ```
   			// if labels of namespace contains the watchingLabels, the namespace should be set to controller.watchingNamespace
   			if c.controller.watchingLabels.IsSubsetOf(namespace.Labels) {
   				c.controller.watchingNamespace.Store(namespace.Name, struct{}{})
   			}
   ```
   c.controller.watchingLabels.IsSubsetOf(namespace.Labels) 这句如果我是新增的namespace是不会在watchingLabels里面有值的,也就无法将新的namespace加入到watchingNamespace,不知道是不是我哪里配置有问题。我这边watchingLabels似乎始终是空的
   
   mapConfig
   ```
   data:
     config.yaml: |
       # log options
       log_level: "debug"
       log_output: "stderr"
       http_listen: ":8080"
       enable_profiling: true
       kubernetes:
         kubeconfig: ""
         resync_interval: "6h"
         app_namespaces:
         - "*"
         ingress_class: "apisix"
         ingress_version: "networking/v1"
         apisix_route_version: "apisix.apache.org/v2beta1"
       apisix:
         default_cluster_base_url: "http://172.24.150.14:9180/apisix/admin"
         default_cluster_admin_key: "edd1c9f034335f136f87ad84b625c8f1"
         default_cluster_name: ""
   ```
   
   目前我的解决方法比较暴力,但是新建namespace和删除都可以正常watching
   ```
   	if ev.Type != types.EventDelete {
   		// check the labels of specify namespace
   		namespace, err := c.controller.kubeClient.Client.CoreV1().Namespaces().Get(ctx, ev.Object.(string), metav1.GetOptions{})
   		if err != nil {
   			if strings.Index(err.Error(), "not found") > 0 && ev.Type == types.EventUpdate {
   				return nil
   			}
   			return err
   		} else {
   			// if labels of namespace contains the watchingLabels, the namespace should be set to controller.watchingNamespace
   			//if c.controller.watchingLabels.IsSubsetOf(namespace.Labels) {
   			c.controller.watchingNamespace.Store(namespace.Name, struct{}{})
   			//}
   		}
   	} else { // type == types.EventDelete
   		namespace := ev.Tombstone.(*corev1.Namespace)
   		if _, ok := c.controller.watchingNamespace.Load(namespace.Name); ok {
   			c.controller.watchingNamespace.Delete(namespace.Name)
   		}
   		// do nothing, if the namespace did not in controller.watchingNamespace
   	}
   ```
   
   ### Environment
   
   * your apisix-ingress-controller version (output of `apisix-ingress-controller version --long`);
    v1.3
   * your Kubernetes cluster version (output of `kubectl version`);
   Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.14", GitCommit:"89182bdd065fbcaffefec691908a739d161efc03", GitTreeState:"clean", BuildDate:"2020-12-18T12:02:35Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
   * if you run apisix-ingress-controller in Bare-metal environment, also show your OS version (`uname -a`).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] gxthrj commented on issue #778: request help: 新增namespace 然后删除,会一直报not found

Posted by GitBox <gi...@apache.org>.
gxthrj commented on issue #778:
URL: https://github.com/apache/apisix-ingress-controller/issues/778#issuecomment-982748173


   There is an issue about this #741, suggest checking bugfix #742 for help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] han6565 commented on issue #778: request help: 新增namespace 然后删除,会一直报not found

Posted by GitBox <gi...@apache.org>.
han6565 commented on issue #778:
URL: https://github.com/apache/apisix-ingress-controller/issues/778#issuecomment-983240242


   > There is an issue about this #741, suggest checking bugfix #742 for help.
   
   thanks .


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] han6565 closed issue #778: request help: 新增namespace 然后删除,会一直报not found

Posted by GitBox <gi...@apache.org>.
han6565 closed issue #778:
URL: https://github.com/apache/apisix-ingress-controller/issues/778


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org