...

Text file src/sigs.k8s.io/gateway-api/examples/standard/http-redirect.yaml

Documentation: sigs.k8s.io/gateway-api/examples/standard

     1apiVersion: gateway.networking.k8s.io/v1beta1
     2kind: GatewayClass
     3metadata:
     4  name: filter-lb
     5spec:
     6  controllerName: acme.io/gateway-controller
     7  parametersRef:
     8    name: acme-lb
     9    group: acme.io
    10    kind: Parameters
    11---
    12apiVersion: v1
    13kind: Namespace
    14metadata:
    15  name: gateway-api-example-ns1
    16---
    17apiVersion: gateway.networking.k8s.io/v1beta1
    18kind: Gateway
    19metadata:
    20  name: my-filter-gateway
    21  namespace: gateway-api-example-ns1
    22spec:
    23  gatewayClassName: filter-lb
    24  listeners:
    25    - name: http
    26      protocol: HTTP
    27      port: 80
    28    - name: https
    29      protocol: HTTPS
    30      port: 443
    31      tls:
    32        certificateRefs:
    33          - kind: Secret
    34            group: ""
    35            name: example-com-cert
    36---
    37apiVersion: gateway.networking.k8s.io/v1beta1
    38kind: HTTPRoute
    39metadata:
    40  name: http-filter-1
    41  namespace: gateway-api-example-ns1
    42spec:
    43  parentRefs:
    44    - name: my-filter-gateway
    45      sectionName: http
    46  hostnames:
    47    - my-filter.example.com
    48  rules:
    49    - filters:
    50        - type: RequestRedirect
    51          requestRedirect:
    52            scheme: https
    53---
    54apiVersion: gateway.networking.k8s.io/v1beta1
    55kind: HTTPRoute
    56metadata:
    57  name: http-filter-2
    58  namespace: gateway-api-example-ns1
    59spec:
    60  parentRefs:
    61    - name: my-filter-gateway
    62      sectionName: https
    63  hostnames:
    64    - my-filter.example.com
    65  rules:
    66    - matches:
    67        - path:
    68            type: PathPrefix
    69            value: /
    70      backendRefs:
    71        - name: my-filter-svc1
    72          weight: 1
    73          port: 80

View as plain text