-
Notifications
You must be signed in to change notification settings - Fork 352
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
wildcard hostname match not possible #1637
Comments
@NorthFury @aryszka can this be considered safe to reduce weight by adding |
We need to change for this what we allow as the hostname. OTOH, I would try to avoid the solution based on the Weight, because it can lead to unforeseen long term challenges. Would an approach like the following help here?
This would limit the matched hostnames to fixed set, but I believe that should be managaeble, unless we face a situation where dozens/hunderds of hostnames, or an unknown set of hostnames need to be handled. In that case the following trick can work:
Note that we don't use the Weight() predicate. The additional Host() header for the |
This What I wonder was that when I did not had the Weight() I IIRC got 404, now it just work without Weight().
|
for that case, when the owner doesn't know the hostnames in advance, I recommend the second example described above. Of course it still needs changes to what we allow in the route groups. The
Careful! It's still an undefined behavior, if you restart skipper a couple of times, you will probably have different results, receiving only 418s. |
I don't think that approach is a great one. :)
I consider this as, I was doing something wrong. I could have tricked myself.
I think we should consider this as bug and we should fix it long term (v1 ?) with a routing tree change. Maybe the internal proposed "hostname before path match" should be also considered. So a basically 2 tree lookups (or one tree with both), first host, second path to reduce the predicate list to match. |
There is this option of having high priority predicates. Following through with this idea in the current code setup, one could have a Notes
|
If it is about Lines 814 to 823 in 4dcbf4b
that already seemed adhoc to me The problem of wildcard domain match feels similar to wildcard path matching. |
I would argue that wildcard domain matching is much more limited in scope. I would choose not to increase the complexity because of it, at least not without having good use cases for it. And to explain my suggestion, there is already a list of "high priority" predicates, although not marked as such. In fact, the current Lines 31 to 43 in aa497f6
And here is where those are used: Lines 447 to 473 in aa497f6
|
@szuecs While wildcards are fine, we could solve the problem also more efficiently with a host-suffix support instead of wildcards. |
@tkrop the normal way of suffix match won’t be possible for DNS (only one wildcard until the dot is possible) and I am not yet talking about implementation details only about what to achieve. We could perfectly do in skipper a suffix search and enforce via jsonSchema. |
I think we should do the work around mentioned in #1637 (comment) to add in all cases the
|
I think it should be other way around - use Lines 341 to 355 in 1e26fcd
E.g. (note that correct wildcard regexp should be more complex https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address):
|
@AlexanderYastrebov I would rather use |
Related #284 |
Another idea is to allow apiVersion: zalando.org/v1
kind: RouteGroup
metadata:
name: my-api
spec:
hosts: []
backends:
- name: my-api-http
serviceName: my-api-service
servicePort: 8080
type: service
routes:
- pathSubtree: /api
predicates:
- Host(/[a-z0-9]+[.]example[.]org/)
backends:
- backendName: my-api-service The DNS entries for the hosts then might be created either via external-dns CRD or via another auxiliary apiVersion: zalando.org/v1
kind: RouteGroup
metadata:
name: my-api-hosts
spec:
hosts:
- foo.example.org
- bar.example.org
- baz.example.org
backends:
- name: shunt
type: shunt
routes:
- path: /whatever
predicates:
- False()
backends:
- backendName: shunt Another usecase for the host-less |
We could also create a spec.hostRegexp that is optional and one of spec.hosts and spec.hostRegexp should be defined |
There are some issues specific to Kubernetes:
"*.example.org"
because of the regexp match that enforces[a-z0-9].
in CRD"*.example.org"
would need special handling, because it should be treated asHost(/[a-z0-9]+[.]example[.]org/)
The matching would need to be done carefully such that an ingress with
www.example.org
is not caught by a RouteGroup with*.example.org
An example how we could use
Weight()
:Right now the dataclient kubernetes would create errors while creating a route for host with
*.example.org
:The text was updated successfully, but these errors were encountered: