Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(*) add support for TLSRoute #2476

Merged
merged 2 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:/Kong/kubernetes-ingress-controller/issues/2451)
- Added description of each field of `kongIngresses` CRD.
[#1766](https:/Kong/kubernetes-ingress-controller/issues/1766)
- Added support for `TLSRoute` resources.
[#2476](https:/Kong/kubernetes-ingress-controller/issues/2476)

#### Fixed

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ debug-container:
NCPU ?= $(shell getconf _NPROCESSORS_ONLN)
PKG_LIST = ./pkg/...,./internal/...
KIND_CLUSTER_NAME ?= "integration-tests"
INTEGRATION_TEST_TIMEOUT ?= "20m"
INTEGRATION_TEST_TIMEOUT ?= "25m"
rainest marked this conversation as resolved.
Show resolved Hide resolved
E2E_TEST_TIMEOUT ?= "30m"

.PHONY: test
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:/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