Skip to content
Closed
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
4 changes: 2 additions & 2 deletions charts/substrate/templates/atenet-egress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ data:
mode: tunnel
accessLog:
add:
substrate.connect.authority: 'destination.address + ":" + string(destination.port)'
substrate.connect.authority: '(destination.address.contains(":") ? "[" + destination.address + "]" : destination.address) + ":" + string(destination.port)'
# Authorize the actor identity at CONNECT-accept, before any tunnel
# (HTTP, TLS, or opaque TCP) is terminated. Fails closed when the
# control plane is unreachable.
Expand Down Expand Up @@ -85,7 +85,7 @@ data:
routes:
- backends:
- dynamic:
target: 'destination.address + ":" + string(destination.port)'
target: '(destination.address.contains(":") ? "[" + destination.address + "]" : destination.address) + ":" + string(destination.port)'
policies:
substrateEgress:
host: {{ include "substrate.fullname" (list "api" .) }}.{{ .Release.Namespace }}.svc:443
Expand Down
10 changes: 6 additions & 4 deletions demos/egress/test-egress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ ${K} -n "${TARGET_NS}" create deployment whoami --image=traefik/whoami >/dev/nul
${K} -n "${TARGET_NS}" expose deployment whoami --port="${TARGET_PORT}" --target-port=80 >/dev/null 2>&1 || true
${K} -n "${TARGET_NS}" rollout status deployment/whoami --timeout=120s
TARGET_IP=$(${K} -n "${TARGET_NS}" get svc whoami -o jsonpath='{.spec.clusterIP}')
info "target = ${TARGET_IP}:${TARGET_PORT}"
TARGET_AUTHORITY="${TARGET_IP}:${TARGET_PORT}"
if [[ "${TARGET_IP}" == *:* ]]; then TARGET_AUTHORITY="[${TARGET_IP}]:${TARGET_PORT}"; fi
info "target = ${TARGET_AUTHORITY}"

log "create + resume Actor ${ATESPACE}/${ACTOR}, allow all its egress"
${KATE} create atespace "${ATESPACE}" >/dev/null 2>&1 || true
Expand Down Expand Up @@ -128,7 +130,7 @@ ${KATE} proxy actor "${ACTOR}" 18099:80 -a "${ATESPACE}" >/tmp/egress-pf.log 2>&
PF=$!; sleep 4
CODE=$(curl -s -o /tmp/egress-body.txt -w '%{http_code}' -X POST http://localhost:18099/ \
-H 'Content-Type: application/json' \
-d "{\"url\":\"http://${TARGET_IP}:${TARGET_PORT}/\"}" || true)
-d "{\"url\":\"http://${TARGET_AUTHORITY}/\"}" || true)
kill "${PF}" >/dev/null 2>&1 || true
sleep 1
info "actor round-trip HTTP ${CODE}"
Expand All @@ -146,7 +148,7 @@ if [[ "${DATAPLANE}" == "envoy" ]]; then
else
# agentgateway's structured access log records the CONNECT authority. Actor
# authentication is also covered by the successful request and negative test.
ALLOWED_LOG_PATTERN="substrate.connect.authority.*${TARGET_IP}:${TARGET_PORT}"
ALLOWED_LOG_PATTERN="substrate.connect.authority.*${TARGET_AUTHORITY//\[/\\[}"
fi
if LINE=$(wait_egress_log "${BEFORE}" "${ALLOWED_LOG_PATTERN}"); then
pass "gateway logged the CONNECT: ${LINE}"
Expand Down Expand Up @@ -197,7 +199,7 @@ PROBE=$(${K} -n ate-system exec ${PROBE_POD} -- sh -c "curl -s -o /dev/null -w '
--proxy-cacert /run/servicedns.podcert.ate.dev/trust-bundle.pem \
--proxy-cert /run/podidentity.podcert.ate.dev/credential-bundle.pem \
--proxy-key /run/podidentity.podcert.ate.dev/credential-bundle.pem \
--proxytunnel -x https://atenet-egress.ate-system.svc:443 http://${TARGET_IP}:${TARGET_PORT}/; echo \" exit=\$?\"" || true)
--proxytunnel -x https://atenet-egress.ate-system.svc:443 http://${TARGET_AUTHORITY}/; echo \" exit=\$?\"" || true)
CODE=${PROBE%% *}
info "pod-identity CONNECT attempt: http_connect=${CODE:-000}${PROBE#"${CODE}"}"
if [[ "${CODE}" != "200" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ patches:
mode: tunnel
accessLog:
add:
substrate.connect.authority: 'destination.address + ":" + string(destination.port)'
substrate.connect.authority: '(destination.address.contains(":") ? "[" + destination.address + "]" : destination.address) + ":" + string(destination.port)'
substrateEgressActorResolution:
host: api.ate-system.svc:443
policies:
Expand Down Expand Up @@ -139,7 +139,7 @@ patches:
body: WebSocket egress is not supported
- backends:
- dynamic:
target: 'destination.address + ":" + string(destination.port)'
target: '(destination.address.contains(":") ? "[" + destination.address + "]" : destination.address) + ":" + string(destination.port)'
policies:
substrateEgress: *egressPolicy
- protocol: TLS
Expand Down
6 changes: 3 additions & 3 deletions manifests/ate-install/components/agentgateway/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ data:
mode: tunnel
accessLog:
add:
substrate.connect.authority: 'destination.address + ":" + string(destination.port)'
substrate.connect.authority: '(destination.address.contains(":") ? "[" + destination.address + "]" : destination.address) + ":" + string(destination.port)'
substrateEgressActorResolution:
host: api.ate-system.svc:443
policies:
Expand Down Expand Up @@ -191,7 +191,7 @@ data:
tcpRoutes:
- backends:
- dynamic:
target: 'destination.address + ":" + string(destination.port)'
target: '(destination.address.contains(":") ? "[" + destination.address + "]" : destination.address) + ":" + string(destination.port)'
- protocol: HTTP
routes:
- name: reject-websocket-upgrade
Expand All @@ -209,7 +209,7 @@ data:
body: WebSocket egress is not supported
- backends:
- dynamic:
target: 'destination.address + ":" + string(destination.port)'
target: '(destination.address.contains(":") ? "[" + destination.address + "]" : destination.address) + ":" + string(destination.port)'
policies:
substrateEgress:
host: api.ate-system.svc:443
Expand Down