Skip to content
Draft
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
29 changes: 26 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ test-e2e: chainsaw
}
$(KIND) get kubeconfig --name nso-standard > $(TMPDIR)/.kind-nso-standard.yaml
$(KIND) get kubeconfig --name nso-infra > $(TMPDIR)/.kind-nso-infra.yaml
$(CHAINSAW) test ./test/e2e \
$(CHAINSAW) test $(or $(TEST_DIR),./test/e2e) \
--parallel 1 \
--cluster nso-standard=$(TMPDIR)/.kind-nso-standard.yaml \
--cluster nso-infra=$(TMPDIR)/.kind-nso-infra.yaml

Expand Down Expand Up @@ -153,7 +154,7 @@ set-image-controller: manifests kustomize
cd config/manager && $(KUSTOMIZE) edit set image ghcr.io/datum-cloud/network-services-operator=${IMG}

.PHONY: prepare-infra-cluster
prepare-infra-cluster: cert-manager envoy-gateway external-dns downstream-crds
prepare-infra-cluster: cert-manager envoy-gateway external-dns downstream-crds billing-usage-collector load-image-nso-infra extension-server configure-eg-extension-manager

.PHONY: downstream-crds
downstream-crds: ## Install NSO CRDs on the downstream (infra) cluster that the replicator mirrors into it.
Expand All @@ -168,12 +169,16 @@ prepare-e2e: chainsaw set-image-controller cert-manager load-image-all deploy-e2
prepare-dev: chainsaw set-image-controller cert-manager install

.PHONY: load-image-all
load-image-all: load-image-operator
load-image-all: load-image-operator load-image-nso-infra

.PHONY: load-image-operator
load-image-operator: docker-build kind
$(KIND) load docker-image $(IMG) -n nso-standard

.PHONY: load-image-nso-infra
load-image-nso-infra: docker-build kind ## Load operator image into nso-infra kind cluster (needed by the extension server).
$(KIND) load docker-image $(IMG) -n nso-infra

.PHONY: cert-manager
cert-manager: cmctl
$(KUSTOMIZE) build --enable-helm config/tools/cert-manager | kubectl apply --server-side=true --force-conflicts -f -
Expand All @@ -187,6 +192,24 @@ envoy-gateway:
external-dns:
$(KUSTOMIZE) build --enable-helm config/tools/external-dns | kubectl apply --server-side=true --force-conflicts -f -

.PHONY: billing-usage-collector
billing-usage-collector:
$(KUSTOMIZE) build --enable-helm config/tools/billing-usage-collector | kubectl apply --server-side=true --force-conflicts -f -

.PHONY: extension-server
extension-server: ## Deploy the NSO extension server to the infra cluster (e2e overlay with cert-manager-issued TLS).
$(KUSTOMIZE) build --enable-helm config/extension-server-e2e | kubectl apply --server-side=true --force-conflicts -f -
kubectl rollout restart deployment/network-services-operator-envoy-gateway-extension-server \
-n network-services-operator-system
kubectl rollout status deployment/network-services-operator-envoy-gateway-extension-server \
-n network-services-operator-system --timeout=5m

.PHONY: configure-eg-extension-manager
configure-eg-extension-manager: ## Patch the EG ConfigMap to enable extensionManager and restart the EG controller.
$(KUSTOMIZE) build --enable-helm config/tools/envoy-gateway/overlays/e2e | kubectl apply --server-side=true --force-conflicts -f -
kubectl rollout restart deployment/envoy-gateway -n envoy-gateway-system
kubectl rollout status deployment/envoy-gateway -n envoy-gateway-system --timeout=3m

.PHONY: kind-standard-cluster
kind-standard-cluster: kind
$(KIND) create cluster --config=config/tools/kind/standard-cluster.yaml
Expand Down
30 changes: 30 additions & 0 deletions config/dev/downstream_resources/downstream-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,36 @@ spec:
disable: false
enableVirtualHostStats: true
enablePerEndpointStats: true
accessLog:
settings:
- format:
type: JSON
json:
start_time: "%START_TIME%"
method: "%REQ(:METHOD)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
protocol: "%PROTOCOL%"
response_code: "%RESPONSE_CODE%"
bytes_received: "%BYTES_RECEIVED%"
bytes_sent: "%BYTES_SENT%"
duration: "%DURATION%"
route_name: "%ROUTE_NAME%"
project_name: "%METADATA(ROUTE:datum-gateway:project_name)%"
# Push access logs straight to the node-local Vector agent over OTLP.
# The JSON fields above are delivered as OTLP log-record attributes,
# which Vector's `envoy_access_logs` opentelemetry source parses into
# billing CloudEvents. internalTrafficPolicy: Local on the Vector
# Service keeps this hop on-node.
sinks:
- type: OpenTelemetry
openTelemetry:
host: billing-usage-collector-vector.billing-system.svc.cluster.local
port: 4317
# OTLP has no custom URL path; identify this stream via an OTel
# resource attribute instead. Surfaces in Vector under
# `.resources` and can be used to route/filter signals.
resources:
service.name: nso-httproute-signals
---
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
Expand Down
12 changes: 12 additions & 0 deletions config/extension-server-e2e/client-cert-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: envoy-gateway-extension-server-eg-client-tls
spec:
issuerRef:
# Switch from the production placeholder ClusterIssuer to the e2e CA Issuer.
# kustomize propagates the namePrefix so this resolves to
# network-services-operator-nso-es-ca-issuer at apply time.
name: nso-es-ca-issuer
kind: Issuer
group: cert-manager.io
41 changes: 41 additions & 0 deletions config/extension-server-e2e/deployment-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: envoy-gateway-extension-server
spec:
# Single-node kind clusters can't satisfy the base DoNotSchedule topology constraint.
replicas: 1
template:
spec:
# Remove the hostname spread constraint — only 1 node in kind.
topologySpreadConstraints: null
volumes:
# Replace cert-manager CSI driver mount with a regular Secret volume.
# cert-manager Certificate nso-es-tls populates this Secret.
- name: tls
csi: null
secret:
secretName: nso-extension-server-tls
# Replace ConfigMap CA bundle with the same Secret; the ca.crt key holds
# the issuing CA cert that the extension server uses to verify EG's client cert.
- name: tls-ca
configMap: null
secret:
secretName: nso-extension-server-tls
items:
- key: ca.crt
path: ca.crt
# Extension server operator config — disables Coraza WAF injection
# so standard (non-contrib) Envoy images work in e2e.
- name: server-config
configMap:
name: extension-server-config
containers:
- name: envoy-gateway-extension-server
env:
- name: SERVER_CONFIG
value: /server-config/config.yaml
volumeMounts:
- name: server-config
mountPath: /server-config
readOnly: true
28 changes: 28 additions & 0 deletions config/extension-server-e2e/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: network-services-operator-system
namePrefix: network-services-operator-

resources:
- namespace.yaml
- ../extension-server
- tls.yaml
- server-config.yaml

patches:
# Replace CSI + ConfigMap volumes with Secret-based mounts; reduce replicas to 1 for single-node kind.
- path: deployment-patch.yaml
target:
kind: Deployment
name: envoy-gateway-extension-server
# Remove the PDB minAvailable constraint — kind clusters have only 1 node so minAvailable:1 prevents eviction.
- path: pdb-patch.yaml
target:
kind: PodDisruptionBudget
name: envoy-gateway-extension-server-pdb
# Switch the EG client cert issuer from the placeholder to the e2e CA.
- path: client-cert-patch.yaml
target:
kind: Certificate
name: envoy-gateway-extension-server-eg-client-tls
4 changes: 4 additions & 0 deletions config/extension-server-e2e/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: network-services-operator-system
8 changes: 8 additions & 0 deletions config/extension-server-e2e/pdb-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: envoy-gateway-extension-server-pdb
spec:
# replicas=1 in e2e; minAvailable:1 would block any eviction. Set to 0 so kind
# cluster teardown / upgrades don't stall.
minAvailable: 0
17 changes: 17 additions & 0 deletions config/extension-server-e2e/server-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# ConfigMap holding the extension server operator config for e2e.
# Disables Coraza WAF injection — e2e uses the standard Envoy image which
# does not have the golang filter compiled in, so injecting coraza-waf causes
# Envoy to reject the listener configuration.
apiVersion: v1
kind: ConfigMap
metadata:
name: extension-server-config
namespace: network-services-operator-system
data:
config.yaml: |
apiVersion: apiserver.config.datumapis.com/v1alpha1
kind: NetworkServicesOperator
gateway:
coraza:
disabled: true
59 changes: 59 additions & 0 deletions config/extension-server-e2e/tls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
# Self-signed bootstrap issuer; creates the e2e CA cert below.
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: nso-es-selfsigned
spec:
selfSigned: {}
---
# CA cert. cert-manager places the CA cert+key in Secret nso-extension-server-ca
# (in the same namespace). The CA Issuer below references that Secret.
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: nso-es-ca
spec:
isCA: true
commonName: nso-extension-server-ca
secretName: nso-extension-server-ca
privateKey:
algorithm: ECDSA
size: 256
issuerRef:
name: nso-es-selfsigned
kind: Issuer
group: cert-manager.io
---
# CA-backed issuer used by both the server cert and the EG client cert below.
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: nso-es-ca-issuer
spec:
ca:
secretName: nso-extension-server-ca
---
# Extension-server TLS cert. cert-manager writes it to Secret nso-extension-server-tls,
# which includes ca.crt = the CA cert — EG reads this field from certificateRef to verify
# the extension server's presented cert.
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: nso-es-tls
spec:
secretName: nso-extension-server-tls
dnsNames:
- network-services-operator-envoy-gateway-extension-server.network-services-operator-system.svc
- network-services-operator-envoy-gateway-extension-server.network-services-operator-system.svc.cluster.local
privateKey:
algorithm: ECDSA
size: 256
issuerRef:
name: nso-es-ca-issuer
kind: Issuer
group: cert-manager.io
usages:
- server auth
- digital signature
- key encipherment
Loading
Loading