# Mechanism test for the automated rollback, run before the real API exists. # # It proves the exact chain the project depends on: Argo Rollouts pauses a # blue-green promotion, runs an AnalysisRun, that run queries Prometheus over # the network, evaluates the result against a threshold, and aborts the rollout # on failure. The only thing faked is the metric itself. # # Throwaway. deploy/rollouts/ holds the real thing. --- apiVersion: v1 kind: Service metadata: {name: probe-active, namespace: nereus} spec: selector: {app: probe} ports: [{port: 80, targetPort: 8080}] --- apiVersion: v1 kind: Service metadata: {name: probe-preview, namespace: nereus} spec: selector: {app: probe} ports: [{port: 80, targetPort: 8080}] --- apiVersion: argoproj.io/v1alpha1 kind: AnalysisTemplate metadata: {name: error-rate, namespace: nereus} spec: metrics: - name: error-rate interval: 10s count: 3 # Same shape as the real query will use: fail when the error ratio is # above the threshold. failureLimit 0 means one bad sample aborts. successCondition: "result[0] < 0.05" failureLimit: 0 provider: prometheus: address: http://kube-prometheus-stack-prometheus.observability.svc.cluster.local:9090 query: "{{args.query}}" args: - name: query --- apiVersion: argoproj.io/v1alpha1 kind: Rollout metadata: {name: probe, namespace: nereus} spec: replicas: 1 revisionHistoryLimit: 2 selector: matchLabels: {app: probe} template: metadata: labels: {app: probe} spec: containers: - name: web image: nginxinc/nginx-unprivileged:alpine ports: [{containerPort: 8080}] resources: requests: {cpu: 10m, memory: 16Mi} strategy: blueGreen: activeService: probe-active previewService: probe-preview autoPromotionEnabled: true prePromotionAnalysis: templates: - templateName: error-rate args: - name: query value: "vector(0.0)"