Skip to content

Commit acae2bd

Browse files
committed
GRPCRoute Support (nginx#1835)
* GRPCRoute Support
1 parent 6cd5f74 commit acae2bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+4643
-2765
lines changed

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ TELEMETRY_ENDPOINT=# if empty, NGF will report telemetry in its logs at debug le
1616
TELEMETRY_ENDPOINT_INSECURE = false
1717

1818
GW_API_VERSION = 1.0.0
19+
ENABLE_EXPERIMENTAL = false
1920
NODE_VERSION = $(shell cat .nvmrc)
2021

2122
# go build flags - should not be overridden by the user
@@ -192,13 +193,13 @@ install-ngf-local-build-with-plus: build-images-with-plus load-images-with-plus
192193

193194
.PHONY: helm-install-local
194195
helm-install-local: ## Helm install NGF on configured kind cluster with local images. To build, load, and install with helm run make install-ngf-local-build.
195-
./conformance/scripts/install-gateway.sh $(GW_API_VERSION)
196-
helm install dev $(CHART_DIR) --create-namespace --wait --set service.type=NodePort --set nginxGateway.image.repository=$(PREFIX) --set nginxGateway.image.tag=$(TAG) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=$(NGINX_PREFIX) --set nginx.image.tag=$(TAG) --set nginx.image.pullPolicy=Never -n nginx-gateway
196+
./conformance/scripts/install-gateway.sh $(GW_API_VERSION) $(ENABLE_EXPERIMENTAL)
197+
helm install dev $(CHART_DIR) --create-namespace --wait --set service.type=NodePort --set nginxGateway.image.repository=$(PREFIX) --set nginxGateway.image.tag=$(TAG) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=$(NGINX_PREFIX) --set nginx.image.tag=$(TAG) --set nginx.image.pullPolicy=Never --set nginxGateway.gwAPIExperimentalFeatures.enable=$(ENABLE_EXPERIMENTAL) -n nginx-gateway
197198

198199
.PHONY: helm-install-local-with-plus
199200
helm-install-local-with-plus: ## Helm install NGF with NGINX Plus on configured kind cluster with local images. To build, load, and install with helm run make install-ngf-local-build-with-plus.
200-
./conformance/scripts/install-gateway.sh $(GW_API_VERSION)
201-
helm install dev $(CHART_DIR) --create-namespace --wait --set service.type=NodePort --set nginxGateway.image.repository=$(PREFIX) --set nginxGateway.image.tag=$(TAG) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=$(NGINX_PLUS_PREFIX) --set nginx.image.tag=$(TAG) --set nginx.image.pullPolicy=Never --set nginx.plus=true -n nginx-gateway
201+
./conformance/scripts/install-gateway.sh $(GW_API_VERSION) $(ENABLE_EXPERIMENTAL)
202+
helm install dev $(CHART_DIR) --create-namespace --wait --set service.type=NodePort --set nginxGateway.image.repository=$(PREFIX) --set nginxGateway.image.tag=$(TAG) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=$(NGINX_PLUS_PREFIX) --set nginx.image.tag=$(TAG) --set nginx.image.pullPolicy=Never --set nginx.plus=true --set nginxGateway.gwAPIExperimentalFeatures.enable=$(ENABLE_EXPERIMENTAL) -n nginx-gateway
202203

203204
# Debug Targets
204205
.PHONY: debug-build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
NGINX Gateway Fabric is an open-source project that provides an implementation of
1313
the [Gateway API](https://gateway-api.sigs.k8s.io/) using [NGINX](https://nginx.org/) as the data plane. The goal of
14-
this project is to implement the core Gateway APIs -- `Gateway`, `GatewayClass`, `HTTPRoute`, `TCPRoute`, `TLSRoute`,
14+
this project is to implement the core Gateway APIs -- `Gateway`, `GatewayClass`, `HTTPRoute`, `GRPCRoute`, `TCPRoute`, `TLSRoute`,
1515
and `UDPRoute` -- to configure an HTTP or TCP/UDP load balancer, reverse-proxy, or API gateway for applications running
1616
on Kubernetes. NGINX Gateway Fabric supports a subset of the Gateway API.
1717

build/Dockerfile.nginx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ RUN apk add --no-cache libcap \
1313

1414
COPY ${NJS_DIR}/httpmatches.js /usr/lib/nginx/modules/njs/httpmatches.js
1515
COPY ${NGINX_CONF_DIR}/nginx.conf /etc/nginx/nginx.conf
16+
COPY ${NGINX_CONF_DIR}/grpc-error-locations.conf /etc/nginx/grpc-error-locations.conf
17+
COPY ${NGINX_CONF_DIR}/grpc-error-pages.conf /etc/nginx/grpc-error-pages.conf
1618

1719
RUN chown -R 101:1001 /etc/nginx /var/cache/nginx /var/lib/nginx
1820

build/Dockerfile.nginxplus

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/apk/cert.pem,mode=0644 \
2929

3030
COPY ${NJS_DIR}/httpmatches.js /usr/lib/nginx/modules/njs/httpmatches.js
3131
COPY ${NGINX_CONF_DIR}/nginx-plus.conf /etc/nginx/nginx.conf
32+
COPY ${NGINX_CONF_DIR}/grpc-error-locations.conf /etc/nginx/grpc-error-locations.conf
33+
COPY ${NGINX_CONF_DIR}/grpc-error-pages.conf /etc/nginx/grpc-error-pages.conf
3234

3335
RUN chown -R 101:1001 /etc/nginx /var/cache/nginx /var/lib/nginx
3436

charts/nginx-gateway-fabric/templates/rbac.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ rules:
9292
- referencegrants
9393
{{- if .Values.nginxGateway.gwAPIExperimentalFeatures.enable }}
9494
- backendtlspolicies
95+
- grpcroutes
9596
{{- end }}
9697
verbs:
9798
- list
@@ -104,6 +105,7 @@ rules:
104105
- gatewayclasses/status
105106
{{- if .Values.nginxGateway.gwAPIExperimentalFeatures.enable }}
106107
- backendtlspolicies/status
108+
- grpcroutes/status
107109
{{- end }}
108110
verbs:
109111
- update

conformance/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ PROVISIONER_MANIFEST=provisioner/provisioner.yaml
1717
ENABLE_EXPERIMENTAL ?= false
1818
.DEFAULT_GOAL := help
1919

20+
ifeq ($(ENABLE_EXPERIMENTAL),true)
21+
SUPPORTED_FEATURES +=,GRPCExactMethodMatching,GRPCRouteListenerHostnameMatching,GRPCRouteHeaderMatching
22+
endif
23+
2024
.PHONY: help
2125
help: Makefile ## Display this help
2226
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "; printf "Usage:\n\n make \033[36m<target>\033[0m\n\nTargets:\n\n"}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'

deploy/manifests/nginx-gateway-experimental.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ rules:
7777
- httproutes
7878
- referencegrants
7979
- backendtlspolicies
80+
- grpcroutes
8081
verbs:
8182
- list
8283
- watch
@@ -87,6 +88,7 @@ rules:
8788
- gateways/status
8889
- gatewayclasses/status
8990
- backendtlspolicies/status
91+
- grpcroutes/status
9092
verbs:
9193
- update
9294
- apiGroups:

deploy/manifests/nginx-plus-gateway-experimental.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ rules:
8383
- httproutes
8484
- referencegrants
8585
- backendtlspolicies
86+
- grpcroutes
8687
verbs:
8788
- list
8889
- watch
@@ -93,6 +94,7 @@ rules:
9394
- gateways/status
9495
- gatewayclasses/status
9596
- backendtlspolicies/status
97+
- grpcroutes/status
9698
verbs:
9799
- update
98100
- apiGroups:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require (
3434
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
3535
github.com/cespare/xxhash/v2 v2.2.0 // indirect
3636
github.com/davecgh/go-spew v1.1.1 // indirect
37-
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
37+
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
3838
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
3939
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
4040
github.com/fatih/color v1.16.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
1111
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1212
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1313
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
14-
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
15-
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
14+
github.com/emicklei/go-restful/v3 v3.11.2 h1:1onLa9DcsMYO9P+CXaL0dStDqQ2EHHXLiz+BtnqkLAU=
15+
github.com/emicklei/go-restful/v3 v3.11.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
1616
github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI=
1717
github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
1818
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=

0 commit comments

Comments
 (0)