Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALB Rule order #2763

Closed
ngoyal16 opened this issue Aug 12, 2022 · 2 comments
Closed

ALB Rule order #2763

ngoyal16 opened this issue Aug 12, 2022 · 2 comments

Comments

@ngoyal16
Copy link
Contributor

ngoyal16 commented Aug 12, 2022

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
@kishorj
Copy link
Collaborator

kishorj commented Aug 12, 2022

@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

@kishorj
Copy link
Collaborator

kishorj commented Aug 24, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants