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 2020/12/17 01:03:07 UTC
[GitHub] [apisix-ingress-controller] gxthrj opened a new pull request #103: fix: add item to workqueue with delay when syncFailed
gxthrj opened a new pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103
Fix: #59
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj merged pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
gxthrj merged pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103#discussion_r544931268
##########
File path: pkg/ingress/controller/apisix_route.go
##########
@@ -211,18 +212,15 @@ func (c *ApisixRouteController) sync(rqo *RouteQueueObj) error {
log.Errorf("invalid resource key: %s", key)
return fmt.Errorf("invalid resource key: %s", key)
}
-
- apisixIngressRoute, err := c.apisixRouteList.ApisixRoutes(namespace).Get(name)
- if err != nil {
- if errors.IsNotFound(err) {
- log.Infof("apisixRoute %s is removed", key)
- return nil
- }
- runtime.HandleError(fmt.Errorf("failed to list apisixRoute %s/%s", key, err.Error()))
- return err
- }
switch {
case rqo.Ope == UPDATE:
+ apisixIngressRoute, err := c.apisixRouteList.ApisixRoutes(namespace).Get(name)
+ if err != nil {
+ if errors.IsNotFound(err) {
+ log.Errorf("apisixRoute %s is removed", key)
Review comment:
Yes
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-io edited a comment on pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103#issuecomment-747137529
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=h1) Report
> Merging [#103](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=desc) (2ead599) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/04ab348eb343485f01837fe1da456156e5131deb?el=desc) (04ab348) will **not change** coverage.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #103 +/- ##
=======================================
Coverage 59.73% 59.73%
=======================================
Files 16 16
Lines 524 524
=======================================
Hits 313 313
Misses 187 187
Partials 24 24
```
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=footer). Last update [04ab348...2ead599](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103#discussion_r544929977
##########
File path: pkg/ingress/controller/apisix_route.go
##########
@@ -100,14 +100,15 @@ func (c *ApisixRouteController) updateFunc(oldObj, newObj interface{}) {
}
func (c *ApisixRouteController) deleteFunc(obj interface{}) {
+ oldRoute := obj.(cache.DeletedFinalStateUnknown).Obj.(*api6V1.ApisixRoute)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-io edited a comment on pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103#issuecomment-747137529
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=h1) Report
> Merging [#103](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=desc) (1e968eb) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/04ab348eb343485f01837fe1da456156e5131deb?el=desc) (04ab348) will **not change** coverage.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #103 +/- ##
=======================================
Coverage 59.73% 59.73%
=======================================
Files 16 16
Lines 524 524
=======================================
Hits 313 313
Misses 187 187
Partials 24 24
```
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=footer). Last update [04ab348...1e968eb](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103#discussion_r544935738
##########
File path: pkg/ingress/controller/apisix_route.go
##########
@@ -232,10 +230,15 @@ func (c *ApisixRouteController) sync(rqo *RouteQueueObj) error {
rc := &state.RouteCompare{OldRoutes: oldRoutes, NewRoutes: newRoutes}
return rc.Sync()
case rqo.Ope == DELETE:
- apisixRoute := apisix.ApisixRoute(*apisixIngressRoute)
+ apisixIngressRoute, _ := c.apisixRouteList.ApisixRoutes(namespace).Get(name)
+ if apisixIngressRoute != nil && apisixIngressRoute.ResourceVersion > rqo.OldObj.ResourceVersion {
Review comment:
Done, add a warn level log
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-io edited a comment on pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103#issuecomment-747137529
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=h1) Report
> Merging [#103](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=desc) (9c7f0b7) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/04ab348eb343485f01837fe1da456156e5131deb?el=desc) (04ab348) will **not change** coverage.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #103 +/- ##
=======================================
Coverage 59.73% 59.73%
=======================================
Files 16 16
Lines 524 524
=======================================
Hits 313 313
Misses 187 187
Partials 24 24
```
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=footer). Last update [04ab348...f936b6b](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103#discussion_r544738012
##########
File path: pkg/ingress/controller/apisix_route.go
##########
@@ -144,6 +144,7 @@ func (c *ApisixRouteController) processNextWorkItem() bool {
}
// 在syncHandler中处理业务
if err := c.syncHandler(rqo); err != nil {
+ c.workqueue.AddRateLimited(obj)
Review comment:
We'd better to log this event.
##########
File path: pkg/ingress/controller/apisix_service.go
##########
@@ -89,16 +95,15 @@ func (c *ApisixServiceController) processNextWorkItem() bool {
}
err := func(obj interface{}) error {
defer c.workqueue.Done(obj)
- var key string
+ var sqo *ServiceQueueObj
var ok bool
-
- if key, ok = obj.(string); !ok {
+ if sqo, ok = obj.(*ServiceQueueObj); !ok {
c.workqueue.Forget(obj)
return fmt.Errorf("expected string in workqueue but got %#v", obj)
Review comment:
Typo, should be "expected ServiceQueueObj object in workqueue but got %#v".
##########
File path: pkg/ingress/controller/apisix_route.go
##########
@@ -211,18 +212,15 @@ func (c *ApisixRouteController) sync(rqo *RouteQueueObj) error {
log.Errorf("invalid resource key: %s", key)
return fmt.Errorf("invalid resource key: %s", key)
}
-
- apisixIngressRoute, err := c.apisixRouteList.ApisixRoutes(namespace).Get(name)
- if err != nil {
- if errors.IsNotFound(err) {
- log.Infof("apisixRoute %s is removed", key)
- return nil
- }
- runtime.HandleError(fmt.Errorf("failed to list apisixRoute %s/%s", key, err.Error()))
- return err
- }
switch {
case rqo.Ope == UPDATE:
+ apisixIngressRoute, err := c.apisixRouteList.ApisixRoutes(namespace).Get(name)
+ if err != nil {
+ if errors.IsNotFound(err) {
+ log.Errorf("apisixRoute %s is removed", key)
Review comment:
If the apisixRoute is removed, we don't need to retry, so just return `nil`.
##########
File path: pkg/ingress/controller/apisix_route.go
##########
@@ -100,14 +100,15 @@ func (c *ApisixRouteController) updateFunc(oldObj, newObj interface{}) {
}
func (c *ApisixRouteController) deleteFunc(obj interface{}) {
+ oldRoute := obj.(cache.DeletedFinalStateUnknown).Obj.(*api6V1.ApisixRoute)
Review comment:
Reference to istio: https://github.com/istio/istio/blob/18b3d35de0523862a389553b50b13ee4e73f4530/pilot/pkg/serviceregistry/kube/controller/namespacecontroller.go#L160
##########
File path: pkg/ingress/controller/apisix_route.go
##########
@@ -232,10 +230,15 @@ func (c *ApisixRouteController) sync(rqo *RouteQueueObj) error {
rc := &state.RouteCompare{OldRoutes: oldRoutes, NewRoutes: newRoutes}
return rc.Sync()
case rqo.Ope == DELETE:
- apisixRoute := apisix.ApisixRoute(*apisixIngressRoute)
+ apisixIngressRoute, _ := c.apisixRouteList.ApisixRoutes(namespace).Get(name)
+ if apisixIngressRoute != nil && apisixIngressRoute.ResourceVersion > rqo.OldObj.ResourceVersion {
Review comment:
We'd better to log it, it's somewhat confusing (if we don't know the retry knowledge background).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] codecov-io commented on pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103#issuecomment-747137529
# [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=h1) Report
> Merging [#103](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=desc) (6896743) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/53496e6847b4e086e881c63b8673559e183ae93e?el=desc) (53496e6) will **not change** coverage.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #103 +/- ##
=======================================
Coverage 58.28% 58.28%
=======================================
Files 15 15
Lines 501 501
=======================================
Hits 292 292
Misses 185 185
Partials 24 24
```
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=footer). Last update [53496e6...6896743](https://codecov.io/gh/apache/apisix-ingress-controller/pull/103?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #103: fix: add item to workqueue with delay when syncFailed
Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #103:
URL: https://github.com/apache/apisix-ingress-controller/pull/103#discussion_r544922194
##########
File path: pkg/ingress/controller/apisix_route.go
##########
@@ -144,6 +144,7 @@ func (c *ApisixRouteController) processNextWorkItem() bool {
}
// 在syncHandler中处理业务
if err := c.syncHandler(rqo); err != nil {
+ c.workqueue.AddRateLimited(obj)
Review comment:
Done
##########
File path: pkg/ingress/controller/apisix_service.go
##########
@@ -89,16 +95,15 @@ func (c *ApisixServiceController) processNextWorkItem() bool {
}
err := func(obj interface{}) error {
defer c.workqueue.Done(obj)
- var key string
+ var sqo *ServiceQueueObj
var ok bool
-
- if key, ok = obj.(string); !ok {
+ if sqo, ok = obj.(*ServiceQueueObj); !ok {
c.workqueue.Forget(obj)
return fmt.Errorf("expected string in workqueue but got %#v", obj)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org