apache / apisix-ingress-controller

APISIX Ingress Controller for Kubernetes
https://apisix.apache.org/
Apache License 2.0
995 stars 341 forks source link

bug: inconsistent messages are should in logs when new route/upstream is registred #2260

Open ikatlinsky opened 2 months ago

ikatlinsky commented 2 months ago

Current Behavior

Currently, almost each time new route/upstream is created via crd following messages are displayed:

(1) error   apisix/apisix_upstream.go:865   update status   {"status": {"conditions":[{"type":"ResourcesAvailable","status":"False","observedGeneration":1,"lastTransitionTime":"2024-07-09T06:51:14Z","reason":"ResourceSyncAborted","message":"upstream doesn't exist. It will be created after ApisixRoute is created referencing it."}]}}

(2) warn    apisix/apisix_upstream.go:509   sync ApisixUpstream failed, will retry  {"object": {"Type":1,"Object":{"Key":"bsl-api-apsx/pmi-df3dwey5kr","OldObject":null,"GroupVersion":"apisix.apache.org/v2"},"OldObject":null,"Tombstone":null}, "error": "upstream doesn't exist. It will be created after ApisixRoute is created referencing it."}

(3) error   apisix/apisix_upstream.go:865   update status   {"status": {"conditions":[{"type":"ResourcesAvailable","status":"True","observedGeneration":1,"lastTransitionTime":"2024-07-09T06:51:15Z","reason":"ResourcesSynced","message":"Sync Successfully"}]}}

Issues with that:

  1. errors 1 and 2 are clearly the same and should have the same log level or better - should not be duplicated
  2. error 1 is clearly not an error, but warning
  3. error 3 is for sure not an error and warn, but rather info or dbeug

Expected Behavior

  1. errors 1 and 2 should have the same log level of warn or only 1 message should be displayed
  2. error 3 should be info or debug, not error or info

Error Logs

2024-07-09T14:51:14+08:00   error   apisix/apisix_upstream.go:865   update status   {"status": {"conditions":[{"type":"ResourcesAvailable","status":"False","observedGeneration":1,"lastTransitionTime":"2024-07-09T06:51:14Z","reason":"ResourceSyncAborted","message":"upstream doesn't exist. It will be created after ApisixRoute is created referencing it."}]}}
2024-07-09T14:51:14+08:00   warn    apisix/apisix_upstream.go:509   sync ApisixUpstream failed, will retry  {"object": {"Type":1,"Object":{"Key":"bsl-api-apsx/pmi-df3dwey5kr","OldObject":null,"GroupVersion":"apisix.apache.org/v2"},"OldObject":null,"Tombstone":null}, "error": "upstream doesn't exist. It will be created after ApisixRoute is created referencing it."}
2024-07-09T14:51:15+08:00   error   apisix/apisix_upstream.go:865   update status   {"status": {"conditions":[{"type":"ResourcesAvailable","status":"True","observedGeneration":1,"lastTransitionTime":"2024-07-09T06:51:15Z","reason":"ResourcesSynced","message":"Sync Successfully"}]}}

Steps to Reproduce

  1. create route/upstream via crd
  2. observe logs

Environment

ikatlinsky commented 2 months ago

@Revolyssup hi! would be nice if that can be addressed in the same way as https://github.com/apache/apisix-ingress-controller/pull/2206, current logging approach makes it barely usable for alerting staff, as too many false positive errors are shown, thanks