Skip to content

Commit c65b5d1

Browse files
committed
feat(istio): circuitbreaker example
1 parent 286d257 commit c65b5d1

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

istio_examples/CircuitBreaker/circuitBreaker.yml

100644100755
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
apiVersion: config.istio.io/v1beta1
1+
apiVersion: config.istio.io/v1alpha2
22
kind: DestinationPolicy
33
metadata:
4-
name: api-circuit-breaker
4+
name: github-circuit-breaker
55
spec:
66
destination:
7-
name: api
8-
labels:
9-
version: v1
7+
name: github
108
circuitBreaker:
119
simpleCb:
12-
maxConnections: 1
1310
httpMaxPendingRequests: 1
1411
sleepWindow: 3m
1512
httpDetectionInterval: 1s
1613
httpMaxEjectionPercent: 100
17-
httpConsecutiveErrors: 1
18-
httpMaxRequestsPerConnection: 1
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
FOLDER=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
1+
#!/bin/bash
22

3-
istioctl create -f $FOLDER/circuitBreaker.yml
3+
DIR=$(pwd)
4+
5+
kubectl delete destinationpolicy github-circuit-breaker
6+
kubectl apply -f <(istioctl kube-inject -f $DIR/circuitBreaker.yml)
7+
8+
echo "Testing... (sending 3 request simultaneously)"
9+
POD=$(kubectl get pod -l app=api -o jsonpath='{.items[0].metadata.name}')
10+
kubectl exec -it $POD -c api -- sh -c "curl -s -I http://github.default.svc.cluster.local:5000/api/hello/ | grep HTTP/1.1 & curl -s -I http://github.default.svc.cluster.local:5000/api/hello | grep HTTP/1.1 & curl -s -I http://github.default.svc.cluster.local:5000/api/hello | grep HTTP/1.1 & sleep 2s"

istio_examples/Services/destroy.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
#!/bin/bash
22

33
kubectl delete deployment,svc,ingress,routerule,destinationpolicy --all
4+
5+
kubectl delete -f <(istioctl kube-inject -f RateLimiting/adapter.yml)
6+
kubectl delete -f <(istioctl kube-inject -f RateLimiting/instance.yml)
7+
kubectl delete -f <(istioctl kube-inject -f RateLimiting/rule.yml)
8+
9+
kubectl delete -f ~/istio-0.4.0/install/kubernetes/addons/prometheus.yaml
10+
kubectl delete -f ~/istio-0.4.0/install/kubernetes/addons/zipkin.yaml
11+
kubectl delete -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/all-in-one/jaeger-all-in-one-template.yml -n istio-system

0 commit comments

Comments
 (0)