aws-load-balancer-controller icon indicating copy to clipboard operation
aws-load-balancer-controller copied to clipboard

Combine multiple LB rules to one rule with OR

Open nirroz93 opened this issue 1 year ago • 7 comments

Is your feature request related to a problem? Let's say we have the following (I used use-annotation, but it doesn't matter)

   - host: myFirstDNS.example.com
      http:
        paths:
        - backend:
            service:
              name: canary
              port:
                name: use-annotation
          path: /
          pathType: Prefix
    - host: mySecondDNS.example.com
      http:
        paths:
        - backend:
            service:
              name: canary
              port:
                name: use-annotation
          path: /
          pathType: Prefix

This will create 2 Load Balancer rules on the load balancer, the first with condition:

Path Pattern is /*, AND
HTTP Host Header is myFirstDNS.example.com

and the second with condition:

Path Pattern is /*, AND
HTTP Host Header is mySecondDNS.example.com

However, it could have created only 1 rule with condition

Path Pattern is /*, AND
HTTP Host Header is myFirstDNS.example.com or mySecondDNS.example.com

Creating multiple rules increase the rules evaluation (and therefore creates additional costs), and it's also less clear. Describe the solution you'd like Combine ingress rules with the same settings but different prefix\host to one rule

Describe alternatives you've considered Creating multiple LBs to avoid the extra evaluations costs

nirroz93 avatar Oct 24 '23 10:10 nirroz93

It would be nice to see this implemented :+1: It would partially solve this one https://github.com/kubernetes-sigs/aws-load-balancer-controller/issues/1784 too.

TheSAS avatar Dec 27 '23 11:12 TheSAS

Thanks for bringing this up, I think it's a good improvement to have. I think we can have the controller to merge the paths for each ingress if:

  • they are routing to the same service, and
  • they have the same host, and
  • they are of the same pathType

For example, when creating an ingress with the following spec:

spec:
  rules:
    - http:
        paths:
          - path: /test1
            pathType: ImplementationSpecific
            backend:
              service:
                name: my_service
                port:
                  number: 80
          - path: /test2
            pathType: ImplementationSpecific
            backend:
              service:
                name: my_service
                port:
                  number: 80
    - http:
        paths:
          - path: /*
            pathType: ImplementationSpecific
            backend:
              service:
                name: my_service
                port:
                  number: 80

The controller is generating three rules right now:

  • rule 1: /test1 → my_service
  • rule 2: /test 2 → my_service
  • rule 3: /* → my_service

With the change the controller will only generate one rule:

  • rule 1: /test1 OR /test2 OR /* → my_service

oliviassss avatar Jan 18 '24 01:01 oliviassss

/kind feature

oliviassss avatar Jan 18 '24 01:01 oliviassss

What is the maximum number of characters (or clauses) that can be merged into a single matcher line? If a rule would exceed it, it should be split into multiple rules at some boundary.

jcogilvie avatar Jan 18 '24 03:01 jcogilvie

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Apr 17 '24 03:04 k8s-triage-robot

/remove-lifecycle stale

jcogilvie avatar Apr 17 '24 15:04 jcogilvie

/assign

omerap12 avatar Jun 18 '24 18:06 omerap12

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Sep 16 '24 19:09 k8s-triage-robot

/remove-lifecycle stale

henryzhao95 avatar Sep 16 '24 23:09 henryzhao95