aws-load-balancer-controller
aws-load-balancer-controller copied to clipboard
ALB Rule order
Describe the bug If there are 2 ingress objects in EKS with following specs
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-1
namespace: default
annotations:
alb.ingress.kubernetes.io/group.name: g1
kubernetes.io/ingress.class: alb
spec:
rules:
- host: example.com
http:
paths:
- path: /*
pathType: ImplementationSpecific
backend:
service:
name: example-1-svc
port:
name: http
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-2
namespace: default
annotations:
alb.ingress.kubernetes.io/group.name: g1
kubernetes.io/ingress.class: alb
spec:
rules:
- host: example.com
http:
paths:
- path: /abc/
pathType: Prefix
backend:
service:
name: example-2-svc
port:
name: http
above spec is creating rules in alb with following order
rule1: host:example.com path: /* -> example-1-svc rule2: host:example.com path: abc or abc/* -> example-2-svc
Expected outcome expected rule order should be
rule1: host:example.com path: abc or abc/* -> example-2-svc rule2: host:example.com path: /* -> example-1-svc
Environment
- AWS Load Balancer controller version : v2.4.3
- Kubernetes version : 1.22
- Using EKS (yes/no), if so version? 1.22
@ngoyal16, in this case you have two ingresses belonging to the same ingress group, without explicit ingress order so both of them get the default order of 0. Since both of them have the same order, the controller sorts them based on name/namespace so the rules from ingress-1 comes before the ones from ingress-2.
If you want different ordering, you can specify an explicit group order. For more detail please refer to the live docs https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.4/guide/ingress/annotations/#group.order
Currently path types from multiple rules in an ingress aren't merged. The sorting done as part of issue #2203 applies to the paths within a single rule only. We plan to merge paths from multiple rules for feature request #2678 where we will apply path type sorting.
Since the ingress groups in an ingress still follow the group.order, the behavior mentioned in this issue is as per the expectation. I'm closing this issue.