demo-app: canary rollout + health analysis (auto-rollback)
This commit is contained in:
parent
1585c8a212
commit
030c57d608
39
manifests/demo-app/analysistemplate.yaml
Normal file
39
manifests/demo-app/analysistemplate.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
# Canary ke har step par chalta hai. App theek jawab de raha hai ya nahi -
|
||||
# 5 baar check, 2 se zyada fail hue to rollout wapas purane version par.
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: AnalysisTemplate
|
||||
metadata:
|
||||
name: app-health
|
||||
namespace: demo-app
|
||||
spec:
|
||||
args:
|
||||
- name: service
|
||||
metrics:
|
||||
- name: http-health
|
||||
interval: 20s
|
||||
count: 5
|
||||
successCondition: result == "1"
|
||||
failureLimit: 2
|
||||
provider:
|
||||
job:
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: check
|
||||
image: curlimages/curl:8.11.1
|
||||
command: [sh, -c]
|
||||
args:
|
||||
- >-
|
||||
curl -sf --max-time 5 http://{{args.service}}/health
|
||||
>/dev/null && echo 1 || echo 0
|
||||
resources:
|
||||
requests: { cpu: "10m", memory: "16Mi" }
|
||||
limits: { cpu: "100m", memory: "64Mi" }
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 65534
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities: { drop: ["ALL"] }
|
||||
@ -1,5 +1,5 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Rollout
|
||||
metadata:
|
||||
name: demo-app
|
||||
namespace: demo-app
|
||||
@ -9,11 +9,26 @@ spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: demo-app
|
||||
# Canary: naya version thode traffic par chalta hai, har step ke baad
|
||||
# analysis hota hai. Analysis fail hua to Rollouts KHUD purane version par
|
||||
# wapas le jaata hai - koi insaan nahi chahiye.
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
canary:
|
||||
maxUnavailable: 0
|
||||
maxSurge: 1
|
||||
analysis:
|
||||
templates:
|
||||
- templateName: app-health
|
||||
startingStep: 1
|
||||
args:
|
||||
- name: service
|
||||
value: demo-app.demo-app.svc.cluster.local
|
||||
steps:
|
||||
- setWeight: 25
|
||||
- pause: { duration: 60s }
|
||||
- setWeight: 50
|
||||
- pause: { duration: 60s }
|
||||
- setWeight: 100
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
Loading…
Reference in New Issue
Block a user