Skip to content

Commit 382b858

Browse files
committed
Update examples for Argo CD v0.11
1 parent 62c4539 commit 382b858

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+287
-150
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ to explore ArgoCD and GitOps!
66

77
| Application | Description |
88
|-------------|-------------|
9-
| [guestbook](guestbook/) | A hello word application |
9+
| [guestbook](guestbook/) | A hello word guestbook application as plain YAML |
1010
| [ksonnet-guestbook](ksonnet-guestbook/) | The guestbook application as a ksonnet app |
1111
| [helm-guestbook](helm-guestbook/) | The guestbook application as a Helm chart |
1212
| [jsonnet-guestbook](jsonnet-guestbook/) | The guestbook application as a raw jsonnet |
1313
| [kustomize-guestbook](kustomize-guestbook/) | The guestbook application as a kustomize app |
14-
| [pre-post-sync](pre-post-sync/) | Demonstrates ArgoCD PreSync and PostSync hooks |
15-
| [blue-green-deploy](blue-green-deploy/) | Demonstrates an ArgoCD Sync hook which performs a blue/green deployment |
14+
| [pre-post-sync](pre-post-sync/) | Demonstrates Argo CD PreSync and PostSync hooks |
15+
| [blue-green-deploy](blue-green-deploy/) | Demonstrates an Argo CD Sync hook which performs a blue/green deployment |
16+
| [blue-green-deploy-workflow](blue-green-deploy-workflow/) | Demonstrates an ArgoCD Sync hook which performs a blue/green deployment as an Argo Workflow |
1617
| [sock-shop](sock-shop/) | A microservices demo application (https://microservices-demo.github.io) |
File renamed without changes.

sock-shop/app.yaml renamed to blue-green-deploy-workflow/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ environments:
77
k8sVersion: v1.10.0
88
path: default
99
kind: ksonnet.io/app
10-
name: sock-shop
10+
name: blue-green-deploy-workflow
1111
version: 0.0.1

pre-post-sync/components/guestbook-ui.jsonnet renamed to blue-green-deploy-workflow/components/bg-guestbook.jsonnet

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
local env = std.extVar("__ksonnet/environments");
2-
local params = std.extVar("__ksonnet/params").components["guestbook-ui"];
2+
local params = std.extVar("__ksonnet/params").components["bg-guestbook"];
33
[
44
{
55
"apiVersion": "v1",
66
"kind": "Service",
77
"metadata": {
8-
"name": params.name
8+
"name": params.name,
9+
"annotations": {
10+
"argocd.argoproj.io/hook": "Skip",
11+
},
912
},
1013
"spec": {
1114
"ports": [
@@ -24,7 +27,10 @@ local params = std.extVar("__ksonnet/params").components["guestbook-ui"];
2427
"apiVersion": "apps/v1beta2",
2528
"kind": "Deployment",
2629
"metadata": {
27-
"name": params.name
30+
"name": params.name,
31+
"annotations": {
32+
"argocd.argoproj.io/hook": "Skip",
33+
},
2834
},
2935
"spec": {
3036
"replicas": params.replicas,
@@ -42,21 +48,13 @@ local params = std.extVar("__ksonnet/params").components["guestbook-ui"];
4248
"spec": {
4349
"containers": [
4450
{
45-
"image": params.image,
46-
"name": params.name,
47-
"ports": [
51+
"image": params.image,
52+
"name": params.name,
53+
"ports": [
4854
{
4955
"containerPort": params.containerPort
5056
}
51-
],
52-
// dummy readiness probe to slow down the rollout for demo/testing
53-
"readinessProbe": {
54-
"exec": {
55-
"command": [ "sh", "-c", "exit 0" ],
56-
},
57-
"initialDelaySeconds": 10,
58-
"periodSeconds": 30,
59-
}
57+
]
6058
}
6159
]
6260
}

pre-post-sync/components/params.libsonnet renamed to blue-green-deploy-workflow/components/params.libsonnet

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
components: {
77
// Component-level parameters, defined initially from 'ks prototype use ...'
88
// Each object below should correspond to a component in the components/ directory
9-
"guestbook-ui": {
9+
"bg-guestbook": {
1010
containerPort: 80,
1111
image: "gcr.io/heptio-images/ks-guestbook-demo:0.2",
12-
name: "pre-post-sync",
13-
replicas: 1,
12+
name: "bg-guestbook",
13+
replicas: 3,
1414
servicePort: 80,
15-
type: "ClusterIP",
15+
type: "LoadBalancer",
1616
},
17-
"pre-sync-job": {},
18-
"post-sync-job": {},
17+
"bg-workflow": {},
1918
},
2019
}

blue-green-deploy/components/wf/bluegreen.yaml renamed to blue-green-deploy-workflow/components/wf/bluegreen.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ spec:
8181
args:
8282
- kubectl get --export -o json deployment.apps/{{workflow.parameters.deployment-name}} > /original-deploy &&
8383
jq -r '.metadata.name+="-blue" |
84-
.spec.template.metadata.labels += (.spec.template.metadata.labels | to_entries | map(select(.key != "applications.argoproj.io/app-name")) | map(.value+="-blue") | from_entries) |
85-
.spec.selector.matchLabels += (.spec.selector.matchLabels | to_entries | map(select(.key != "applications.argoproj.io/app-name")) | map(.value+="-blue") | from_entries)'
84+
.spec.template.metadata.labels += (.spec.template.metadata.labels | to_entries | map(select(.key != "app.kubernetes.io/instance")) | map(.value+="-blue") | from_entries) |
85+
.spec.selector.matchLabels += (.spec.selector.matchLabels | to_entries | map(select(.key != "app.kubernetes.io/instance")) | map(.value+="-blue") | from_entries)'
8686
/original-deploy > /cloned-deploy &&
8787
cat /cloned-deploy &&
8888
kubectl apply -o yaml -f /cloned-deploy
@@ -103,12 +103,12 @@ spec:
103103
command: [sh, -c, -x]
104104
args:
105105
- cp /manifest /manifest-new &&
106-
APP_NAME=$(kubectl get -n default -f /manifest-new -o json | jq -r '.metadata.labels."applications.argoproj.io/app-name"') &&
106+
APP_NAME=$(kubectl get -f /manifest-new -o json | jq -r '.metadata.labels."app.kubernetes.io/instance"') &&
107107
if [ "$APP_NAME" != "null" ]; then
108-
jq -r --arg APP_NAME "$APP_NAME" '.metadata.labels."applications.argoproj.io/app-name" = $APP_NAME' /manifest-new > /manifest-new.tmp &&
108+
jq -r --arg APP_NAME "$APP_NAME" '.metadata.labels."app.kubernetes.io/instance" = $APP_NAME' /manifest-new > /manifest-new.tmp &&
109109
mv /manifest-new.tmp /manifest-new &&
110110
if [ "$(jq -r .spec.template.metadata.labels /manifest-new)" != "null" ]; then
111-
jq -r --arg APP_NAME "$APP_NAME" '.spec.template.metadata.labels."applications.argoproj.io/app-name" = $APP_NAME' /manifest-new > /manifest-new.tmp &&
111+
jq -r --arg APP_NAME "$APP_NAME" '.spec.template.metadata.labels."app.kubernetes.io/instance" = $APP_NAME' /manifest-new > /manifest-new.tmp &&
112112
mv /manifest-new.tmp /manifest-new ;
113113
fi ;
114114
fi &&
@@ -131,7 +131,7 @@ spec:
131131
image: argoproj/argoexec:v2.1.1
132132
command: [sh, -c, -x]
133133
args:
134-
- kubectl get -n default service {{workflow.parameters.service-name}} --export -o json > /original-svc &&
134+
- kubectl get service {{workflow.parameters.service-name}} --export -o json > /original-svc &&
135135
jq '.spec.selector = (.spec.selector | with_entries(.value+="-blue"))' /original-svc > /blue-svc &&
136136
kubectl apply -o yaml -f /blue-svc
137137

0 commit comments

Comments
 (0)