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 2022/04/27 13:16:50 UTC

[GitHub] [apisix-ingress-controller] LivesMountain opened a new issue, #987: bug: update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated

LivesMountain opened a new issue, #987:
URL: https://github.com/apache/apisix-ingress-controller/issues/987

   ### Issue description
   
   update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated
   
   `kubectl get ar -A |grep screensaver`  ,only one data
   ![image](https://user-images.githubusercontent.com/19382017/165519896-7c219f31-b895-4234-aba8-2957ddb08bb5.png)
   
   However, there are two data on dashboard, apisix-Ingress-Controller's log is missing, so I can't find the problem now .
   ![image](https://user-images.githubusercontent.com/19382017/165520165-27fcd25f-a825-4d67-9c1a-f04660038b6d.png)
   
   Etcd has some of the same data,Id and name are different
   routes/5341fe35
   {"status":1,"uris":["\/business-screensaver\/*"],"hosts":["****"],"upstream_id":"e0a2d230","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","update_time":1650358919,"create_time":1650358919,"priority":0,"id":"5341fe35","name":"****-business-screensaver_api","labels":{"managed-by":"apisix-ingress-controller"},"plugins":{"proxy-rewrite":{"regex_uri":["****business-screensaver\/(.*)","\/$1"]}}}
   
   routes/31f041fe
   {"status":1,"uris":["\/business-screensaver\/*"],"hosts":["****"],"upstream_id":"e0a2d230","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","update_time":1649379005,"create_time":1649379005,"priority":0,"id":"31f041fe","name":"*****business-screensaver_a981a76","labels":{"managed-by":"apisix-ingress-controller"},"plugins":{"proxy-rewrite":{"regex_uri":["^\****business-screensaver\/(.*)","\/$1"]}}}
   
   Currently, only this route is found to be faulty.  All other routes change spec.http.name to API, and only change the original data a981a76 does not generate a new route entry 。
   
   It is not clear when apisix-Controller creates a new route entry, and when does it modify the original data  
   
   
   At present, only the phenomenon can be seen, but it is not clear how to troubleshoot and reappear,Ask for Help
   
   ### Environment
   
   - your apisix-ingress-controller version (output of apisix-ingress-controller version --long):
   - your Kubernetes cluster version (output of kubectl version):
   - if you run apisix-ingress-controller in Bare-metal environment, also show your OS version (uname -a):
   
   
   ### Minimal test code / Steps to reproduce
   
   ```yaml1
   {{- if .Values.apisixroute.enabled -}}
   apiVersion: apisix.apache.org/v2beta3
   kind: ApisixRoute
   metadata:
     name: {{ include "test.fullname" . }}
   spec:
     http:
     - name: a981a76
       match:
         hosts:
         - "{{ .Values.apisixroute.host }}"
         paths:
         - "{{ .Values.apisixroute.path }}*"
       plugins: 
       - name: proxy-rewrite
         enable: true 
         config: 
           regex_uri: ["^{{ .Values.apisixroute.path }}(.*)", "/$1"]
       backends:
       - serviceName: "{{ include "test.fullname" . }}"
         servicePort: 80
   {{- end -}}
   ```
   ```yaml2
   {{- if .Values.apisixroute.enabled -}}
   apiVersion: apisix.apache.org/v2beta3
   kind: ApisixRoute
   metadata:
     name: {{ include "test.fullname" . }}
   spec:
     http:
     - name: api
       match:
         hosts:
         - "{{ .Values.apisixroute.host }}"
         paths:
         - "{{ .Values.apisixroute.path }}*"
       plugins: 
       - name: proxy-rewrite
         enable: true 
         config: 
           regex_uri: ["^{{ .Values.apisixroute.path }}(.*)", "/$1"]
       backends:
       - serviceName: "{{ include "test.fullname" . }}"
         servicePort: 80
   {{- end -}}
   ```
   Render yamL1 template with helm changed to render YamL2 template with helm  
   
   ### Actual result
   
   The dashboard produces two identical servername and path
   ![image](https://user-images.githubusercontent.com/19382017/165524603-ba1544da-509a-46d8-9f32-07eec6b1164c.png)
   ![image](https://user-images.githubusercontent.com/19382017/165525754-4873baf2-934c-4704-b327-8fbfaa69b91e.png)
   
   Etcd has some of the same data,Id and name are different
   routes/5341fe35
   {"status":1,"uris":["\/business-screensaver\/*"],"hosts":["****"],"upstream_id":"e0a2d230","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","update_time":1650358919,"create_time":1650358919,"priority":0,"id":"5341fe35","name":"****-business-screensaver_api","labels":{"managed-by":"apisix-ingress-controller"},"plugins":{"proxy-rewrite":{"regex_uri":["****business-screensaver\/(.*)","\/$1"]}}}
   
   routes/31f041fe
   {"status":1,"uris":["\/business-screensaver\/*"],"hosts":["****"],"upstream_id":"e0a2d230","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","update_time":1649379005,"create_time":1649379005,"priority":0,"id":"31f041fe","name":"*****business-screensaver_a981a76","labels":{"managed-by":"apisix-ingress-controller"},"plugins":{"proxy-rewrite":{"regex_uri":["^\****business-screensaver\/(.*)","\/$1"]}}}
   
   ### Error log
   
   There is no error log
   [GIN] 2022/04/27 - 20:44:33 | 200 |      27.103µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:44:43 | 200 |      30.804µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:44:43 | 200 |      26.288µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:44:53 | 200 |        27.1µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:44:53 | 200 |       27.51µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:03 | 200 |      29.087µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:03 | 200 |      24.202µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:13 | 200 |      24.406µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:13 | 200 |      28.976µs |     169.254.1.1 | GET      "/healthz"
   W0427 20:45:16.346147       1 warnings.go:70] apisix.apache.org/v2beta1 ApisixRoute is deprecated; use apisix.apache.org/v2beta3 ApisixRoute
   [GIN] 2022/04/27 - 20:45:23 | 200 |       29.95µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:23 | 200 |      24.161µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:33 | 200 |      34.457µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:33 | 200 |      24.054µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:43 | 200 |       26.65µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:43 | 200 |      24.778µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:53 | 200 |      31.825µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:45:53 | 200 |      21.546µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:46:03 | 200 |      28.885µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:46:03 | 200 |       23.01µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:46:13 | 200 |      24.818µs |     169.254.1.1 | GET      "/healthz"
   [GIN] 2022/04/27 - 20:46:13 | 200 |      22.304µs |     169.254.1.1 | GET      "/healthz"
   
   ### Expected result
   
   Update the apisixRoute spec.http.name field and only one route appears  


-- 
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.apache.org

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


[GitHub] [apisix-ingress-controller] LivesMountain commented on issue #987: bug: update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated

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

   I did not modify metadata.name  ,I changed spec.http.name。
   apisixroute1.yaml
   `apiVersion: apisix.apache.org/v2beta3
   kind: ApisixRoute
   metadata:
     name: nginx
     namespace: default
   spec:
     http:
     - name: a981a76
       match:
         hosts:
         - "test.apisixroute.com"
         paths:
         - "/*"
       backends:
       - serviceName: nginx
         servicePort: 80`
   
   kubectl apply -f apisixroute1.yaml
   kubectl describe ar nginx
   ![image](https://user-images.githubusercontent.com/19382017/166641734-fdc9dc26-0f35-4c42-a937-fb5cbb755c20.png)
   dashboard
   <img width="1117" alt="1651650709" src="https://user-images.githubusercontent.com/19382017/166641821-9af69be8-5bd2-4710-814d-a636a03f6570.png">
   
   apisixroute2.yaml
   `apiVersion: apisix.apache.org/v2beta3
   kind: ApisixRoute
   metadata:
     name: nginx
     namespace: default
   spec:
     http:
     - name: api
       match:
         hosts:
         - "test.apisixroute.com"
         paths:
         - "/*"
       backends:
       - serviceName: nginx
         servicePort: 80`
   
   kubectl apply -f apisixroute2.yaml
   kubectl describe ar nginx
   ![image](https://user-images.githubusercontent.com/19382017/166642139-59ec7e93-9f00-44a8-af7a-20e2540a6a10.png)
   dashboard
   ![image](https://user-images.githubusercontent.com/19382017/166642194-b5c0af17-15ba-4630-b053-8e44c5c9b2a8.png)
   **The above is normal**
   **In practice, however,in some cases,apisixRoute update will result in two route records in etcd,It looks like a new route record was created instead of updating the old route.  **


-- 
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] tao12345666333 commented on issue #987: bug: update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated

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

   This is not a bug, this is a concrete implementation.
   
   For now we will use this name to construct the final route name.
   
   If you update the ApisixRoute resource directly, since the `metadata.name` has not changed, it will only synchronize the route according to the current configuration.
   
   But the APISIX Ingress controller will not delete the original route information in APISIX, which is very dangerous. Unless you  delete the ApisixRoute resource and re-create it with a new configuration.


-- 
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] tao12345666333 commented on issue #987: bug: update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated

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

   > If you update the ApisixRoute resource directly, since the `metadata.name` has not changed, it will only synchronize the route according to the current configuration.
   > 
   > But the APISIX Ingress controller will not delete the original route information in APISIX, which is very dangerous. Unless you delete the ApisixRoute resource and re-create it with a new configuration.
   
   Please read my previous comment


-- 
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] github-actions[bot] commented on issue #987: bug: update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #987:
URL: https://github.com/apache/apisix-ingress-controller/issues/987#issuecomment-1204656715

   This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
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] LivesMountain commented on issue #987: bug: update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated

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

   apisix-ingress-controller version 1.4.0
   apisix version 2.13.1
   etcdctl version: 3.4.18


-- 
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] github-actions[bot] commented on issue #987: bug: update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #987:
URL: https://github.com/apache/apisix-ingress-controller/issues/987#issuecomment-1236020086

   This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.


-- 
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] github-actions[bot] closed issue #987: bug: update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #987: bug: update apisixroute.yaml spec.http.name from a981a76 to api,Sometimes two routes are generated
URL: https://github.com/apache/apisix-ingress-controller/issues/987


-- 
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