Skip to content

Commit f434906

Browse files
author
Joshua Reese
authored
Merge pull request #62 from datum-cloud/integration/proxy-updates
Update Gateway API to v1.3.0, target Envoy Gateway v1.5.0, expose new APIs
2 parents bb29ed3 + 7771231 commit f434906

72 files changed

Lines changed: 8137 additions & 682 deletions

File tree

Some content is hidden

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

.github/workflows/test-e2e.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ jobs:
5454
wait deploy network-services-operator-controller-manager \
5555
--for=condition=Available \
5656
--timeout=120s || \
57+
kubectl -n cert-manager describe pods && \
58+
kubectl logs -n cert-manager -l app.kubernetes.io/name=cert-manager --tail=-1 && \
59+
kubectl -n network-services-operator-system describe issuer && \
60+
kubectl -n network-services-operator-system describe certificates && \
61+
kubectl -n network-services-operator-system describe secrets && \
5762
kubectl -n network-services-operator-system describe pod && \
5863
kubectl -n network-services-operator-system logs -l app.kubernetes.io/name=network-services-operator --tail=-1
5964

Makefile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,24 @@ test-e2e: chainsaw
7979
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
8080
exit 1; \
8181
}
82+
$(KIND) get kubeconfig --name nso-standard > $(TMPDIR)/.kind-nso-standard.yaml
83+
$(KIND) get kubeconfig --name nso-infra > $(TMPDIR)/.kind-nso-infra.yaml
8284
$(CHAINSAW) test ./test/e2e \
8385
--cluster nso-standard=$(TMPDIR)/.kind-nso-standard.yaml \
8486
--cluster nso-infra=$(TMPDIR)/.kind-nso-infra.yaml
8587

88+
GATEWAY_CONFORMANCE_CLASS ?= gateway-conformance
89+
GATEWAY_CONFORMANCE_FLAGS ?=
90+
91+
## TODO(jreese) add a recipe to clone the envoy gateway repo so we can use
92+
## `make kube-install-examples-image CLUSTER_NAME=nso-infra` to build and load
93+
## images into the infra cluster for the e2e tests
94+
.PHONY: test-conformance
95+
test-conformance:
96+
go test ./test/conformance/gatewayapi -tags=conformance,e2e -count=1 -v \
97+
--infra-kubeconfig $(TMPDIR)/.kind-nso-infra.yaml \
98+
--gateway-class=$(GATEWAY_CONFORMANCE_CLASS) $(GATEWAY_CONFORMANCE_FLAGS)
99+
86100
.PHONY: lint
87101
lint: golangci-lint ## Run golangci-lint linter
88102
$(GOLANGCI_LINT) run
@@ -136,13 +150,16 @@ build-installer: set-image-controller generate ## Generate a consolidated YAML w
136150

137151
.PHONY: set-image-controller
138152
set-image-controller: manifests kustomize
139-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
153+
cd config/manager && $(KUSTOMIZE) edit set image ghcr.io/datum-cloud/network-services-operator=${IMG}
140154

141155
.PHONY: prepare-infra-cluster
142156
prepare-infra-cluster: cert-manager envoy-gateway external-dns
143157

144158
.PHONY: prepare-e2e
145-
prepare-e2e: chainsaw set-image-controller cert-manager envoy-gateway external-dns load-image-all deploy-e2e
159+
prepare-e2e: chainsaw set-image-controller cert-manager load-image-all deploy-e2e
160+
161+
.PHONY: prepare-dev
162+
prepare-dev: chainsaw set-image-controller cert-manager install
146163

147164
.PHONY: load-image-all
148165
load-image-all: load-image-operator
@@ -167,12 +184,10 @@ external-dns:
167184
.PHONY: kind-standard-cluster
168185
kind-standard-cluster: kind
169186
$(KIND) create cluster --config=config/tools/kind/standard-cluster.yaml
170-
$(KIND) get kubeconfig --name nso-standard > $(TMPDIR)/.kind-nso-standard.yaml
171187

172188
.PHONY: kind-infra-cluster
173189
kind-infra-cluster: kind
174190
$(KIND) create cluster --config=config/tools/kind/infra-cluster.yaml
175-
$(KIND) get kubeconfig --name nso-infra > $(TMPDIR)/.kind-nso-infra.yaml
176191

177192
##@ Deployment
178193

@@ -238,7 +253,7 @@ CRDOC_VERSION ?= v0.6.4
238253
KIND_VERSION ?= v0.27.0
239254

240255
# renovate: datasource=go depName=github.com/kyverno/chainsaw
241-
CHAINSAW_VERSION ?= v0.2.12
256+
CHAINSAW_VERSION ?= v0.2.13
242257

243258
# renovate: datasource=go depName=github.com/cert-manager/cmctl/v2
244259
CMCTL_VERSION ?= v2.1.1

PROJECT

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ resources:
7777
path: sigs.k8s.io/gateway-api/apis/v1
7878
version: v1
7979
webhooks:
80+
defaulting: true
8081
validation: true
8182
webhookVersion: v1
8283
- domain: k8s.io
@@ -88,6 +89,15 @@ resources:
8889
webhooks:
8990
validation: true
9091
webhookVersion: v1
92+
- domain: k8s.io
93+
external: true
94+
group: gateway.networking
95+
kind: BackendTLSPolicy
96+
path: sigs.k8s.io/gateway-api/apis/v1
97+
version: v1
98+
webhooks:
99+
validation: true
100+
webhookVersion: v1
91101
- api:
92102
crdVersion: v1
93103
namespaced: true
@@ -106,4 +116,40 @@ resources:
106116
kind: Domain
107117
path: go.datum.net/network-services-operator/api/v1alpha
108118
version: v1alpha
119+
- domain: envoyproxy.io
120+
external: true
121+
group: gateway
122+
kind: BackendTrafficPolicy
123+
path: github.com/envoyproxy/gateway/api/v1alpha1
124+
version: v1alpha1
125+
webhooks:
126+
validation: true
127+
webhookVersion: v1
128+
- domain: envoyproxy.io
129+
external: true
130+
group: gateway
131+
kind: SecurityPolicy
132+
path: github.com/envoyproxy/gateway/api/v1alpha1
133+
version: v1alpha1
134+
webhooks:
135+
validation: true
136+
webhookVersion: v1
137+
- domain: envoyproxy.io
138+
external: true
139+
group: gateway
140+
kind: HTTPRouteFilter
141+
path: github.com/envoyproxy/gateway/api/v1alpha1
142+
version: v1alpha1
143+
webhooks:
144+
validation: true
145+
webhookVersion: v1
146+
- domain: envoyproxy.io
147+
external: true
148+
group: gateway
149+
kind: Backend
150+
path: github.com/envoyproxy/gateway/api/v1alpha1
151+
version: v1alpha1
152+
webhooks:
153+
validation: true
154+
webhookVersion: v1
109155
version: "3"

cmd/main.go

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
// to ensure that exec-entrypoint and run can make use of them.
1212
_ "k8s.io/client-go/plugin/pkg/client/auth"
1313

14+
envoygatewayv1alpha1 "github.com/envoyproxy/gateway/api/v1alpha1"
1415
multiclusterproviders "go.miloapis.com/milo/pkg/multicluster-runtime"
1516
milomulticluster "go.miloapis.com/milo/pkg/multicluster-runtime/milo"
1617
"golang.org/x/sync/errgroup"
@@ -35,10 +36,10 @@ import (
3536
networkingv1alpha "go.datum.net/network-services-operator/api/v1alpha"
3637
"go.datum.net/network-services-operator/internal/config"
3738
"go.datum.net/network-services-operator/internal/controller"
38-
"go.datum.net/network-services-operator/internal/validation"
3939
networkingwebhook "go.datum.net/network-services-operator/internal/webhook"
4040
networkinggatewayv1webhooks "go.datum.net/network-services-operator/internal/webhook/v1"
4141
networkingv1alphawebhooks "go.datum.net/network-services-operator/internal/webhook/v1alpha"
42+
webhookgatewayv1alpha1 "go.datum.net/network-services-operator/internal/webhook/v1alpha1"
4243
// +kubebuilder:scaffold:imports
4344
)
4445

@@ -57,9 +58,11 @@ func init() {
5758
utilruntime.Must(gatewayv1.Install(scheme))
5859
utilruntime.Must(gatewayv1alpha2.Install(scheme))
5960
utilruntime.Must(gatewayv1alpha3.Install(scheme))
61+
utilruntime.Must(envoygatewayv1alpha1.AddToScheme(scheme))
6062
// +kubebuilder:scaffold:scheme
6163
}
6264

65+
// nolint:gocyclo
6366
func main() {
6467
var enableLeaderElection bool
6568
var leaderElectionNamespace string
@@ -227,6 +230,14 @@ func main() {
227230
os.Exit(1)
228231
}
229232

233+
if err := (&controller.GatewayResourceReplicatorReconciler{
234+
Config: serverConfig,
235+
DownstreamCluster: downstreamCluster,
236+
}).SetupWithManager(mgr); err != nil {
237+
setupLog.Error(err, "unable to create controller", "controller", "GatewayResourceReplicator")
238+
os.Exit(1)
239+
}
240+
230241
if err := (&controller.DomainReconciler{
231242
Config: serverConfig,
232243
}).SetupWithManager(mgr); err != nil {
@@ -239,19 +250,17 @@ func main() {
239250
os.Exit(1)
240251
}
241252

242-
validationOpts := validation.GatewayValidationOptions{
243-
ControllerName: serverConfig.Gateway.ControllerName,
244-
PermittedTLSOptions: serverConfig.Gateway.PermittedTLSOptions,
245-
ValidPortNumbers: serverConfig.Gateway.ValidPortNumbers,
246-
ValidProtocolTypes: serverConfig.Gateway.ValidProtocolTypes,
253+
if err := networkinggatewayv1webhooks.SetupGatewayWebhookWithManager(mgr, serverConfig); err != nil {
254+
setupLog.Error(err, "unable to create webhook", "webhook", "Gateway")
255+
os.Exit(1)
247256
}
248257

249-
if err := networkinggatewayv1webhooks.SetupGatewayWebhookWithManager(mgr, validationOpts); err != nil {
250-
setupLog.Error(err, "unable to create webhook", "webhook", "Gateway")
258+
if err := networkinggatewayv1webhooks.SetupHTTPRouteWebhookWithManager(mgr, serverConfig); err != nil {
259+
setupLog.Error(err, "unable to create webhook", "webhook", "HTTPRoute")
251260
os.Exit(1)
252261
}
253262

254-
if err := networkinggatewayv1webhooks.SetupHTTPRouteWebhookWithManager(mgr); err != nil {
263+
if err := networkinggatewayv1webhooks.SetupBackendTLSPolicyWebhookWithManager(mgr); err != nil {
255264
setupLog.Error(err, "unable to create webhook", "webhook", "HTTPRoute")
256265
os.Exit(1)
257266
}
@@ -261,6 +270,26 @@ func main() {
261270
os.Exit(1)
262271
}
263272

273+
if err = webhookgatewayv1alpha1.SetupBackendTrafficPolicyWebhookWithManager(mgr, serverConfig); err != nil {
274+
setupLog.Error(err, "unable to create webhook", "webhook", "BackendTrafficPolicy")
275+
os.Exit(1)
276+
}
277+
278+
if err = webhookgatewayv1alpha1.SetupSecurityPolicyWebhookWithManager(mgr, serverConfig); err != nil {
279+
setupLog.Error(err, "unable to create webhook", "webhook", "SecurityPolicy")
280+
os.Exit(1)
281+
}
282+
283+
if err = webhookgatewayv1alpha1.SetupHTTPRouteFilterWebhookWithManager(mgr, serverConfig); err != nil {
284+
setupLog.Error(err, "unable to create webhook", "webhook", "HTTPRouteFilter")
285+
os.Exit(1)
286+
}
287+
288+
if err = webhookgatewayv1alpha1.SetupBackendWebhookWithManager(mgr); err != nil {
289+
setupLog.Error(err, "unable to create webhook", "webhook", "Backend")
290+
os.Exit(1)
291+
}
292+
264293
// +kubebuilder:scaffold:builder
265294

266295
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {

0 commit comments

Comments
 (0)