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

Add UDPRoute implementation #2363

Merged
merged 8 commits into from
Apr 1, 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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@
- Admission webhook certificate files now track updates to the file, and will
update when the corresponding Secret has changed.
[#2258](https://github.com/Kong/kubernetes-ingress-controller/pull/2258)
- Added support for Gateway API [UDPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.UDPRoute)
resources.
[#2363](https://github.com/Kong/kubernetes-ingress-controller/pull/2363)
- The controller can now detect whether a Kong container has crashed and needs
a configuration push. Requires Kong 2.8+.
[#2343](https://github.com/Kong/kubernetes-ingress-controller/pull/2343)


#### Fixed

- Fixed an issue where duplicated route names in `HTTPRoute` resources with
Expand Down
11 changes: 10 additions & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layout:
- go.kubebuilder.io/v3
multigroup: true
projectName: kubernetes-ingress-controller
repo: github.com/kong/kubernetes-ingress-controller
repo: github.com/kong/kubernetes-ingress-controller/v2
resources:
- api:
crdVersion: v1
Expand Down Expand Up @@ -70,4 +70,13 @@ resources:
kind: HTTPRoute
path: github.com/kubernetes-sigs/gateway-api/apis/v1alpha2
version: v1alpha2
- api:
crdVersion: v1
namespaced: true
controller: true
domain: networking.k8s.io
group: gateway
kind: UDPRoute
path: github.com/kubernetes-sigs/gateway-api/apis/v1alpha2
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 @@ -232,6 +232,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes/status
verbs:
- get
- update
- apiGroups:
- networking.internal.knative.dev
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 @@ -1182,6 +1182,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes/status
verbs:
- get
- update
- apiGroups:
- networking.internal.knative.dev
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 @@ -1182,6 +1182,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes/status
verbs:
- get
- update
- apiGroups:
- networking.internal.knative.dev
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 @@ -1182,6 +1182,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes/status
verbs:
- get
- update
- apiGroups:
- networking.internal.knative.dev
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 @@ -1182,6 +1182,21 @@ rules:
verbs:
- get
- update
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
- udproutes/status
verbs:
- get
- update
- apiGroups:
- networking.internal.knative.dev
resources:
Expand Down
116 changes: 116 additions & 0 deletions examples/gateway-udproute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# 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: v1
kind: ConfigMap
metadata:
name: coredns
data:
Corefile: |-
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
forward . /etc/resolv.conf {
max_concurrent 1000
}
cache 30
loop
reload
loadbalance
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
labels:
app: coredns
spec:
replicas: 1
selector:
matchLabels:
app: coredns
template:
metadata:
labels:
app: coredns
spec:
containers:
- args:
- -conf
- /etc/coredns/Corefile
image: k8s.gcr.io/coredns/coredns:v1.8.6
imagePullPolicy: IfNotPresent
name: coredns
ports:
- containerPort: 53
protocol: UDP
volumeMounts:
- mountPath: /etc/coredns
name: config-volume
volumes:
- configMap:
defaultMode: 420
items:
- key: Corefile
path: Corefile
name: coredns
name: config-volume
---
apiVersion: v1
kind: Service
metadata:
name: coredns
spec:
ports:
- port: 53
protocol: UDP
targetPort: 53
selector:
app: coredns
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: dns
protocol: UDP
port: 53
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: UDPRoute
metadata:
name: coredns
spec:
parentRefs:
- name: kong
rules:
- backendRefs:
- name: coredns
port: 53
rainest marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions internal/controllers/gateway/route_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func parentRefsForRoute(obj client.Object) ([]gatewayv1alpha2.ParentReference, e
switch v := obj.(type) {
case *gatewayv1alpha2.HTTPRoute:
return v.Spec.ParentRefs, nil
case *gatewayv1alpha2.UDPRoute:
return v.Spec.ParentRefs, nil
default:
return nil, fmt.Errorf("cant determine parent gateway for unsupported type %s", reflect.TypeOf(obj))
}
Expand Down
Loading