Skip to content

Instantly share code, notes, and snippets.

@jonmoter
Created August 8, 2019 17:21
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 jonmoter/222f5f83732e0a76d08c28bc199be737 to your computer and use it in GitHub Desktop.
Save jonmoter/222f5f83732e0a76d08c28bc199be737 to your computer and use it in GitHub Desktop.
example of how we could route traffic by header
# There's an assumption here that there are multiple Services defined
# for ProxySQL, each with a label of `cluster`. Each Service points to
# its own Deployment, which handles requests for that cluster
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: reviews
spec:
host: proxysql
subsets:
- { name: cluster-100, labels: { cluster: "100" } }
- { name: cluster-101, labels: { cluster: "101" } }
- { name: cluster-102, labels: { cluster: "102" } }
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: proxysql-cluster
spec:
hosts:
- proxysql-header
http:
# Cluster-100
- match:
- headers: { X-Zendesk-Cluster-Id: { exact: "100" } }
route:
- destination: { host: proxysql, subset: cluster-100 }
# Cluster-101
- match:
- headers: { X-Zendesk-Cluster-Id: { exact: "101" } }
route:
- destination: { host: proxysql, subset: cluster-101 }
### Default route
- route:
- destination: { host: proxysql, subset: cluster-100 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment