@@ -6,21 +6,29 @@ parameters:
6
6
default: .color
7
7
description: "Config file that keeps track of the current color"
8
8
9
+ - name: namespace
10
+ default: "default"
11
+ description: "Kubernetes namespace"
12
+
9
13
tasks:
10
14
11
15
# https://istio.io/docs/tasks/traffic-management/ingress/#determining-the-ingress-ip-and-ports-when-using-an-external-load-balancer
12
- ingress-host:
16
+ istio-ingress:
17
+ description: Output the FQHN of the Istio Ingress Gateway
13
18
script: |
14
- kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
19
+ kubectl --namespace istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
20
+
15
21
# https://istio.io/docs/setup/kubernetes/quick-start/
16
22
istio-injection:
23
+ description: Enable Istio Sidecar Injection for a namespce
17
24
script: |
18
- kubectl label namespace testing istio-injection=enabled
25
+ kubectl label namespace {{ get "namespace" }} istio-injection=enabled
19
26
20
27
deps:
21
28
description: "Install alpine dependencies"
22
29
script: |
23
30
! which apk >/dev/null || apk add --update curl make bash git kubectl@cloudposse helm@cloudposse helmfile@cloudposse
31
+ helm init --client-only
24
32
25
33
color:
26
34
description: "Lookup the current color"
@@ -34,12 +42,7 @@ tasks:
34
42
35
43
blue-green:
36
44
description: "Trigger a blue-green deployment"
37
-
38
45
parameters:
39
- - name: namespace
40
- default: "default"
41
- description: "Kubernetes namespace"
42
-
43
46
- name: color
44
47
type: string
45
48
description: "Selected color to deploy"
56
59
57
60
steps:
58
61
- task: deps
62
+ - task: istio-injection
59
63
- script: |
60
64
config=${CF_VOLUME_PATH:-.}/{{ get "config" }}
61
65
cur_color={{ get "color" }}
64
68
echo "Updating {{ get "namespace" }}: $cur_color => $new_color"
65
69
echo "$new_color" > ${config}
66
70
export COLOR=$new_color
71
+ # Deploy the app and update istio virtual service
67
72
helmfile --namespace {{ get "namespace" }} sync
0 commit comments