Skip to content

Commit 8af86a2

Browse files
committed
TCPRoute: add local testing setup and docs
Signed-off-by: Yury Tsarev <yury@upbound.io>
1 parent 8bfdcf7 commit 8af86a2

File tree

4 files changed

+63
-3
lines changed

4 files changed

+63
-3
lines changed

controllers/refresolver/testdata/gslb_gatewayapi_tcproute.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Gslb
33
metadata:
44
name: gatewayapi-tcproute
55
namespace: test-gslb
6-
labels:
6+
annotations:
77
k8gb.io/hostname: gatewayapi-tcproute.cloud.example.com
88
spec:
99
resourceRef:

deploy/gslb/gatewayapi_gateway.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ spec:
1313
allowedRoutes:
1414
namespaces:
1515
from: All
16+
- name: tcp
17+
protocol: TCP
18+
port: 8000
19+
allowedRoutes:
20+
kinds:
21+
- kind: TCPRoute
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
apiVersion: gateway.networking.k8s.io/v1alpha2
3+
kind: TCPRoute
4+
metadata:
5+
name: failover-tcproute
6+
namespace: test-gslb-gatewayapi
7+
spec:
8+
parentRefs:
9+
- name: gatewayapi
10+
namespace: istio-ingress
11+
rules:
12+
- backendRefs:
13+
- name: frontend-podinfo
14+
port: 9898
15+
---
16+
apiVersion: k8gb.absa.oss/v1beta1
17+
kind: Gslb
18+
metadata:
19+
name: failover-tcproute
20+
namespace: test-gslb-gatewayapi
21+
annotations:
22+
k8gb.io/hostname: gatewayapi-tcproute.cloud.example.com
23+
spec:
24+
resourceRef:
25+
apiVersion: gateway.networking.k8s.io/v1alpha2
26+
kind: TCPRoute
27+
name: failover-tcproute
28+
strategy:
29+
type: failover
30+
primaryGeoTag: eu

docs/resource_ref.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
Starting from v0.15.0, k8gb introduces a much simpler way to link a GSLB resource to an Ingress object in Kubernetes. You no longer need to duplicate the Ingress configuration in your GSLB definition—instead, you can simply reference an existing Ingress.
33
This makes your Ingress the single source of truth for application routing.
44

5-
K8GB supports the following ingress resources:
5+
K8GB supports the following ingress resources:
66

77
* [Kubernetes Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/)
88
* [Kubernetes LoadBalancer Service](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer)
99
* [Istio Virtual Service](https://istio.io/latest/docs/reference/config/networking/virtual-service/)
10-
* Gateway API's [HTTPRoute](https://gateway-api.sigs.k8s.io/api-types/httproute/) and [GRPCRoute](https://gateway-api.sigs.k8s.io/api-types/grpcroute/) - to be released in v0.17.0
10+
* Gateway API Resources(to be released in **v0.17.0**):
11+
- [HTTPRoute](https://gateway-api.sigs.k8s.io/api-types/httproute/)
12+
- [GRPCRoute](https://gateway-api.sigs.k8s.io/api-types/grpcroute/)
13+
- [TCPRoute](https://gateway-api.sigs.k8s.io/guides/tcp/)
1114

1215
## 1. Declaration by Name
1316
The simplest way is to directly specify the name of the resource you want to reference in your GSLB. The namespace will be automatically taken from the GSLB’s namespace.
@@ -18,6 +21,7 @@ apiVersion: k8gb.absa.oss/v1beta1
1821
kind: Gslb
1922
metadata:
2023
name: playground-failover
24+
namespace: playground
2125
spec:
2226
resourceRef:
2327
apiVersion: networking.k8s.io/v1
@@ -31,6 +35,7 @@ apiVersion: k8gb.absa.oss/v1beta1
3135
kind: Gslb
3236
metadata:
3337
name: playground-failover
38+
namespace: playground
3439
spec:
3540
resourceRef:
3641
apiVersion: v1
@@ -44,6 +49,7 @@ apiVersion: k8gb.absa.oss/v1beta1
4449
kind: Gslb
4550
metadata:
4651
name: playground-failover
52+
namespace: playground
4753
spec:
4854
resourceRef:
4955
apiVersion: networking.istio.io/v1
@@ -57,6 +63,7 @@ apiVersion: k8gb.absa.oss/v1beta1
5763
kind: Gslb
5864
metadata:
5965
name: playground-failover
66+
namespace: playground
6067
spec:
6168
resourceRef:
6269
apiVersion: gateway.networking.k8s.io/v1
@@ -70,13 +77,30 @@ apiVersion: k8gb.absa.oss/v1beta1
7077
kind: Gslb
7178
metadata:
7279
name: playground-failover
80+
namespace: playground
7381
spec:
7482
resourceRef:
7583
apiVersion: gateway.networking.k8s.io/v1
7684
kind: GRPCRoute
7785
name: playground-failover-grpcroute
7886
```
7987
88+
GatewayAPI TCPRoute:
89+
```yaml
90+
apiVersion: k8gb.absa.oss/v1beta1
91+
kind: Gslb
92+
metadata:
93+
name: failover-tcproute
94+
namespace: playground
95+
annotations:
96+
k8gb.io/hostname: gatewayapi-tcproute.cloud.example.com
97+
spec:
98+
resourceRef:
99+
apiVersion: gateway.networking.k8s.io/v1alpha2
100+
kind: TCPRoute
101+
name: failover-tcproute
102+
```
103+
80104
81105
## 2. Declaration by Label
82106
Alternatively, you can reference the ingress resource by label. This approach is useful when you need more flexibility—for example,

0 commit comments

Comments
 (0)