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

Ensure uniqueness of generated locations #428

Closed
pleshakov opened this issue Feb 13, 2023 · 2 comments · Fixed by #1445
Closed

Ensure uniqueness of generated locations #428

pleshakov opened this issue Feb 13, 2023 · 2 comments · Fixed by #1445
Assignees
Labels
area/nginx-configuration Relates to nginx configuration bug Something isn't working good first issue Good for newcomers refined Requirements are refined and the issue is ready to be implemented. size/small Estimated to be completed within ~2 days
Milestone

Comments

@pleshakov
Copy link
Contributor

pleshakov commented Feb 13, 2023

Describe the bug

For advanced content based routing, NKG generated auxiliary location for each match. However, those generated locations can clash with regular locations defined in an HTTPRoute and cause unintended behavior.

To Reproduce

  1. Deploy NGF
  2. Create gateway
  3. Create coffee app
  4. Create the following HTTPRoute:
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: coffee
spec:
  parentRefs:
  - name: gateway
    sectionName: http
  hostnames:
  - "cafe.example.com"
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /coffee_prefix_route0
    backendRefs:
    - name: coffee-v1-svc
      port: 80
  - matches:
    - path:
        type: PathPrefix
        value: /coffee
      headers:
      - name: version
        value: v2
    backendRefs:
    - name: coffee-v2-svc
      port: 80

Get /coffee with header "version:v2" :

curl --resolve cafe.example.com:$GW_PORT:$GW_IP http://cafe.example.com:$GW_PORT/coffee -H "version:v2"

Should get response from coffee-v2, however the response comes from coffee-v1:

Server name: coffee-v1-58f4c685db-6djfc
Date: 15/Dec/2023:20:05:01 +0000
URI: /coffee
Request ID: 466b32ecd006ed8d9cdff2cbb5e8afeb

Expected behavior

  • If a regular location clashes with an internal location, an error is reported that alerts the user of the specific issue.

The generated config (excerpts):

    location /coffee_prefix_route0 {...}

    location /coffee/ {...}

    location = /coffee {...}

    location /coffee_prefix_route0/ {...}

    location = /coffee_prefix_route0 {...}

Your environment

  • Version of the NGINX Kubernetes Gateway - latest edge {"level":"info","ts":"2023-02-13T19:29:27Z","msg":"Starting NGINX Kubernetes Gateway","version":"0.1.0-rc.1-SNAPSHOT-1ee6b14","commit":"1ee6b14e09f9cd2bbf825f17a052b62749ce3ce2","date":"2023-02-13T18:44:39Z"}
@pleshakov pleshakov added the bug Something isn't working label Feb 13, 2023
@kate-osborn
Copy link
Contributor

@kate-osborn kate-osborn added this to the v1.0.0 milestone Mar 21, 2023
@kate-osborn kate-osborn added the area/nginx-configuration Relates to nginx configuration label Mar 21, 2023
@mpstefan mpstefan modified the milestones: v1.0.0, v1.0.1 Aug 11, 2023
@mpstefan
Copy link
Collaborator

Additional Acceptance Criteria:

  • Update internal locations to generate with a new prefix.
  • Generated prefix is documented.

@mpstefan mpstefan added refined Requirements are refined and the issue is ready to be implemented. size/small Estimated to be completed within ~2 days good first issue Good for newcomers labels Sep 11, 2023
@mpstefan mpstefan modified the milestones: v1.0.1, v1.1.0 Sep 26, 2023
@mpstefan mpstefan modified the milestones: v1.1.0, v1.2.0 Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/nginx-configuration Relates to nginx configuration bug Something isn't working good first issue Good for newcomers refined Requirements are refined and the issue is ready to be implemented. size/small Estimated to be completed within ~2 days
Projects
None yet
4 participants