gxthrj commented on a change in pull request #163:
URL:
https://github.com/apache/apisix-ingress-controller/pull/163#discussion_r554322220
##########
File path: pkg/ingress/controller/apisix_upstream.go
##########
@@ -112,30 +112,46 @@ func (c *ApisixUpstreamController) processNextWorkItem()
bool {
return true
}
-func (c *ApisixUpstreamController) syncHandler(key string) error {
- namespace, name, err := cache.SplitMetaNamespaceKey(key)
+func (c *ApisixUpstreamController) syncHandler(sqo *UpstreamQueueObj) error {
+ namespace, name, err := cache.SplitMetaNamespaceKey(sqo.Key)
if err != nil {
- log.Errorf("invalid resource key: %s", key)
- return fmt.Errorf("invalid resource key: %s", key)
+ log.Errorf("invalid resource key: %s", sqo.Key)
+ return fmt.Errorf("invalid resource key: %s", sqo.Key)
}
-
- apisixUpstreamYaml, err :=
c.apisixUpstreamList.ApisixUpstreams(namespace).Get(name)
- if err != nil {
- if errors.IsNotFound(err) {
- log.Infof("apisixUpstream %s is removed", key)
+ apisixUpstreamYaml := sqo.OldObj
+ if sqo.Ope == DELETE {
+ apisixIngressUpstream, _ :=
c.apisixUpstreamList.ApisixUpstreams(namespace).Get(name)
+ if apisixIngressUpstream != nil &&
apisixIngressUpstream.ResourceVersion > sqo.OldObj.ResourceVersion {
+ log.Warnf("Upstram %s has been covered when retry",
sqo.Key)
return nil
}
- runtime.HandleError(fmt.Errorf("failed to list apisixUpstream
%s/%s", key, err.Error()))
- return err
+ } else {
+ apisixUpstreamYaml, err =
c.apisixUpstreamList.ApisixUpstreams(namespace).Get(name)
+ if err != nil {
+ if errors.IsNotFound(err) {
+ log.Infof("apisixUpstraem %s is removed",
sqo.Key)
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:
[email protected]