sigs.k8s.io/gateway-api@v1.0.0/conformance/tests/httproute-method-matching.yaml (about)

     1  apiVersion: gateway.networking.k8s.io/v1
     2  kind: HTTPRoute
     3  metadata:
     4    name: method-matching
     5    namespace: gateway-conformance-infra
     6  spec:
     7    parentRefs:
     8    - name: same-namespace
     9    rules:
    10    - matches:
    11      - method: POST
    12      backendRefs:
    13      - name: infra-backend-v1
    14        port: 8080
    15    - matches:
    16      - method: GET
    17      backendRefs:
    18      - name: infra-backend-v2
    19        port: 8080
    20  
    21    # Combinations with core match types.
    22    - matches:
    23      - path:
    24          type: PathPrefix
    25          value: /path1
    26        method: GET
    27      backendRefs:
    28      - name: infra-backend-v1
    29        port: 8080
    30    - matches:
    31      - headers:
    32        - name: version
    33          value: one
    34        method: PUT
    35      backendRefs:
    36      - name: infra-backend-v2
    37        port: 8080
    38    - matches:
    39      - path:
    40          type: PathPrefix
    41          value: /path2
    42        headers:
    43        - name: version
    44          value: two
    45        method: POST
    46      backendRefs:
    47      - name: infra-backend-v3
    48        port: 8080
    49  
    50    # Match of the form (cond1 AND cond2) OR (cond3 AND cond4 AND cond5)
    51    - matches:
    52      - path:
    53          type: PathPrefix
    54          value: /path3
    55        method: PATCH
    56      - path:
    57          type: PathPrefix
    58          value: /path4
    59        headers:
    60        - name: version
    61          value: three
    62        method: DELETE
    63      backendRefs:
    64      - name: infra-backend-v1
    65        port: 8080
    66  
    67    # Matches for checking precedence.
    68    - matches:
    69      - path:
    70          type: PathPrefix
    71          value: /path5
    72      backendRefs:
    73      - name: infra-backend-v1
    74        port: 8080
    75    - matches:
    76      - method: PATCH
    77      backendRefs:
    78      - name: infra-backend-v2
    79        port: 8080
    80    - matches:
    81      - headers:
    82        - name: version
    83          value: four
    84      backendRefs:
    85      - name: infra-backend-v3
    86        port: 8080