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

How do I create rule without path-pattern ? #573

Closed
sawanoboly opened this issue Aug 22, 2018 · 5 comments
Closed

How do I create rule without path-pattern ? #573

sawanoboly opened this issue Aug 22, 2018 · 5 comments

Comments

@sawanoboly
Copy link

I thought that using this plugin, I would like to create a rule with only the host header. The definition is as follows.

spec:
  backend:
    serviceName: fallback-nginx
    servicePort: 80
  rules:
    - host: myapp1.example.com
      http:
        paths:
          - backend:
              serviceName: myapp1
              servicePort: 80

However, path-pattern '/' is automatically added. I want to exclude the path-pattern from the rule, is it possible?

$ aws elbv2 describe-rules  --rule-arns arn:aws:elasticloadbalancing:us-west-2:xxxxxx:listener-rule/app/xxxxxx
{
    "Rules": [
        {
            "RuleArn": "arn:aws:elasticloadbalancing:us-west-2:xxxxxx:listener-rule/app/xxxxxx",
            "Priority": "1",
            "Conditions": [
                {
                    "Field": "path-pattern",
                    "Values": [
                        "/"
                    ]
                },
                {
                    "Field": "host-header",
                    "Values": [
                        "myapp1.example.com"
                    ]
                }
            ],
            "Actions": [
                {
                    "Type": "forward",
                    "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:xxxxxx:listener-rule/app/xxxxxx"
                }
            ],
            "IsDefault": false
        }
    ]
}
@bigkraig
Copy link

bigkraig commented Sep 5, 2018

It's not possible, the ALB requires that a rule matches a path. Does this create an issue or is it just unexpected?

@sawanoboly
Copy link
Author

sawanoboly commented Sep 5, 2018

https://docs.aws.amazon.com/ja_jp/elasticloadbalancing/latest/APIReference/API_RuleCondition.html

ALB allows host-header only rule, path-pattern could omitted.

for example

ec2 management console 2018-09-06 02-56-03

Current situation If we want to use host name based routing using this plugin, we need to set /* to path-pattern for all. This means that we can only use half the maximum number of if matches.

@rabbitfang
Copy link

I am also being affected by this issue. It appears this bug was introduced in #476 (first released as 1.0-beta.5) in this repo; kubernetes/ingress-nginx#2244 introduced the behavior for the nginx ingress controller, which works for nginx because the paths in nginx are prefixes, not exact matches or globs.

I can verify that path-less rules work in version 1.0-alpha.9, and I have reverted to that version to resolve the issue.

@bigkraig
Copy link

yeah totally a bug, was just fixed in #670

@sawanoboly
Copy link
Author

@bigkraig

The problem close to Issue was reviving.
I think that it is probably the following commit, "/*" is automatically added to it.

9d354b8

If there is no path-pattern or if "/ *" is specified for path-pattern, both actions are the same, but the upper limit (100) of the number of rules applicable to ALB has been affected. By specifying "/ *" automatically, host-based rules can only be created up to 50.

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

No branches or pull requests

3 participants