Skip to content

Commit

Permalink
Adds Bubble Example with Istio and Istio+ArgoRollouts
Browse files Browse the repository at this point in the history
  • Loading branch information
lordofthejars committed Nov 12, 2021
1 parent 1586d84 commit fbdd9c5
Show file tree
Hide file tree
Showing 16 changed files with 240 additions and 1 deletion.
12 changes: 12 additions & 0 deletions bubbles/bubbles-backend/src/main/argorollouts/Service-canary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: bubble-backend-canary
labels:
app: bubblebackend
spec:
ports:
- name: http
port: 8080
selector:
app: bubblebackend
12 changes: 12 additions & 0 deletions bubbles/bubbles-backend/src/main/argorollouts/Service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: bubble-backend
labels:
app: bubblebackend
spec:
ports:
- name: http
port: 8080
selector:
app: bubblebackend
55 changes: 55 additions & 0 deletions bubbles/bubbles-backend/src/main/argorollouts/rollout-v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: bubblebackend
labels:
app: bubblebackend
spec:
strategy:
canary:
steps:
- setWeight: 20
- pause:
duration: "1m"
- setWeight: 50
- pause:
duration: "2m"
canaryService: bubble-backend-canary
stableService: bubble-backend
trafficRouting:
istio:
virtualService:
name: bubble-backend
routes:
- primary
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: bubblebackend
version: v1
template:
metadata:
labels:
app: bubblebackend
version: v1
annotations:
sidecar.istio.io/inject: "true"
spec:
containers:
- name: bubblebackend
image: quay.io/rhdevelopers/bubble-backend:v1.0
env:
- name: BUBBLE_COLOR
value: blue
imagePullPolicy: Always
ports:
- name: web
containerPort: 8080
resources:
requests:
memory: "64Mi"
cpu: "100m"
limits:
memory: "128Mi"
cpu: "140m"
52 changes: 52 additions & 0 deletions bubbles/bubbles-backend/src/main/argorollouts/rollout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: bubblebackend
labels:
app: bubblebackend
spec:
strategy:
canary:
steps:
- setWeight: 20
- pause:
duration: "1m"
- setWeight: 50
- pause:
duration: "2m"
canaryService: bubble-backend-canary
stableService: bubble-backend
trafficRouting:
istio:
virtualService:
name: bubble-backend
routes:
- primary
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: bubblebackend
version: v1
template:
metadata:
labels:
app: bubblebackend
version: v1
annotations:
sidecar.istio.io/inject: "true"
spec:
containers:
- name: bubblebackend
image: quay.io/rhdevelopers/bubble-backend:v1.0
imagePullPolicy: Always
ports:
- name: web
containerPort: 8080
resources:
requests:
memory: "64Mi"
cpu: "100m"
limits:
memory: "128Mi"
cpu: "140m"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: bubble-backend
spec:
hosts:
- bubble-backend
http:
- route:
- destination:
host: bubble-backend
weight: 100
- destination:
host: bubble-backend-canary
weight: 0
name: primary
17 changes: 17 additions & 0 deletions bubbles/scripts/argorollout/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

kubectl delete -f ../../bubbles-backend/src/main/argorollouts/rollout.yaml

kubectl delete -f ../../bubbles-backend/src/main/argorollouts/Service.yaml
kubectl delete -f ../../bubbles-backend/src/main/argorollouts/Service-canary.yaml
kubectl delete -f ../../bubbles-backend/src/main/argorollouts/virtual-service-bubble-backend-v1_and_v2_100_0.yaml


kubectl delete -f ../../bubbles-frontend/src/main/istio/Gateway.yaml

kubectl delete -f ../../bubbles-frontend/src/main/kubernetes/Deployment.yaml
kubectl delete -f ../../bubbles-frontend/src/main/kubernetes/Service.yaml




22 changes: 22 additions & 0 deletions bubbles/scripts/argorollout/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

echo "###### Deploying FrontEnd ######"

kubectl apply -f ../../bubbles-frontend/src/main/kubernetes/Deployment.yaml
kubectl apply -f ../../bubbles-frontend/src/main/kubernetes/Service.yaml

kubectl wait --for=condition=available --timeout=600s deployment/bubblefrontend

kubectl apply -f ../../bubbles-frontend/src/main/istio/Gateway.yaml

echo "###### Deploying BackEnd V1 ######"

kubectl apply -f ../../bubbles-backend/src/main/argorollouts/Service.yaml
kubectl apply -f ../../bubbles-backend/src/main/argorollouts/Service-canary.yaml
kubectl apply -f ../../bubbles-backend/src/main/argorollouts/virtual-service-bubble-backend-v1_and_v2_100_0.yaml

kubectl apply -f ../../bubbles-backend/src/main/argorollouts/rollout.yaml

kubectl get routes -n istio-system

echo "/bubble/index.html"
4 changes: 4 additions & 0 deletions bubbles/scripts/argorollout/install_rollout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl create namespace argo-rollouts
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/download/v1.1.0/install.yaml
3 changes: 3 additions & 0 deletions bubbles/scripts/argorollout/rolling-to-v2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl apply -f ../../bubbles-backend/src/main/argorollouts/rollout-v2.yaml
13 changes: 13 additions & 0 deletions bubbles/scripts/istio/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

kubectl delete -f ../../bubbles-backend/src/main/istio/destination-rule-bubble-backend-v1-v2.yaml
kubectl delete -f ../../bubbles-backend/src/main/istio/virtual-service-bubble-backend-v1_and_v2_100_0.yaml

kubectl delete -f ../../bubbles-backend/src/main/kubernetes/Deployment.yaml
kubectl delete -f ../../bubbles-backend/src/main/kubernetes/Deployment-v2.yaml
kubectl delete -f ../../bubbles-backend/src/main/kubernetes/Service.yaml

kubectl delete -f ../../bubbles-frontend/src/main/kubernetes/Deployment.yaml
kubectl delete -f ../../bubbles-frontend/src/main/kubernetes/Service.yaml

kubectl delete -f ../../bubbles-frontend/src/main/istio/Gateway.yaml
28 changes: 28 additions & 0 deletions bubbles/scripts/istio/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

echo "###### Deploying FrontEnd ######"

kubectl apply -f ../../bubbles-frontend/src/main/kubernetes/Deployment.yaml
kubectl apply -f ../../bubbles-frontend/src/main/kubernetes/Service.yaml

kubectl wait --for=condition=available --timeout=600s deployment/bubblefrontend

kubectl apply -f ../../bubbles-frontend/src/main/istio/Gateway.yaml

echo "###### Deploying BackEnd ######"

kubectl apply -f ../../bubbles-backend/src/main/kubernetes/Deployment.yaml
kubectl apply -f ../../bubbles-backend/src/main/kubernetes/Deployment-v2.yaml
kubectl apply -f ../../bubbles-backend/src/main/kubernetes/Service.yaml

kubectl wait --for=condition=available --timeout=600s deployment/bubblebackend
kubectl wait --for=condition=available --timeout=600s deployment/bubblebackend-v2

echo "###### Redirecting Traffic to V1 ######"

kubectl apply -f ../../bubbles-backend/src/main/istio/destination-rule-bubble-backend-v1-v2.yaml
kubectl apply -f ../../bubbles-backend/src/main/istio/virtual-service-bubble-backend-v1_and_v2_100_0.yaml

kubectl get routes -n istio-system

echo "/bubble/index.html"
5 changes: 5 additions & 0 deletions bubbles/scripts/istio/redirect-to-v2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

echo "###### Redirecting Traffic to V2 ######"

kubectl apply -f ../../bubbles-backend/src/main/istio/virtual-service-bubble-backend-v1_and_v2_0_100.yaml
Binary file modified capture1.pcap
Binary file not shown.
Binary file modified capture2.pcap
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ spec:
maxConnections: 1
outlierDetection:
baseEjectionTime: 3m
consecutiveErrors: 1
consecutive5xxErrors: 1
interval: 1s
maxEjectionPercent: 100

0 comments on commit fbdd9c5

Please sign in to comment.