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

Support Multiple ALB Path Patterns in mu.yml #418

Open
craigtsmith opened this issue Jan 8, 2019 · 1 comment
Open

Support Multiple ALB Path Patterns in mu.yml #418

craigtsmith opened this issue Jan 8, 2019 · 1 comment

Comments

@craigtsmith
Copy link

Description
Currently mu only supports one path pattern for the service ALB, as the generation of the CloudFormation template passes your mu.yml pathPatterns: array directly into the AWS::ElasticLoadBalancingV2::ListenerRule > Conditions > Values property, which despite it's name only accepts one path pattern.

If mu's internals are refactored slightly to generate a new ElbHttp(s)PathListenerRule for each path pattern in mu.yml and the pathPatterns: node n mu.yml is changed from an array to a map, it should be possible to support this use case and preserve the ability to target rules in Cfn, eg:

service:
  name: my-service
  port: 80

  pathPatterns:
    app: /app*
    assets: /assets*

Could become the following Cfn

ElbHttpPathListenerRule-app:
  Condition: HasElbHttpPathListener
  Properties:
    Actions:
    - TargetGroupArn:
        Ref: ElbTargetGroup
      Type: forward
    Conditions:
    - Field: path-pattern
      Values:
        Ref: /app*
    ListenerArn:
      Fn::ImportValue:
        Fn::Sub: ${ElbHttpListenerArn}
    Priority:
      Ref: PathListenerRulePriority
  Type: AWS::ElasticLoadBalancingV2::ListenerRule
ElbHttpPathListenerRule-assets:
  Condition: HasElbHttpPathListener
  Properties:
    Actions:
    - TargetGroupArn:
        Ref: ElbTargetGroup
      Type: forward
    Conditions:
    - Field: path-pattern
      Values:
        Ref: /assets*
    ListenerArn:
      Fn::ImportValue:
        Fn::Sub: ${ElbHttpListenerArn}
    Priority:
      Ref: PathListenerRulePriority
  Type: AWS::ElasticLoadBalancingV2::ListenerRule
@srp
Copy link
Contributor

srp commented Feb 22, 2019

I think the priority should be specified for each path, so maybe:

pathPatterns:
  - name: app
    pathPattern: /app*
    priority: 100
  - name: assets
    pathPattern: /assets*
    priority: 200

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