Skip to content

Commit

Permalink
Add tls and notls envoy configuration files
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Cattermole <[email protected]>
  • Loading branch information
adam-cattermole committed Aug 13, 2024
1 parent d8b4be5 commit 622a0df
Show file tree
Hide file tree
Showing 3 changed files with 312 additions and 30 deletions.
8 changes: 7 additions & 1 deletion make/auth.mk
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,15 @@ deploy-limitador:

.PHONY: user-apps


ifeq (true,$(TLS_ENABLED))
ENVOY_OVERLAY = tls
else
ENVOY_OVERLAY = notls
endif
user-apps: ## Deploys talker API and envoy
kubectl -n $(NAMESPACE) apply -f https://raw.githubusercontent.com/kuadrant/authorino-examples/main/talker-api/talker-api-deploy.yaml
kubectl -n $(NAMESPACE) apply -f $(PROJECT_PATH)/utils/deploy/envoy-tls.yaml
kubectl -n $(NAMESPACE) apply -f $(PROJECT_PATH)/utils/deploy/envoy-$(ENVOY_OVERLAY).yaml


##@ Util
Expand Down
269 changes: 269 additions & 0 deletions utils/deploy/envoy-notls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: envoy
name: envoy
data:
envoy.yaml: |
static_resources:
clusters:
- name: authorino_wasm
connect_timeout: 1s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http2_protocol_options: { }
load_assignment:
cluster_name: authorino_wasm
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: authorino-authorino-authorization
port_value: 50051
- name: limitador
connect_timeout: 1s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http2_protocol_options: { }
load_assignment:
cluster_name: limitador
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: limitador
port_value: 8081
- name: talker-api
connect_timeout: 0.25s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: talker-api
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: talker-api
port_value: 3000
- name: talker-web
connect_timeout: 0.25s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: talker-web
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: talker-web
port_value: 8888
- name: opentelemetry
connect_timeout: 0.25s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http2_protocol_options: { }
load_assignment:
cluster_name: opentelemetry
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: otel-collector
port_value: 4317
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 8000
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: local
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: [ '*' ]
routes:
- match: { prefix: / }
route:
cluster: talker-api
http_filters:
- name: envoy.filters.http.header_to_metadata
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.header_to_metadata.v3.Config
request_rules:
- header: x-dyn-user-id
on_header_present:
key: user_id
type: STRING
remove: false
- name: envoy.filters.http.wasm
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
config:
name: kuadrant_wasm
root_id: kuadrant_wasm
vm_config:
vm_id: vm.sentinel.kuadrant_wasm
runtime: envoy.wasm.runtime.v8
code:
local:
filename: /opt/kuadrant/wasm/wasm_shim.wasm
allow_precompiled: true
configuration:
"@type": "type.googleapis.com/google.protobuf.StringValue"
value: >
{
"failureMode": "deny",
"rateLimitPolicies": [
{
"name": "rlp-ns-A/rlp-name-A",
"domain": "rlp-ns-A/rlp-name-A",
"service": "authorino_wasm",
"hostnames": ["*.a.com"],
"rules": [
{
"conditions": [
{
"allOf": [
{
"selector": "request.host",
"operator": "eq",
"value": "test.a.com"
}
]
}
],
"data": [
{
"static": {
"key": "limit_to_be_activated",
"value": "1"
}
}
]
}
]
}
]
}
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
# # Uncomment to enable tracing
# tracing:
# provider:
# name: envoy.tracers.opentelemetry
# typed_config:
# "@type": type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig
# grpc_service:
# envoy_grpc:
# cluster_name: opentelemetry
# timeout: 1s
# service_name: envoy
admin:
address:
socket_address:
address: 0.0.0.0
port_value: 8001
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: envoy
name: envoy
spec:
replicas: 1
selector:
matchLabels:
app: envoy
template:
metadata:
labels:
app: envoy
spec:
containers:
- args:
- --config-path /usr/local/etc/envoy/envoy.yaml
- --service-cluster front-proxy
- --log-level info
- --component-log-level wasm:debug,filter:trace,http:debug,router:debug
command:
- /usr/local/bin/envoy
image: envoyproxy/envoy:v1.31-latest
name: envoy
ports:
- containerPort: 8000
name: web
- containerPort: 8001
name: admin
volumeMounts:
- mountPath: /usr/local/etc/envoy
name: config
readOnly: true
- mountPath: /opt/kuadrant/wasm
name: wasm
volumes:
- configMap:
items:
- key: envoy.yaml
path: envoy.yaml
name: envoy
name: config
- name: wasm
hostPath:
path: /opt/kuadrant/wasm
---
apiVersion: v1
kind: Service
metadata:
labels:
app: envoy
name: envoy
spec:
ports:
- name: web
port: 8000
protocol: TCP
selector:
app: envoy
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-wildcard-host
spec:
rules:
- host: talker-api.127.0.0.1.nip.io
http:
paths:
- backend:
service:
name: envoy
port:
number: 8000
path: /
pathType: Prefix
Loading

0 comments on commit 622a0df

Please sign in to comment.