Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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