Skip to content

Instantly share code, notes, and snippets.

@zswanson
Created March 13, 2022 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zswanson/19d7259ab720d4153dc4aae0f3e20df2 to your computer and use it in GitHub Desktop.
Save zswanson/19d7259ab720d4153dc4aae0f3e20df2 to your computer and use it in GitHub Desktop.
argocd-rollouts bluegreen demo with sync-wave on a secondary deployment, to control a staged rollout
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: bluegreen-demo
namespace: argocd
spec:
project: default
source:
repoURL: <your repo>
targetRevision: main
path: <path to your manifests>
destination:
server: https://kubernetes.default.svc
namespace: default
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: bluegreen
spec:
replicas: 0 # controlled by Rollout
revisionHistoryLimit: 1
selector:
matchLabels:
app: bluegreen
template:
metadata:
labels:
app: bluegreen
sidecar.istio.io/inject: "true"
spec:
containers:
- image: argoproj/rollouts-demo:blue
name: demo
ports:
- containerPort: 8080
name: http
protocol: TCP
resources:
requests:
cpu: 5m
memory: 32Mi
limits:
cpu: 50m
memory: 100Mi
lifecycle:
preStop:
# pause to allow k8s apis to remove the pod from Service Endpoints
exec:
command:
- /usr/bin/sh
- -c
- sleep 15s
terminationGracePeriodSeconds: 30
---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: bluegreen
spec:
workloadRef:
apiVersion: apps/v1
kind: Deployment
name: bluegreen
## Argo Rollouts config ##
strategy:
blueGreen:
activeService: bluegreen-active
previewService: bluegreen-preview
previewReplicaCount: 1
autoPromotionEnabled: false
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: bluegreen-worker
annotations:
argocd.argoproj.io/sync-wave: "10"
spec:
replicas: 1
revisionHistoryLimit: 1
selector:
matchLabels:
app: bluegreen-worker
template:
metadata:
labels:
app: bluegreen-worker
sidecar.istio.io/inject: "true"
spec:
containers:
- image: argoproj/rollouts-demo:yellow
imagePullPolicy: Always
name: demo
ports:
- containerPort: 8080
name: http
protocol: TCP
resources:
requests:
cpu: 5m
memory: 32Mi
limits:
cpu: 50m
memory: 100Mi
lifecycle:
preStop:
# pause to allow k8s apis to remove the pod from Service Endpoints
exec:
command:
- /usr/bin/sh
- -c
- sleep 15s
terminationGracePeriodSeconds: 30
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: default
resources:
- deployment.yml
- deployment-worker.yml
- service.yml
apiVersion: v1
kind: Service
metadata:
name: bluegreen
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
selector:
app: bluegreen
---
apiVersion: v1
kind: Service
metadata:
name: bluegreen-active
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
selector:
app: bluegreen
---
apiVersion: v1
kind: Service
metadata:
name: bluegreen-preview
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
selector:
app: bluegreen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment