zalando / skipper

An HTTP router and reverse proxy for service composition, including use cases like Kubernetes Ingress
https://opensource.zalando.com/skipper/
Other
3.12k stars 351 forks source link

host2regex: doesn't take in consideration `*` #3296

Open MustafaSaber opened 3 weeks ago

MustafaSaber commented 3 weeks ago

converting host from Ingress/RouteGroup for Host predicate doesn't take into consideration that Ingress support wildcard hostnames (see https://kubernetes.io/docs/concepts/services-networking/ingress/#hostname-wildcards) and we produce invalid regex

This PR adds testcases to reproduce the error, requires fix before merging.

following ingress produce

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: simple
  labels:
    name: simple
spec:
  rules:
  - host: "*.example.org"
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: simple
            port: 
              number: 80

Error:

[APP]time="2024-11-01T12:43:46Z" level=error msg="kube_default__simple_redirect_app_default_0____example_org_____ [2]: error parsing regexp: missing argument to repetition operator: *

fixes https://github.com/zalando/skipper/issues/3297

MustafaSaber commented 3 weeks ago

maybe it's not a good idea to have this at all

MustafaSaber commented 3 weeks ago

See https://github.com/zalando/skipper/issues/3297#issuecomment-2454827352

MustafaSaber commented 2 weeks ago

@szuecs

A problem with the current implementation is that a request can flap between 2 or more routes

request to foo.example with

r: Host("*.example") -> <shunt>;
s: Host("foo.example") -> <shunt>;