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

   ### Current Behavior
   
   I created an `ApisixRoute` object. It was synced continued.
   
   ```
   Name:         whoami
   API Version:  apisix.apache.org/v2
   Kind:         ApisixRoute
   Status:
     Conditions:
       Message:              Sync Successfully
       Observed Generation:  1
       Reason:               ResourcesSynced
       Status:               True
       Type:                 ResourcesAvailable
   Events:
     Type    Reason           Age                  From           Message
     ----    ------           ----                 ----           -------
     Normal  ResourcesSynced  3m3s (x17 over 76m)  ApisixIngress  ApisixIngress 
synced successfully
   ```
   
   It would lead etcd's data grows up quickly.
   
   The apisix ingress controller tries to create route when ApisixRoute add 
event arrived. It happens right after created an `ApisixRoute` object.
   
   ```
   2023-05-11T11:39:49+08:00       debug   ingress/apisix_route.go:476     
ApisixRoute add event arrived   {"key": "txmall/whoami", "object": 
{"metadata":{"name":"whoami","namespace":"txmall","uid":"41174fad-3a57-4930-9359-b46604cf2925","resourceVersion":"193716","generation":1,"creationTimestamp":"2023-05-11T03:39:49Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apisix.apache.org/v2\",\"kind\":\"ApisixRoute\",\"metadata\":{\"annotations\":{},\"name\":\"whoami\",\"namespace\":\"txmall\"},\"spec\":{\"http\":[{\"backends\":[{\"serviceName\":\"whoami\",\"servicePort\":80}],\"match\":{\"paths\":[\"/*\"]},\"name\":\"default\"}]}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"apisix.apache.org/v2","time":"2023-05-11T03:39:49Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:http":{}}}}]},"spec":{"ht
 
tp":[{"name":"default","match":{"paths":["/*"]},"backends":[{"serviceName":"whoami","servicePort":80,"weight":null}],"websocket":false,"authentication":{"enable":false,"type":"","keyAuth":{},"jwtAuth":{}}}]},"status":{}}}
   2023-05-11T11:39:49+08:00       debug   ingress/apisix_route.go:304     
translated ApisixRoute  {"routes": 
[{"id":"e9bb28b1","name":"txmall_whoami_default","desc":"Created by 
apisix-ingress-controller, DO NOT modify it 
manually","labels":{"managed-by":"apisix-ingress-controller"},"uris":["/*"],"upstream_id":"a142bdb4"}],
 "upstreams": [{"id":"a142bdb4","name":"txmall_whoami_80","desc":"Created by 
apisix-ingress-controller, DO NOT modify it 
manually","labels":{"managed-by":"apisix-ingress-controller"},"type":"roundrobin","nodes":[{"host":"10.1.179.47","port":80,"weight":100},{"host":"10.1.3.165","port":80,"weight":100}],"scheme":"http"}],
 "apisix_route": {}, "pluginConfigs": null}
   2023-05-11T11:39:49+08:00       debug   apisix/upstream.go:136  try to 
create upstream  {"name": "txmall_whoami_80", "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams";,
 "cluster": "default"}
   2023-05-11T11:39:49+08:00       debug   apisix/upstreamservicerelation.go:95 
   try to create upstreamService in cache  {"cluster": "default"}
   2023-05-11T11:39:49+08:00       debug   apisix/upstream.go:154  creating 
upstream       {"body": 
"{\"id\":\"a142bdb4\",\"name\":\"txmall_whoami_80\",\"desc\":\"Created by 
apisix-ingress-controller, DO NOT modify it 
manually\",\"labels\":{\"managed-by\":\"apisix-ingress-controller\"},\"type\":\"roundrobin\",\"nodes\":[{\"host\":\"10.1.179.47\",\"port\":80,\"weight\":100},{\"host\":\"10.1.3.165\",\"port\":80,\"weight\":100}],\"scheme\":\"http\"}",
 "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams/a142bdb4"}
   2023-05-11T11:39:49+08:00       debug   apisix/resource.go:123  got 
upstream: 
{"labels":{"managed-by":"apisix-ingress-controller"},"type":"roundrobin","hash_on":"vars","update_time":1683776389,"desc":"Created
 by apisix-ingress-controller, DO NOT modify it 
manually","name":"txmall_whoami_80","scheme":"http","create_time":1683776389,"nodes":[{"host":"10.1.179.47","priority":0,"port":80,"weight":100},{"host":"10.1.3.165","priority":0,"port":80,"weight":100}],"pass_host":"pass","id":"a142bdb4"}
   2023-05-11T11:39:49+08:00       debug   apisix/route.go:144     try to 
create route     {"hosts": [], "name": "txmall_whoami_default", "cluster": 
"default", "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/routes"}
   2023-05-11T11:39:49+08:00       debug   apisix/route.go:160     creating 
route  {"body": 
"{\"id\":\"e9bb28b1\",\"name\":\"txmall_whoami_default\",\"desc\":\"Created by 
apisix-ingress-controller, DO NOT modify it 
manually\",\"labels\":{\"managed-by\":\"apisix-ingress-controller\"},\"uris\":[\"/*\"],\"upstream_id\":\"a142bdb4\"}",
 "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/routes/e9bb28b1"}
   2023-05-11T11:39:49+08:00       debug   apisix/resource.go:93   got route: 
{"labels":{"managed-by":"apisix-ingress-controller"},"status":1,"upstream_id":"a142bdb4","priority":0,"name":"txmall_whoami_default","desc":"Created
 by apisix-ingress-controller, DO NOT modify it 
manually","create_time":1683776389,"update_time":1683776389,"uris":["\/*"],"id":"e9bb28b1"}
   2023-05-11T11:39:50+08:00       debug   ingress/apisix_route.go:507     
ApisixRoute update event arrived        {"key": "txmall/whoami", "new object": 
{"metadata":{"name":"whoami","namespace":"txmall","uid":"41174fad-3a57-4930-9359-b46604cf2925","resourceVersion":"193716","generation":1,"creationTimestamp":"2023-05-11T03:39:49Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apisix.apache.org/v2\",\"kind\":\"ApisixRoute\",\"metadata\":{\"annotations\":{},\"name\":\"whoami\",\"namespace\":\"txmall\"},\"spec\":{\"http\":[{\"backends\":[{\"serviceName\":\"whoami\",\"servicePort\":80}],\"match\":{\"paths\":[\"/*\"]},\"name\":\"default\"}]}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"apisix.apache.org/v2","time":"2023-05-11T03:39:49Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:http":{}}}}]}
 
,"spec":{"http":[{"name":"default","match":{"paths":["/*"]},"backends":[{"serviceName":"whoami","servicePort":80,"weight":null}],"websocket":false,"authentication":{"enable":false,"type":"","keyAuth":{},"jwtAuth":{}}}]},"status":{}},
 "old object": 
{"metadata":{"name":"whoami","namespace":"txmall","uid":"41174fad-3a57-4930-9359-b46604cf2925","resourceVersion":"193718","generation":1,"creationTimestamp":"2023-05-11T03:39:49Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"apisix.apache.org/v2\",\"kind\":\"ApisixRoute\",\"metadata\":{\"annotations\":{},\"name\":\"whoami\",\"namespace\":\"txmall\"},\"spec\":{\"http\":[{\"backends\":[{\"serviceName\":\"whoami\",\"servicePort\":80}],\"match\":{\"paths\":[\"/*\"]},\"name\":\"default\"}]}}\n"},"managedFields":[{"manager":"apisix-ingress-controller","operation":"Update","apiVersion":"apisix.apache.org/v2","time":"2023-05-11T03:39:49Z","fieldsType":"FieldsV1","fieldsV1":{"f:status":{".":{},"f:conditions":
 
{}}},"subresource":"status"},{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"apisix.apache.org/v2","time":"2023-05-11T03:39:49Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:http":{}}}}]},"spec":{"http":[{"name":"default","match":{"paths":["/*"]},"backends":[{"serviceName":"whoami","servicePort":80,"weight":null}],"websocket":false,"authentication":{"enable":false,"type":"","keyAuth":{},"jwtAuth":{}}}]},"status":{"conditions":[{"type":"ResourcesAvailable","status":"True","observedGeneration":1,"lastTransitionTime":null,"reason":"ResourcesSynced","message":"Sync
 Successfully"}]}}}
   2023-05-11T11:39:50+08:00       debug   ingress/apisix_route.go:304     
translated ApisixRoute  {"routes": 
[{"id":"e9bb28b1","name":"txmall_whoami_default","desc":"Created by 
apisix-ingress-controller, DO NOT modify it 
manually","labels":{"managed-by":"apisix-ingress-controller"},"uris":["/*"],"upstream_id":"a142bdb4"}],
 "upstreams": [{"id":"a142bdb4","name":"txmall_whoami_80","desc":"Created by 
apisix-ingress-controller, DO NOT modify it 
manually","labels":{"managed-by":"apisix-ingress-controller"},"type":"roundrobin","nodes":[{"host":"10.1.179.47","port":80,"weight":100},{"host":"10.1.3.165","port":80,"weight":100}],"scheme":"http"}],
 "apisix_route": {}, "pluginConfigs": null}
   2023-05-11T11:39:50+08:00       debug   apisix/route.go:47      try to look 
up route    {"name": "txmall_whoami_default", "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/routes";,
 "cluster": "default"}
   2023-05-11T11:39:50+08:00       debug   apisix/upstream.go:203  try to 
update upstream  {"id": "a142bdb4", "name": "txmall_whoami_80", "cluster": 
"default", "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams"}
   2023-05-11T11:39:50+08:00       debug   apisix/upstreamservicerelation.go:95 
   try to create upstreamService in cache  {"cluster": "default"}
   2023-05-11T11:39:50+08:00       debug   apisix/upstream.go:223  updating 
upstream       {"body": 
"{\"id\":\"a142bdb4\",\"name\":\"txmall_whoami_80\",\"desc\":\"Created by 
apisix-ingress-controller, DO NOT modify it 
manually\",\"labels\":{\"managed-by\":\"apisix-ingress-controller\"},\"type\":\"roundrobin\",\"nodes\":[{\"host\":\"10.1.179.47\",\"port\":80,\"weight\":100},{\"host\":\"10.1.3.165\",\"port\":80,\"weight\":100}],\"scheme\":\"http\"}",
 "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams/a142bdb4"}
   2023-05-11T11:39:50+08:00       debug   apisix/resource.go:123  got 
upstream: 
{"labels":{"managed-by":"apisix-ingress-controller"},"type":"roundrobin","hash_on":"vars","update_time":1683776390,"desc":"Created
 by apisix-ingress-controller, DO NOT modify it 
manually","name":"txmall_whoami_80","scheme":"http","create_time":1683776389,"nodes":[{"host":"10.1.179.47","priority":0,"port":80,"weight":100},{"host":"10.1.3.165","priority":0,"port":80,"weight":100}],"pass_host":"pass","id":"a142bdb4"}
   2023-05-11T11:39:50+08:00       debug   apisix/route.go:205     try to 
update route     {"id": "e9bb28b1", "name": "txmall_whoami_default", "cluster": 
"default", "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/routes"}
   2023-05-11T11:39:50+08:00       debug   apisix/route.go:219     updating 
route  {"body": 
"{\"id\":\"e9bb28b1\",\"name\":\"txmall_whoami_default\",\"desc\":\"Created by 
apisix-ingress-controller, DO NOT modify it 
manually\",\"labels\":{\"managed-by\":\"apisix-ingress-controller\"},\"uris\":[\"/*\"],\"upstream_id\":\"a142bdb4\"}",
 "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/routes/e9bb28b1"}
   2023-05-11T11:39:50+08:00       debug   apisix/resource.go:93   got route: 
{"labels":{"managed-by":"apisix-ingress-controller"},"status":1,"upstream_id":"a142bdb4","priority":0,"name":"txmall_whoami_default","desc":"Created
 by apisix-ingress-controller, DO NOT modify it 
manually","create_time":1683776389,"update_time":1683776390,"uris":["\/*"],"id":"e9bb28b1"}
   ```
   
   The apisix ingress controller tries to create route even NO ApisixRoute add 
event arrived.
   
   ```
   2023-05-11T11:43:36+08:00       debug   ingress/apisix_route.go:304     
translated ApisixRoute  {"routes": 
[{"id":"e9bb28b1","name":"txmall_whoami_default","desc":"Created by 
apisix-ingress-controller, DO NOT modify it 
manually","labels":{"managed-by":"apisix-ingress-controller"},"uris":["/*"],"upstream_id":"a142bdb4"}],
 "upstreams": [{"id":"a142bdb4","name":"txmall_whoami_80","desc":"Created by 
apisix-ingress-controller, DO NOT modify it 
manually","labels":{"managed-by":"apisix-ingress-controller"},"type":"roundrobin","nodes":[{"host":"10.1.179.47","port":80,"weight":100},{"host":"10.1.3.165","port":80,"weight":100}],"scheme":"http"}],
 "apisix_route": {}, "pluginConfigs": null}
   2023-05-11T11:43:36+08:00       debug   apisix/upstream.go:136  try to 
create upstream  {"name": "txmall_whoami_80", "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams";,
 "cluster": "default"}
   2023-05-11T11:43:36+08:00       debug   apisix/upstreamservicerelation.go:95 
   try to create upstreamService in cache  {"cluster": "default"}
   2023-05-11T11:43:36+08:00       debug   apisix/upstream.go:154  creating 
upstream       {"body": 
"{\"id\":\"a142bdb4\",\"name\":\"txmall_whoami_80\",\"desc\":\"Created by 
apisix-ingress-controller, DO NOT modify it 
manually\",\"labels\":{\"managed-by\":\"apisix-ingress-controller\"},\"type\":\"roundrobin\",\"nodes\":[{\"host\":\"10.1.179.47\",\"port\":80,\"weight\":100},{\"host\":\"10.1.3.165\",\"port\":80,\"weight\":100}],\"scheme\":\"http\"}",
 "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams/a142bdb4"}
   2023-05-11T11:43:36+08:00       debug   ingress/controller.go:756       
success check health for default cluster
   2023-05-11T11:43:36+08:00       debug   apisix/resource.go:123  got 
upstream: 
{"labels":{"managed-by":"apisix-ingress-controller"},"type":"roundrobin","hash_on":"vars","update_time":1683776616,"desc":"Created
 by apisix-ingress-controller, DO NOT modify it 
manually","name":"txmall_whoami_80","scheme":"http","create_time":1683776389,"nodes":[{"host":"10.1.179.47","priority":0,"port":80,"weight":100},{"host":"10.1.3.165","priority":0,"port":80,"weight":100}],"pass_host":"pass","id":"a142bdb4"}
   2023-05-11T11:43:36+08:00       debug   apisix/route.go:144     try to 
create route     {"hosts": [], "name": "txmall_whoami_default", "cluster": 
"default", "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/routes"}
   2023-05-11T11:43:36+08:00       debug   apisix/route.go:160     creating 
route  {"body": 
"{\"id\":\"e9bb28b1\",\"name\":\"txmall_whoami_default\",\"desc\":\"Created by 
apisix-ingress-controller, DO NOT modify it 
manually\",\"labels\":{\"managed-by\":\"apisix-ingress-controller\"},\"uris\":[\"/*\"],\"upstream_id\":\"a142bdb4\"}",
 "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/routes/e9bb28b1"}
   2023-05-11T11:43:36+08:00       debug   apisix/resource.go:93   got route: 
{"labels":{"managed-by":"apisix-ingress-controller"},"status":1,"upstream_id":"a142bdb4","priority":0,"name":"txmall_whoami_default","desc":"Created
 by apisix-ingress-controller, DO NOT modify it 
manually","create_time":1683776389,"update_time":1683776616,"uris":["\/*"],"id":"e9bb28b1"}
   ```
   
   ```
   2023-05-11T11:48:36+08:00       debug   ingress/apisix_route.go:304     
translated ApisixRoute  {"routes": 
[{"id":"e9bb28b1","name":"txmall_whoami_default","desc":"Created by 
apisix-ingress-controller, DO NOT modify it 
manually","labels":{"managed-by":"apisix-ingress-controller"},"uris":["/*"],"upstream_id":"a142bdb4"}],
 "upstreams": [{"id":"a142bdb4","name":"txmall_whoami_80","desc":"Created by 
apisix-ingress-controller, DO NOT modify it 
manually","labels":{"managed-by":"apisix-ingress-controller"},"type":"roundrobin","nodes":[{"host":"10.1.179.47","port":80,"weight":100},{"host":"10.1.3.165","port":80,"weight":100}],"scheme":"http"}],
 "apisix_route": {}, "pluginConfigs": null}
   2023-05-11T11:48:36+08:00       debug   apisix/upstream.go:136  try to 
create upstream  {"name": "txmall_whoami_80", "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams";,
 "cluster": "default"}
   2023-05-11T11:48:36+08:00       debug   apisix/upstreamservicerelation.go:95 
   try to create upstreamService in cache  {"cluster": "default"}
   2023-05-11T11:48:36+08:00       debug   apisix/upstream.go:154  creating 
upstream       {"body": 
"{\"id\":\"a142bdb4\",\"name\":\"txmall_whoami_80\",\"desc\":\"Created by 
apisix-ingress-controller, DO NOT modify it 
manually\",\"labels\":{\"managed-by\":\"apisix-ingress-controller\"},\"type\":\"roundrobin\",\"nodes\":[{\"host\":\"10.1.179.47\",\"port\":80,\"weight\":100},{\"host\":\"10.1.3.165\",\"port\":80,\"weight\":100}],\"scheme\":\"http\"}",
 "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams/a142bdb4"}
   2023-05-11T11:48:36+08:00       debug   ingress/controller.go:756       
success check health for default cluster
   2023-05-11T11:48:36+08:00       debug   apisix/resource.go:123  got 
upstream: 
{"labels":{"managed-by":"apisix-ingress-controller"},"type":"roundrobin","hash_on":"vars","update_time":1683776916,"desc":"Created
 by apisix-ingress-controller, DO NOT modify it 
manually","name":"txmall_whoami_80","scheme":"http","create_time":1683776389,"nodes":[{"host":"10.1.179.47","priority":0,"port":80,"weight":100},{"host":"10.1.3.165","priority":0,"port":80,"weight":100}],"pass_host":"pass","id":"a142bdb4"}
   2023-05-11T11:48:36+08:00       debug   apisix/route.go:144     try to 
create route     {"hosts": [], "name": "txmall_whoami_default", "cluster": 
"default", "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/routes"}
   2023-05-11T11:48:36+08:00       debug   apisix/route.go:160     creating 
route  {"body": 
"{\"id\":\"e9bb28b1\",\"name\":\"txmall_whoami_default\",\"desc\":\"Created by 
apisix-ingress-controller, DO NOT modify it 
manually\",\"labels\":{\"managed-by\":\"apisix-ingress-controller\"},\"uris\":[\"/*\"],\"upstream_id\":\"a142bdb4\"}",
 "url": 
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/routes/e9bb28b1"}
   2023-05-11T11:48:36+08:00       debug   apisix/resource.go:93   got route: 
{"labels":{"managed-by":"apisix-ingress-controller"},"status":1,"upstream_id":"a142bdb4","priority":0,"name":"txmall_whoami_default","desc":"Created
 by apisix-ingress-controller, DO NOT modify it 
manually","create_time":1683776389,"update_time":1683776916,"uris":["\/*"],"id":"e9bb28b1"}
   ```
   
   ### Expected Behavior
   
   The apisix ingress controller keeps idle when no `ApisixRoute` object added 
or updated.
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   1. Install apisix and apisix ingress controller with the Helm Chart.
   
      - apisix/apisix 0.13.1
      - apisix/apisix-ingress-controller 0.10.2
   
      Remember set apisix ingress controller log level as `debug`.
   
   2. Create `ApisixRoute` object.
   
      ```yaml
      apiVersion: apisix.apache.org/v2
      kind: ApisixRoute
      metadata:
        name: whoami
      spec:
        http:
        - name: default
          match:
            paths:
            - /*
          backends:
          - serviceName: whoami
            servicePort: 80
      ```
   
   ### Environment
   
   - APISIX Ingress controller version
      ```
      Version: 1.5.1
      Git SHA: no-git-module
      Go Version: go1.19.3
      Building OS/Arch: linux/amd64
      Running OS/Arch: linux/amd64
      ```
   
   - Kubernetes cluster version
   
      ```
      Client Version: version.Info{Major:"1", Minor:"24+", 
GitVersion:"v1.24.13-2+cd9733de84ad4b", 
GitCommit:"cd9733de84ad4b90a3375b6edba7617688d1d48b", GitTreeState:"clean", 
BuildDate:"2023-04-12T20:01:01Z", GoVersion:"go1.19.8", Compiler:"gc", 
Platform:"linux/amd64"}
      Kustomize Version: v4.5.4
      Server Version: version.Info{Major:"1", Minor:"24+", 
GitVersion:"v1.24.13-2+cd9733de84ad4b", 
GitCommit:"cd9733de84ad4b90a3375b6edba7617688d1d48b", GitTreeState:"clean", 
BuildDate:"2023-04-12T19:58:19Z", GoVersion:"go1.19.8", Compiler:"gc", 
Platform:"linux/amd64"}
      ```
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to