Skip to content

Conversation

shuqz
Copy link
Collaborator

@shuqz shuqz commented Sep 8, 2025

Description

  • emit exception for grpc route filter (we do not support any type except ExtensionsRef)
  • support source ip with listener rule configuration CRD, below are expected behaviors
    • when indexes are not specified, it will be added to all rule conditions under same grpcRouteRule/httpRouteRule -> this means customer can also try to have separate route and rule crd for each source ip if they think it is more clear for them to manage
    • when indexes are provided, source ip config will be added to the specified indexes (but we recommend customer to maintain the order of rule because it can apply to wrong rule if order changes. to keep minimal effort, they can always put those rules need source ip at beginning of manifest)
    • we recommend to use one rule configuration to one rule, and since there will be multiple matches in a rule, customer can provide matchIndexes so we know which match to apply source ip to

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested

Test case with indexes specified and not specified

---
apiVersion: gateway.k8s.aws/v1beta1
kind: ListenerRuleConfiguration
metadata:
  name: custom-rule-config-source-ip
  namespace: sample-gateway-alb
spec:
  conditions:
    - field: source-ip
      matchIndexes: [0,1]
      sourceIPConfig:
        values:
          - 10.0.0.0/6
          - 10.0.0.0/5
---
apiVersion: gateway.k8s.aws/v1beta1
kind: ListenerRuleConfiguration
metadata:
  name: custom-rule-config-source-ip-2
  namespace: sample-gateway-alb
spec:
  conditions: =======> NOT PROVIDE MATCHINDEXES, will apply to all conditions
    - field: source-ip
      sourceIPConfig:
        values:
          - 10.0.0.0/8
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: http-app-source-ip
  namespace: sample-gateway-alb
spec:
  parentRefs:
    - name: sample-gw-alb
      port: 90
  rules:
    - backendRefs:
        - name: echoserver
          port: 80
      filters:
        - type: ExtensionRef
          extensionRef:
            group: "gateway.k8s.aws"
            kind: "ListenerRuleConfiguration"
            name: "custom-rule-config-source-ip"
      matches:
        - path: # Path Pattern
            type: Exact
            value: /pathExactMatch
          queryParams: # Query String
            - name: "user"
              value: "john"
          method: GET # HTTP Request Method
        - path: # Regex path match
            type: RegularExpression
            value: "/firstRule/some?/users"
    - backendRefs:
        - name: echoserver
          port: 80
      filters:
        - type: ExtensionRef
          extensionRef:
            group: "gateway.k8s.aws"
            kind: "ListenerRuleConfiguration"
            name: "custom-rule-config-source-ip-2"
      matches:
        - path: # Path Pattern
            type: Exact
            value: /secondRulePath
          method: POST # HTTP Request Method
        - path: # Regex path match
            type: RegularExpression
            value: "/secondRule/some?/users"
        - path:
            type: "PathPrefix"
            value: "/secondRule"

Screenshot 2025-09-08 at 3 29 16 PM
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 8, 2025
@zac-nixon
Copy link
Collaborator

can you add an e2e test that makes sure the rule is correctly materialized 🙏

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 10, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shuqz, zac-nixon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 11, 2025
[feat gw-api]update how source ip is suppported

[feat gw-api]add e2e test for source ip

handle rebase conflicts
@shraddhabang
Copy link
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 11, 2025
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 11, 2025
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@shuqz shuqz merged commit 04e8e9b into kubernetes-sigs:main Sep 11, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants