Skip to content

Commit ea6dba7

Browse files
authored
feat(envoy): add full-featured Envoy support (#856)
This change adds Envoy support with all the basic capabilities used today with the NGINX Gateway and additional stubs for future optimizations. * Documentation has been updated to separate Envoy from NGINX Gateway implementations * Traffic policies have been added for basic capabilies with the ability to extend and create comprehensive rate limits later. This change is a 1:1 replacement for the NGINX Gateway API ensuing it operates with self-signed and lets encrypt certificates, supports inplace replacements, and makes use of all the pre-defined routes/listeners. Nice to haves added * X-Forwarded-For and Client-IPs are now properly tracked * Cluster policies allow for better traffic management by default * HPA for envoy gives the system better scale Signed-off-by: Kevin Carter <[email protected]>
1 parent bef8546 commit ea6dba7

26 files changed

+655
-457
lines changed

.github/workflows/kustomize-gateway-api-envoyproxy.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Kustomize GitHub Actions for Gateway API(envoyproxy)
33
on:
44
pull_request:
55
paths:
6-
- base-kustomize/gateway/envoyproxy/**
6+
- base-kustomize/gateway/envoyproxy-gateway/**
77
- .github/workflows/kustomize-gateway-api-envoyproxy.yaml
88
jobs:
99
kustomize:
@@ -25,7 +25,7 @@ jobs:
2525
fi
2626
- name: Run Kustomize Build
2727
run: |
28-
kustomize build base-kustomize/gateway/envoyproxy/ --enable-helm --helm-command ${{ steps.helm.outputs.helm-path }} > /tmp/rendered.yaml
28+
kustomize build base-kustomize/envoyproxy-gateway/base > /tmp/rendered.yaml
2929
- name: Return Kustomize Build
3030
uses: actions/upload-artifact@v4
3131
with:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
apiVersion: gateway.envoyproxy.io/v1alpha1
3+
kind: EnvoyProxy
4+
metadata:
5+
name: custom-proxy-config
6+
namespace: envoy-gateway
7+
spec:
8+
provider:
9+
type: Kubernetes
10+
kubernetes:
11+
envoyHpa:
12+
minReplicas: 2
13+
maxReplicas: 9
14+
metrics:
15+
- resource:
16+
name: cpu
17+
target:
18+
averageUtilization: 60
19+
type: Utilization
20+
type: Resource
21+
- resource:
22+
name: memory
23+
target:
24+
type: AverageValue
25+
averageValue: 500Mi
26+
type: Resource
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
apiVersion: gateway.envoyproxy.io/v1alpha1
3+
kind: ClientTrafficPolicy
4+
metadata:
5+
name: flex-gateway-client-policy
6+
namespace: envoy-gateway
7+
spec:
8+
targetRefs:
9+
- group: gateway.networking.k8s.io
10+
kind: Gateway
11+
name: flex-gateway
12+
clientIPDetection:
13+
xForwardedFor:
14+
numTrustedHops: 2
15+
connection:
16+
bufferLimit: 16384
17+
timeout:
18+
http:
19+
idleTimeout: 5s
20+
---
21+
apiVersion: gateway.envoyproxy.io/v1alpha1
22+
kind: BackendTrafficPolicy
23+
metadata:
24+
name: least-request-policy
25+
namespace: envoy-gateway
26+
spec:
27+
targetRefs:
28+
- group: gateway.networking.k8s.io
29+
kind: HTTPRoute
30+
name: custom-barbican-gateway-route
31+
- group: gateway.networking.k8s.io
32+
kind: HTTPRoute
33+
name: custom-cinder-gateway-route
34+
- group: gateway.networking.k8s.io
35+
kind: HTTPRoute
36+
name: custom-cloudformation-gateway-route
37+
- group: gateway.networking.k8s.io
38+
kind: HTTPRoute
39+
name: custom-glance-gateway-route
40+
- group: gateway.networking.k8s.io
41+
kind: HTTPRoute
42+
name: custom-gnocchi-gateway-route
43+
- group: gateway.networking.k8s.io
44+
kind: HTTPRoute
45+
name: custom-heat-gateway-route
46+
- group: gateway.networking.k8s.io
47+
kind: HTTPRoute
48+
name: custom-keystone-gateway-route
49+
- group: gateway.networking.k8s.io
50+
kind: HTTPRoute
51+
name: custom-magnum-gateway-route
52+
- group: gateway.networking.k8s.io
53+
kind: HTTPRoute
54+
name: custom-metadata-gateway-route
55+
- group: gateway.networking.k8s.io
56+
kind: HTTPRoute
57+
name: custom-neutron-gateway-route
58+
- group: gateway.networking.k8s.io
59+
kind: HTTPRoute
60+
name: custom-nova-gateway-route
61+
- group: gateway.networking.k8s.io
62+
kind: HTTPRoute
63+
name: custom-novnc-gateway-route
64+
- group: gateway.networking.k8s.io
65+
kind: HTTPRoute
66+
name: custom-octavia-gateway-route
67+
- group: gateway.networking.k8s.io
68+
kind: HTTPRoute
69+
name: custom-placement-gateway-route
70+
- group: gateway.networking.k8s.io
71+
kind: HTTPRoute
72+
name: internal-loki-gateway-route
73+
loadBalancer:
74+
type: LeastRequest
75+
---
76+
apiVersion: gateway.envoyproxy.io/v1alpha1
77+
kind: BackendTrafficPolicy
78+
metadata:
79+
name: source-ip-policy
80+
namespace: envoy-gateway
81+
spec:
82+
targetRefs:
83+
- group: gateway.networking.k8s.io
84+
kind: HTTPRoute
85+
name: grafana-gateway-route
86+
- group: gateway.networking.k8s.io
87+
kind: HTTPRoute
88+
name: custom-skyline-gateway-route
89+
loadBalancer:
90+
type: ConsistentHash
91+
consistentHash:
92+
type: SourceIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
labels:
6+
kubernetes.io/metadata.name: envoy-gateway
7+
pod-security.kubernetes.io/audit: privileged
8+
pod-security.kubernetes.io/audit-version: latest
9+
pod-security.kubernetes.io/enforce: privileged
10+
pod-security.kubernetes.io/enforce-version: latest
11+
pod-security.kubernetes.io/warn: privileged
12+
pod-security.kubernetes.io/warn-version: latest
13+
name: envoy-gateway
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
apiVersion: gateway.networking.k8s.io/v1
3+
kind: Gateway
4+
metadata:
5+
name: flex-gateway
6+
namespace: envoy-gateway
7+
annotations:
8+
cert-manager.io/cluster-issuer: flex-gateway-issuer
9+
acme.cert-manager.io/http01-edit-in-place: "true"
10+
spec:
11+
gatewayClassName: eg
12+
infrastructure:
13+
annotations:
14+
metallb.universe.tf/address-pool: gateway-api-external
15+
listeners:
16+
- name: cluster-http
17+
port: 80
18+
protocol: HTTP
19+
hostname: "*.cluster.local"
20+
allowedRoutes:
21+
namespaces:
22+
from: All
23+
- name: cluster-tls
24+
port: 443
25+
protocol: HTTPS
26+
hostname: "*.cluster.local"
27+
allowedRoutes:
28+
namespaces:
29+
from: All
30+
tls:
31+
mode: Terminate
32+
certificateRefs:
33+
- kind: Secret
34+
name: wildcard-cluster-tls-secret
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apiVersion: gateway.networking.k8s.io/v1
3+
kind: GatewayClass
4+
metadata:
5+
name: eg
6+
namespace: envoy-gateway
7+
spec:
8+
controllerName: gateway.envoyproxy.io/gatewayclass-controller
9+
parametersRef:
10+
group: gateway.envoyproxy.io
11+
kind: EnvoyProxy
12+
name: custom-proxy-config
13+
namespace: envoy-gateway

base-kustomize/envoyproxy-gateway/base/gatewayclass.yaml

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
sortOptions:
22
order: fifo
33
resources:
4-
- './namespace.yaml'
5-
- './gatewayclass.yaml'
6-
namespace: envoy-gateway-system
7-
helmGlobals:
8-
chartHome: ../../../submodules/envoyproxy-gateway/charts/
9-
helmCharts:
10-
- name: gateway-helm
11-
valuesFile: values.yaml
12-
includeCRDs: true
13-
releaseName: envoyproxy-gateway
4+
- envoy-gateway-namespace.yaml
5+
- envoy-custom-proxy-config.yaml
6+
- envoy-gatewayclass.yaml
7+
- envoy-gateway.yaml
8+
- envoy-endpoint-policies.yaml

base-kustomize/envoyproxy-gateway/base/namespace.yaml

-8
This file was deleted.

base-kustomize/envoyproxy-gateway/base/values.yaml

-52
This file was deleted.

base-kustomize/gateway/envoyproxy/gateway.yaml

-34
This file was deleted.

base-kustomize/gateway/envoyproxy/kustomization.yaml

-4
This file was deleted.

bin/install-envoy-gateway.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# shellcheck disable=SC2124,SC2145,SC2294
3+
4+
GLOBAL_OVERRIDES_DIR="/etc/genestack/helm-configs/global_overrides"
5+
SERVICE_CONFIG_DIR="/etc/genestack/helm-configs/envoyproxy-gateway"
6+
BASE_OVERRIDES="/opt/genestack/base-helm-configs/envoyproxy-gateway/envoyproxy-gateway-helm-overrides.yaml"
7+
ENVOY_VERSION="v1.3.0"
8+
HELM_CMD="helm upgrade --install envoyproxy-gateway oci://docker.io/envoyproxy/gateway-helm \
9+
--version ${ENVOY_VERSION} \
10+
--namespace envoyproxy-gateway-system \
11+
--create-namespace"
12+
13+
HELM_CMD+=" -f ${BASE_OVERRIDES}"
14+
15+
for dir in "$GLOBAL_OVERRIDES_DIR" "$SERVICE_CONFIG_DIR"; do
16+
if compgen -G "${dir}/*.yaml" > /dev/null; then
17+
for yaml_file in "${dir}"/*.yaml; do
18+
# Avoid re-adding the base override file if present in the service directory
19+
if [ "${yaml_file}" != "${BASE_OVERRIDES}" ]; then
20+
HELM_CMD+=" -f ${yaml_file}"
21+
fi
22+
done
23+
fi
24+
done
25+
26+
HELM_CMD+=" $@"
27+
28+
echo "Executing Helm command:"
29+
echo "${HELM_CMD}"
30+
eval "${HELM_CMD}"
31+
32+
# Install egctl
33+
mkdir -p /opt/egctl-install
34+
35+
pushd /opt/egctl-install || exit 1
36+
wget "https://github.com/envoyproxy/gateway/releases/download/${ENVOY_VERSION}/egctl_${ENVOY_VERSION}_linux_amd64.tar.gz" -O egctl.tar.gz
37+
tar -xvf egctl.tar.gz
38+
sudo install -o root -g root -m 0755 bin/linux/amd64/egctl /usr/local/bin/egctl
39+
/usr/local/bin/egctl completion bash > egctl.bash
40+
sudo cp egctl.bash /etc/bash_completion.d/egctl
41+
popd || exit 1

0 commit comments

Comments
 (0)