Skip to content

Instantly share code, notes, and snippets.

@askmeegs
Created October 17, 2019 22:36
Show Gist options
  • Save askmeegs/88beb1c1d8965bcc8e071017ad3a2a6a to your computer and use it in GitHub Desktop.
Save askmeegs/88beb1c1d8965bcc8e071017ad3a2a6a to your computer and use it in GitHub Desktop.
Hipstershop - Egress Gateway
apiVersion: apps/v1
kind: Deployment
metadata:
name: currencyservice
spec:
selector:
matchLabels:
app: currencyservice
template:
metadata:
labels:
app: currencyservice
spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: gcr.io/next19-istio-traffic/currencyservice:real
imagePullPolicy: Always
ports:
- name: grpc
containerPort: 7000
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway # configure egressgateway to forward to ECB
metadata:
name: istio-egressgateway
spec:
selector:
istio: egressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- www.ecb.europa.eu
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService # direct ECB traffic through the secure gateway
metadata:
name: direct-ecb-through-egress-gateway
spec:
hosts:
- www.ecb.europa.eu
gateways:
- istio-egressgateway
- mesh
http:
- match:
- gateways:
- mesh # CurrencyService --> EgressGateway
port: 80
route:
- destination:
host: istio-egressgateway.istio-system.svc.cluster.local
subset: ecb
port:
number: 80
weight: 100
- match:
- gateways:
- istio-egressgateway # EgressGateway --> ECB External
port: 80
route:
- destination:
host: www.ecb.europa.eu
port:
number: 80
weight: 100
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule #define a subset
metadata:
name: egressgateway-for-ecb
spec:
host: istio-egressgateway.istio-system.svc.cluster.local
subsets:
- name: ecb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment