Skip to content

Commit

Permalink
feat(*) add support for TLSRoute
Browse files Browse the repository at this point in the history
Add TLSRoute controller.

Add TLSRoute store functions.

Add TLSRoute translation to the parser.

Add TLSRoute example and test.

Add TLSRoute integration tests.

Fix copy/paste error in TCPRoute fakestore and add missing TCPRoute
fakestore test.

Parallelize UDPRoute example test.
  • Loading branch information
rainest committed May 10, 2022
1 parent 35de6ee commit 6cd8fac
Show file tree
Hide file tree
Showing 18 changed files with 1,339 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
[#2451](https://github.com/Kong/kubernetes-ingress-controller/issues/2451)
- Added description of each field of `kongIngresses` CRD.
[#1766](https://github.com/Kong/kubernetes-ingress-controller/issues/1766)
- Added support for `TLSRoute` resources.
[#2476](https://github.com/Kong/kubernetes-ingress-controller/issues/2476)

#### Fixed

Expand Down
5 changes: 5 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,9 @@ resources:
group: gateway
kind: ReferencePolicy
version: v1alpha2
- controller: true
domain: networking.k8s.io
group: gateway
kind: TLSRoute
version: v1alpha2
version: "3"
15 changes: 15 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes/status
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
Expand Down
15 changes: 15 additions & 0 deletions deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes/status
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
Expand Down
15 changes: 15 additions & 0 deletions deploy/single/all-in-one-dbless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes/status
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
Expand Down
15 changes: 15 additions & 0 deletions deploy/single/all-in-one-postgres-enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes/status
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
Expand Down
15 changes: 15 additions & 0 deletions deploy/single/all-in-one-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- tlsroutes/status
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
Expand Down
78 changes: 78 additions & 0 deletions examples/gateway-tlsroute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# WARNING: Gateway APIs support is still experimental. Use as your own risk.
#
# NOTE: You need to install the Gateway APIs CRDs before using this example,
# they are external and can be deployed with the following one-liner:
#
# kubectl kustomize https://github.com/kubernetes-sigs/gateway-api.git/config/crd?ref=master | kubectl apply -f -
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tcpecho
labels:
app: tcpecho
spec:
selector:
matchLabels:
app: tcpecho
template:
metadata:
labels:
app: tcpecho
spec:
containers:
- name: tcpecho
image: cjimti/go-echo
ports:
- containerPort: 1025
env:
- name: POD_NAME
value: tlsroute-example-manifest
---
apiVersion: v1
kind: Service
metadata:
name: tcpecho
spec:
ports:
- port: 8888
protocol: TCP
targetPort: 1025
selector:
app: tcpecho
type: ClusterIP
---
kind: GatewayClass
apiVersion: gateway.networking.k8s.io/v1alpha2
metadata:
name: kong
spec:
controllerName: konghq.com/kic-gateway-controller
---
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1alpha2
metadata:
name: kong
spec:
gatewayClassName: kong
listeners:
- name: http
protocol: HTTP
port: 80
- name: tcp
protocol: TCP
port: 8888
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TLSRoute
metadata:
name: tlsecho
spec:
parentRefs:
- name: kong
hostnames:
- tlsecho.kong.example
rules:
- backendRefs:
- name: tcpecho
port: 8888
2 changes: 2 additions & 0 deletions internal/controllers/gateway/route_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func parentRefsForRoute(obj client.Object) ([]gatewayv1alpha2.ParentReference, e
return v.Spec.ParentRefs, nil
case *gatewayv1alpha2.TCPRoute:
return v.Spec.ParentRefs, nil
case *gatewayv1alpha2.TLSRoute:
return v.Spec.ParentRefs, nil
default:
return nil, fmt.Errorf("cant determine parent gateway for unsupported type %s", reflect.TypeOf(obj))
}
Expand Down
Loading

0 comments on commit 6cd8fac

Please sign in to comment.