|
| 1 | +// Modules included in the following assemblies: |
| 2 | +// |
| 3 | +// * networking/gateway-api.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: CONCEPT |
| 6 | +[id="nw-ingress-gateway-api-implementation_{context}"] |
| 7 | += {product-title}'s Gateway API implementation |
| 8 | +
|
| 9 | +The Ingress Operator manages the lifecycle of Gateway API CRDs in a way that enables other vendor implementations to make use of CRDs defined in an {product-title} cluster. |
| 10 | +
|
| 11 | +In some situations, the Gateway API provides one or more fields that an given vendor implementation does not support, but that implementation is otherwise compatible in schema with the rest of the fields. These "dead fields" can result in disruption of Ingress workloads, improperly provisioned applications and services, and security related issues. Because {product-title} uses a specific version of Gateway API CRDs, any use of third-party implementations of Gateway API must conform to the {product-title} implementation to ensure that all fields work as expected. |
| 12 | +
|
| 13 | +Any CRDs created within an {product-title} {product-version} cluster will be compatibly versioned and maintained by the Ingress Operator. In the case that CRDs are already present but were not previously managed by the Ingress Operator, the Ingress Operator will check if these configurations are compatible with the Gateway API version supported by {product-title}, and create an admin-gate that requires your acknowledgment of CRD succession. |
| 14 | +
|
| 15 | +[IMPORTANT] |
| 16 | +==== |
| 17 | +If you are updating your cluster from a previous {product-title} version that contains Gateway API CRDs, you must make changes to these resources such that it exactly matches the version supported by {product-title}. Otherwise, you will not be able to update your cluster. This is because those CRDs were not managed by {product-title}, and could contain functionality that is unsupported by Red{nbsp}Hat. |
| 18 | +==== |
| 19 | +
|
| 20 | +[id="nw-ingress-gateway-api-deployment_{context}"] |
| 21 | +== Deployment topologies |
| 22 | +
|
| 23 | +Gateway API is designed to accomodate two topologies: shared gateways or dedicated gateways. Each topology hastheir advantages and comes with different security implications. |
| 24 | +
|
| 25 | +Dedicated gateway:: routes and any load balancers or proxies are served from the same namespace. The `Gateway` |
| 26 | +object restricts routes to a particular application namespace. This is the default topology for Gateway API in {product-title}. |
| 27 | +
|
| 28 | +Shared gateway:: routes are served from multiple namespaces or with multiple hostnames. The `Gateway` object filters allow routes from application namespaces using the `spec.listeners.allowedRoutes.namespaces` field. |
| 29 | +
|
| 30 | +[id="dedicated-gateway-example_{context}"] |
| 31 | +=== Dedicated gateway example |
| 32 | +An example of a `Gateway` resource, `fin-gateway`: |
| 33 | ++ |
| 34 | +.Example dedicated `Gateway` resource |
| 35 | +[source,yaml] |
| 36 | +---- |
| 37 | +apiVersion: gateway.networking.k8s.io/v1 |
| 38 | +kind: Gateway |
| 39 | +metadata: |
| 40 | + name: fin-gateway |
| 41 | + namespace: openshift-ingress |
| 42 | +spec: |
| 43 | + listeners: |
| 44 | + - name: http |
| 45 | + protocol: HTTP |
| 46 | + port: 8080 |
| 47 | +---- |
| 48 | +
|
| 49 | +An example of the associated `HTTPRoute` resource, `sales-db`, that attaches to the dedicated `Gateway` object: |
| 50 | ++ |
| 51 | +.Example `HTTPRoute` resource |
| 52 | +[source,yaml] |
| 53 | +---- |
| 54 | +apiVersion: gateway.networking.k8s.io/v1 |
| 55 | +kind: HTTPRoute |
| 56 | +metadata: |
| 57 | + name: sales-db |
| 58 | + namespace: openshift-ingress |
| 59 | +spec: |
| 60 | + parentRefs: |
| 61 | + - name: fin-gateway |
| 62 | + rules: |
| 63 | + - backendRefs: |
| 64 | + - name: sales-db |
| 65 | + port: 8080 |
| 66 | +---- |
| 67 | +
|
| 68 | +The `HTTPRoute` resource must have the `Gateway` object's name as the value for its `parentRefs` field in order to attach to the gateway. Implicitly, the route is assumed to be in the same namespace as the `Gateway` object. |
| 69 | +
|
| 70 | +[id="shared-gateway-example_{context}"] |
| 71 | +=== Shared gateway example |
| 72 | +An example of a `Gateway` resource, `devops-gateway`, that has a label selector `spec.listeners.allowedRoutes.namespaces` set to match any namespaces containing `shared-gateway-access: "true"`: |
| 73 | ++ |
| 74 | +.Example shared `Gateway` resource |
| 75 | +[source,yaml] |
| 76 | +---- |
| 77 | +apiVersion: gateway.networking.k8s.io/v1 |
| 78 | +kind: Gateway |
| 79 | +metadata: |
| 80 | + name: devops-gateway |
| 81 | + namespace: openshift-ingress |
| 82 | +listeners: |
| 83 | + - name: https |
| 84 | + protocol: HTTPS |
| 85 | + hostname: "example.com" |
| 86 | + allowedRoutes: |
| 87 | + namespaces: |
| 88 | + from: Selector |
| 89 | + selector: |
| 90 | + matchLabels: |
| 91 | + shared-gateway-access: "true" |
| 92 | + tls: |
| 93 | + certificateRefs: |
| 94 | + - name: example-com |
| 95 | +---- |
| 96 | +
|
| 97 | +Examples of the allowed namespaces for the `devops-gateway` resource: |
| 98 | ++ |
| 99 | +.Example `Namespace` resources |
| 100 | +[source,yaml] |
| 101 | +---- |
| 102 | +apiVersion: v1 |
| 103 | +kind: Namespace |
| 104 | +metadata: |
| 105 | + name: dev |
| 106 | + labels: |
| 107 | + shared-gateway-access: "true" |
| 108 | +--- |
| 109 | +apiVersion: v1 |
| 110 | +kind: Namespace |
| 111 | +metadata: |
| 112 | + name: ops |
| 113 | + labels: |
| 114 | + shared-gateway-access: "true" |
| 115 | +---- |
| 116 | +
|
| 117 | +An example of two `HTTPRoute` resources, `dev-portal` and `ops-home`, that sit in different namespaces but are attached to the shared gateway: |
| 118 | ++ |
| 119 | +[source,yaml] |
| 120 | +---- |
| 121 | +apiVersion: v1 |
| 122 | +kind: HTTPRoute |
| 123 | +metadata: |
| 124 | + name: dev-portal |
| 125 | + namespace: dev |
| 126 | +spec: |
| 127 | + parentRefs: |
| 128 | + - name: devops-gateway |
| 129 | + namespace: openshift-ingress-operator |
| 130 | + rules: |
| 131 | + - backendRefs: |
| 132 | + - name: dev-portal |
| 133 | + port: 8080 |
| 134 | +--- |
| 135 | +apiVersion: v1 |
| 136 | +kind: HTTPRoute |
| 137 | +metadata: |
| 138 | + name: ops-home |
| 139 | + namespace: ops |
| 140 | +spec: |
| 141 | + parentRefs: |
| 142 | + - name: devops-gateway |
| 143 | + namespace: openshift-ingress-operator |
| 144 | + rules: |
| 145 | + - backendRefs: |
| 146 | + - name: ops-home |
| 147 | + port: 8080 |
| 148 | +---- |
| 149 | +
|
| 150 | +With a shared gateway topology, the routes must specify the namespace of the `Gateway` object it wants to attach to. Multiple `Gateway` objects can be deployed and shared across namespaces. When there are multiple shared gateways this becomes conceptually similar to xref:../networking/configuring-ingress-cluster-traffic/configuring-ingress-cluster-traffic-ingress-controller.adoc#nw-ingress-sharding-concept[Ingress Controller sharding]. |
| 151 | +
|
0 commit comments