Skip to content

Instantly share code, notes, and snippets.

@xeviknal
Created November 5, 2021 15:58
Show Gist options
  • Save xeviknal/9ab154d6e34c9101b54e076a16645adb to your computer and use it in GitHub Desktop.
Save xeviknal/9ab154d6e34c9101b54e076a16645adb to your computer and use it in GitHub Desktop.
Argo Rollouts - istio Subset traffic level splitting
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollouts-demo
spec:
replicas: 1
strategy:
canary:
steps:
- setWeight: 5
- pause: {}
- setWeight: 15
- pause:
duration: 10
- setWeight: 25
- pause: {}
- setWeight: 55
- pause:
duration: 10
- setWeight: 75
- pause: {}
trafficRouting:
istio:
destinationRule:
canarySubsetName: canary
name: rollout-destrule
stableSubsetName: stable
virtualService:
name: rollout-vsvc
routes:
- primary
revisionHistoryLimit: 2
selector:
matchLabels:
app: rollouts-demo
template:
metadata:
labels:
app: rollouts-demo
istio-injection: enabled
spec:
containers:
- name: rollouts-demo
image: argoproj/rollouts-demo:blue
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
requests:
memory: 32Mi
cpu: 5m
---
apiVersion: v1
kind: Service
metadata:
name: rollouts-demo
spec:
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
app: rollouts-demo
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: rollout-vsvc
spec:
gateways:
- rollouts-demo-gateway
hosts:
- istio-rollout.dev.argoproj.io
http:
- name: primary # referenced in canary.trafficRouting.istio.virtualService.routes
route:
- destination:
host: rollouts-demo
subset: stable # referenced in canary.trafficRouting.istio.destinationRule.stableSubsetName
weight: 100
- destination:
host: rollouts-demo
subset: canary # referenced in canary.trafficRouting.istio.destinationRule.canarySubsetName
weight: 0
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: rollout-destrule
spec:
host: rollouts-demo
subsets:
- name: canary # referenced in canary.trafficRouting.istio.destinationRule.canarySubsetName
labels: # labels will be injected with canary rollouts-pod-template-hash value
app: rollouts-demo
- name: stable # referenced in canary.trafficRouting.istio.destinationRule.stableSubsetName
labels: # labels will be injected with stable rollouts-pod-template-hash value
app: rollouts-demo
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: rollouts-demo-gateway
spec:
selector:
istio: ingressgateway # use istio default controller
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
@xeviknal
Copy link
Author

xeviknal commented Nov 5, 2021

Those are the steps needed to deploy an Argo Rollout with both a stable and canary version:

  1. Install Argo Rollouts via [0]
  2. Deploy the yaml in this gist
  3. Kiali Istio Section should appear all green.
  4. Create a canary
kubectl argo rollouts set image rollouts-demo rollouts-demo=argoproj/rollouts-demo:yellow
kubectl argo rollouts get rollout rollouts-demo
  1. DestinationRule details page should show a warning in the canary subset (until kiali/kiali#4210 is fixed)

[0] https://argoproj.github.io/argo-rollouts/getting-started/istio/
[1] https://argoproj.github.io/argo-rollouts/features/traffic-management/istio/#subset-level-traffic-splitting

@vipul0805
Copy link

Hi @xeviknal The current Implementation will not work with an AnalysisTemplate I think as right now there is no way to query the stable and canary subsets metrics if you do not have a version label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment