Skip to content

Instantly share code, notes, and snippets.

@skandragon
Last active October 28, 2022 02:11
Show Gist options
  • Save skandragon/5760e38ae254fd8797c4673aaad65ed7 to your computer and use it in GitHub Desktop.
Save skandragon/5760e38ae254fd8797c4673aaad65ed7 to your computer and use it in GitHub Desktop.
Example Argo Rollouts with analytics job with argument passing
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollouts-demo
namespace: foo
spec:
replicas: 5
strategy:
canary:
analysis:
templates:
- templateName: getenv
args:
- name: rollout-arg-key
value: rollout-arg-value
steps:
- setWeight: 20
- pause: {duration: 30s}
- setWeight: 40
- pause: {duration: 30s}
- setWeight: 60
- pause: {duration: 30s}
- setWeight: 80
- pause: {duration: 30s}
revisionHistoryLimit: 2
selector:
matchLabels:
app: rollouts-demo
template:
metadata:
labels:
app: rollouts-demo
annotations:
forceNewRevision: b
spec:
nodeSelector:
kubernetes.io/arch: amd64
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
namespace: foo
spec:
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
app: rollouts-demo
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: getenv
namespace: foo
spec:
args:
- name: template-arg-key
value: template-arg-value
- name: rollout-arg-key
metrics:
- name: getenv
provider:
job:
spec:
template:
spec:
containers:
- name: getenv
image: alpine
command: ["env"]
env:
- name: FOO
value: bar
- name: ARG_TEMPLATE_KEY
value: "{{args.template-arg-key}}"
- name: ARG_ROLLOUT_KEY
value: "{{args.rollout-arg-key}}"
restartPolicy: Never
backoffLimit: 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment