Skip to content

Instantly share code, notes, and snippets.

@chrisplim
Last active July 19, 2022 19:25
Show Gist options
  • Select an option

  • Save chrisplim/c864a22a5ea7ba788a6a86ca13e54807 to your computer and use it in GitHub Desktop.

Select an option

Save chrisplim/c864a22a5ea7ba788a6a86ca13e54807 to your computer and use it in GitHub Desktop.
small demo to reproduce dryrun bug in argo rollouts
# dryrun-manifests.yaml
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: dryrun-rollout
spec:
replicas: 1
selector:
matchLabels:
app: dryrun
template:
metadata:
labels:
app: dryrun
spec:
containers:
- name: helloworld
image: hashicorp/http-echo:latest
imagePullPolicy: IfNotPresent
args: ["-listen", ":8080", "-text", "hello world"]
ports:
- containerPort: 8080
strategy:
blueGreen:
activeService: dryrun-service
previewService: dryrun-service-preview
prePromotionAnalysis:
templates:
- templateName: dryrun-analysis-success
---
apiVersion: v1
kind: Service
metadata:
name: dryrun-service
spec:
ports:
- port: 8080
targetPort: 8080
protocol: TCP
selector:
app: dryrun
---
apiVersion: v1
kind: Service
metadata:
name: dryrun-service-preview
spec:
ports:
- port: 8080
targetPort: 8080
protocol: TCP
selector:
app: dryrun
---
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: dryrun-analysis-success
spec:
dryRun:
- metricName: test
metrics:
- name: test
provider:
job:
spec:
backoffLimit: 1
template:
spec:
containers:
- name: success
image: alpine:latest
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c", "exit 0"]
restartPolicy: Never
---
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: dryrun-analysis-failure
spec:
dryRun:
- metricName: test
metrics:
- name: test
provider:
job:
spec:
backoffLimit: 1
template:
spec:
containers:
- name: failure
image: alpine:latest
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c", "exit 1"]
restartPolicy: Never
@chrisplim
Copy link
Author

kubectl apply -f dryrun-manifests.yaml
kubectl argo rollouts get rollout dryrun-rollout --watch

In another terminal, cause rollout to happen by updating the rollout image

kubectl argo rollouts set image dryrun-rollout helloworld=hashicorp/http-echo:0.2.3

Notice that the Job completes successfully with exit code 0, but the AnalysisRun never finishes and gets stuck in the Running state.
Screen Shot 2022-07-19 at 12 22 52 PM

kubectl get pods
Screen Shot 2022-07-19 at 12 23 19 PM
kubectl describe pod 25d8853f-6d87-4358-83a7-44d8bf6238f6.test.1-vvqng
Screen Shot 2022-07-19 at 12 23 49 PM

Cleanup:

kubectl delete rollout dryrun-rollout; kubectl delete service dryrun-service dryrun-service-preview; kubectl delete analysistemplate dryrun-analysis-success dryrun-analysis-failure

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