Skip to content

KIC creates multiple Kong Routes per path + method in an HTTPRoute #7677

@chilledornaments

Description

@chilledornaments

Is there an existing issue for this?

  • I have searched the existing issues

Does this enhancement require public documentation?

  • I have added an Acceptance Criteria item for adding and/or adjusting public documentation (if applicable)

Problem Statement

When a user creates an HTTPRoute with multiple matches for the same path but with different methods, KIC creates one Kong Route per path+method combination. While this is expected based on the httpRouteMatchMeta.getKey() method, this behavior is counterintuitive to how decK, the Terraform provider, and Kong Manager function; a user is able to configure multiple methods on a single route. This isn't a problem operationally, but does lead to some route bloat.

Here's an example manifest. KIC will create two Kong Routes from this - one that accepts GET on example.com/foo and another that accepts POST on example.com/foo:

---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: foo
  namespace: default
spec:
  parentRefs:
    - group: gateway.networking.k8s.io
      kind: Gateway
      name: kong
      namespace: kong
  hostnames:
    - example.com
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /foo
          method: "OPTIONS"
        - path:
            type: PathPrefix
            value: /foo
          method: "POST"
      backendRefs:
        - kind: Service
          group: ""
          name: foo-blah
          port: 8888

Proposed Solution

Ideally, KIC would allow merging multiple HTTPRouteMatch with the same path but different method into a single Kong Route.

Additional information

No response

Acceptance Criteria

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions