jaysonsantos opened a new issue, #1322:
URL: https://github.com/apache/apisix-ingress-controller/issues/1322
### Issue description
Hi there, I got an edge case where when I have an ingress that uses ALB and
apisix is installed to control other ingresses, the controller erases the
status from the load balancer even though the ingress is not managed by apisix
with the class name.
To test if this was the problem, I applied this patch locally
```diff
diff --git a/pkg/providers/ingress/ingress.go
b/pkg/providers/ingress/ingress.go
index 689dd0b..6f12973 100644
--- a/pkg/providers/ingress/ingress.go
+++ b/pkg/providers/ingress/ingress.go
@@ -457,6 +457,13 @@ func (c *ingressController) recordStatus(at
interface{}, reason string, err erro
)
}
+ if v.Spec.IngressClassName == nil || *v.Spec.IngressClassName
!= c.Config.Kubernetes.IngressClass {
+ log.Warnw(
+ "ignoring ingress update because it is not
managed by apsix",
+ zap.Any("className", v.Spec.IngressClassName),
+ )
+ return
+ }
v.ObjectMeta.Generation = generation
v.Status.LoadBalancer.Ingress = lbips
@@ -477,6 +484,13 @@ func (c *ingressController) recordStatus(at
interface{}, reason string, err erro
)
}
+ if v.Spec.IngressClassName == nil || *v.Spec.IngressClassName
!= c.Config.Kubernetes.IngressClass {
+ log.Warnw(
+ "ignoring ingress update because it is not
managed by apsix",
+ zap.Any("className", v.Spec.IngressClassName),
+ )
+ return
+ }
v.ObjectMeta.Generation = generation
v.Status.LoadBalancer.Ingress = lbips
@@ -496,6 +510,13 @@ func (c *ingressController) recordStatus(at
interface{}, reason string, err erro
)
}
+ if v.Spec.IngressClassName == nil || *v.Spec.IngressClassName
!= c.Config.Kubernetes.IngressClass {
+ log.Warnw(
+ "ignoring ingress update because it is not
managed by apsix",
+ zap.Any("className", v.Spec.IngressClassName),
+ )
+ return
+ }
v.ObjectMeta.Generation = generation
v.Status.LoadBalancer.Ingress = lbips
```
But am not sure if it covers all the possibilities, like the class defined
by annotations.
### 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
1 - create an ingress with alb class for example
2 - simply let ingress controller run and it will override the status,
removing the cname and ip addresses from a load balancer
### Actual result
the ingress loses `.status.loadBalancer.ingress[].hostname`
### Error log
the log won't show anything
### Expected result
`.status.loadBalancer.ingress[].hostname` should be the same as before
something like `k8s-apisix-apisixga-xxxxxx-xxxxxx.us-east-1.elb.amazonaws.com`
--
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]