Skip to content

Instantly share code, notes, and snippets.

@matiasah
Created January 23, 2023 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matiasah/dab1c1cf9e28542e401ca40d78af834a to your computer and use it in GitHub Desktop.
Save matiasah/dab1c1cf9e28542e401ca40d78af834a to your computer and use it in GitHub Desktop.
Istio EnvoyFilter to inject Google API credentials to outgoing requests
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: google-auth-filter
spec:
workloadSelector:
labels:
app: my-service
configPatches:
- applyTo: HTTP_FILTER
match:
context: SIDECAR_OUTBOUND
listener:
filterChain:
filter:
name: "envoy.http_connection_manager"
subFilter:
name: "envoy.router"
route:
destination:
host: "www.googleapis.com"
patch:
operation: INSERT_BEFORE
value:
name: envoy.filters.http.envoy_google_auth
config:
service_account_json: /etc/google/auth/service_account.json
- applyTo: HTTP_FILTER
match:
context: SIDECAR_OUTBOUND
listener:
filterChain:
filter:
name: "envoy.http_connection_manager"
subFilter:
name: "envoy.router"
route:
destination:
host: "www.googleapis.com"
patch:
operation: INSERT_BEFORE
value:
name: envoy.filters.http.headers_to_metadata
config:
headers:
- name: x-goog-iap-jwt-assertion
metadata_key: "google.auth.jwt"
- applyTo: HTTP_FILTER
match:
context: SIDECAR_OUTBOUND
listener:
filterChain:
filter:
name: "envoy.http_connection_manager"
subFilter:
name: "envoy.router"
route:
destination:
host: "www.googleapis.com"
patch:
operation: INSERT_BEFORE
value:
name: envoy.filters.http.google_auth
config:
service_account_json: /etc/google/auth
@matiasah
Copy link
Author

This EnvoyFilter was created by Chat GPT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment