-
Notifications
You must be signed in to change notification settings - Fork 4
355 lines (353 loc) · 18.1 KB
/
tkg-on-aws-e2e.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
name: "tkg-on-aws-create-workshop-environment"
on:
workflow_dispatch:
inputs:
vpc-cidr:
description: "The VPC CIDR block"
required: true
default: "10.60.0.0/18"
footprint:
description: "Footprint for Tanzu Application Platform deployment"
required: true
type: choice
options:
- "single-cluster"
- "multi-cluster"
default: "single-cluster"
aws-access-key-id:
description: "AWS access key identifier for an account with write permissions to a Route53 hosted zone"
required: true
aws-secret-access-key:
description: "AWS secret access key for an account with write permissions to a Route53 hosted zone"
required: true
region:
description: "The AWS region where all resources will be created"
required: true
type: choice
options:
- us-east-1
- us-east-2
- us-west-2
- af-south-1
- ap-east-1
- ap-south-1
- ap-northeast-1
- ap-northeast-2
- ap-northeast-3
- ap-southeast-1
- ap-southeast-2
- ca-central-1
- eu-west-1
- eu-west-2
- eu-west-3
- eu-north-1
- eu-south-1
- me-south-1
- sa-east-1
default: "us-west-2"
email-address:
description: "An email address to be used as the owner for the public trusted domain certificate vended by Let's Encrypt"
required: true
domain:
description: "Domain under management by an existing Route53 Hosted Zone"
required: true
control-plane-node-machine-type:
description: "The Amazon EC2 instance type of the control plane nodes"
required: true
type: choice
options:
- c4.large
- c5.large
- c5a.large
- c6a.large
- m4.large
- m5.large
- m5a.large
- m6a.large
- t3.large
- t3a.large
default: "t3a.large"
worker-node-machine-type:
description: "The Amazon EC2 instance type of the worker nodes"
required: true
type: choice
options:
- c4.xlarge
- c5.xlarge
- c5a.xlarge
- c6a.xlarge
- m4.xlarge
- m5.xlarge
- m5a.xlarge
- m6a.xlarge
- t3.xlarge
- t3a.xlarge
default: "m5a.xlarge"
jobs:
create-keypair:
uses: ./.github/workflows/aws-keypair.yml
with:
ssh-key-name: "tap-admin-key"
region: ${{ github.event.inputs.region }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
TF_BACKEND_S3_BUCKET_NAME: ${{ secrets.TF_BACKEND_S3_BUCKET_NAME }}
AWS_KMS_ALIAS: ${{ secrets.AWS_KMS_ALIAS }}
create-vnet:
uses: ./.github/workflows/aws-virtual-network.yml
with:
vpc-cidr: ${{ github.event.inputs.vpc-cidr }}
region: ${{ github.event.inputs.region }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
TF_BACKEND_S3_BUCKET_NAME: ${{ secrets.TF_BACKEND_S3_BUCKET_NAME }}
AWS_KMS_ALIAS: ${{ secrets.AWS_KMS_ALIAS }}
create-management-cluster:
uses: ./.github/workflows/tkg-management-cluster-on-aws.yml
needs: [create-keypair,create-vnet]
with:
cluster-name: "overlord"
vpc-id: ${{ needs.create-vnet.outputs.vpc_id }}
private-subnet-ids: ${{ needs.create-vnet.outputs.private_subnet_ids }}
public-subnet-ids: ${{ needs.create-vnet.outputs.public_subnet_ids }}
control-plane-node-machine-type: ${{ github.event.inputs.control-plane-node-machine-type }}
worker-node-machine-type: ${{ github.event.inputs.worker-node-machine-type }}
region: ${{ github.event.inputs.region }}
availability-zones: ${{ github.event.inputs.availability-zones }}
ssh-keypair-name: ${{ needs.create-keypair.outputs.ssh_key_name }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
PA_TOKEN: ${{ secrets.PA_TOKEN }}
TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ secrets.TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS }}
create-harbor-cluster:
uses: ./.github/workflows/tkg-workload-cluster-on-aws.yml
needs: [create-keypair,create-management-cluster]
with:
cluster-name: "harbor"
vpc-id: ${{ needs.create-vnet.outputs.vpc_id }}
private-subnet-ids: ${{ needs.create-vnet.outputs.private_subnet_ids }}
public-subnet-ids: ${{ needs.create-vnet.outputs.public_subnet_ids }}
control-plane-node-machine-type: ${{ github.event.inputs.control-plane-node-machine-type }}
worker-node-machine-type: ${{ github.event.inputs.worker-node-machine-type }}
region: ${{ github.event.inputs.region }}
availability-zones: ${{ github.event.inputs.availability-zones }}
ssh-keypair-name: ${{ needs.create-keypair.outputs.ssh_key_name }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
NEW_TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ needs.create-management-cluster.outputs.kubeconfig_contents }}
TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ secrets.TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS }}
fetch-route53-hosted-zone-id:
uses: ./.github/workflows/aws-get-route53-hosted-zone-id-for-domain.yml
with:
domain: ${{ github.event.inputs.domain }}
region: ${{ github.event.inputs.region }}
secrets:
ROUTE53_ZONE_AWS_ACCESS_KEY_ID: ${{ github.event.inputs.aws-access-key-id }}
ROUTE53_ZONE_AWS_SECRET_ACCESS_KEY: ${{ github.event.inputs.aws-secret-access-key }}
install-tanzu-ingress-into-harbor-cluster:
uses: ./.github/workflows/install-tanzu-ingress.yml
needs: [create-harbor-cluster,fetch-route53-hosted-zone-id]
with:
target-cloud: "aws"
domain: ${{ github.event.inputs.domain }}
email-address: ${{ github.event.inputs.email-address }}
aws-region: ${{ github.event.inputs.region }}
aws-route53-hosted-zone-id: ${{ needs.fetch-route53-hosted-zone-id.outputs.hosted_zone_id }}
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
PA_TOKEN: ${{ secrets.PA_TOKEN }}
KUBECONFIG_CONTENTS: ${{ needs.create-harbor-cluster.outputs.kubeconfig_contents }}
ROUTE53_ZONE_AWS_ACCESS_KEY_ID: ${{ github.event.inputs.aws-access-key-id }}
ROUTE53_ZONE_AWS_SECRET_ACCESS_KEY: ${{ github.event.inputs.aws-secret-access-key }}
install-harbor:
uses: ./.github/workflows/aws-harbor.yml
needs: [create-harbor-cluster,install-tanzu-ingress-into-harbor-cluster]
with:
email-address: ${{ github.event.inputs.email-address }}
domain: ${{ github.event.inputs.domain }}
region: ${{ github.event.inputs.region }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
KUBECONFIG_CONTENTS: ${{ needs.create-harbor-cluster.outputs.kubeconfig_contents }}
TF_BACKEND_S3_BUCKET_NAME: ${{ secrets.TF_BACKEND_S3_BUCKET_NAME }}
AWS_KMS_ALIAS: ${{ secrets.AWS_KMS_ALIAS }}
create-new-project-in-harbor:
needs: install-harbor
uses: ./.github/workflows/create-harbor-project.yml
with:
api-endpoint: harbor.${{ github.event.inputs.domain }}
project: "tanzu"
secrets:
HARBOR_USERNAME: "admin"
HARBOR_PASSWORD: ${{ needs.install-harbor.outputs.harbor_admin_password }}
create-tap-cluster:
if: github.event.inputs.footprint == 'single-cluster'
uses: ./.github/workflows/tkg-workload-cluster-on-aws.yml
needs: [create-keypair,create-management-cluster]
with:
cluster-name: "tap"
vpc-id: ${{ needs.create-vnet.outputs.vpc_id }}
private-subnet-ids: ${{ needs.create-vnet.outputs.private_subnet_ids }}
public-subnet-ids: ${{ needs.create-vnet.outputs.public_subnet_ids }}
control-plane-node-machine-type: ${{ github.event.inputs.control-plane-node-machine-type }}
worker-node-machine-type: ${{ github.event.inputs.worker-node-machine-type }}
region: ${{ github.event.inputs.region }}
availability-zones: ${{ github.event.inputs.availability-zones }}
ssh-keypair-name: ${{ needs.create-keypair.outputs.ssh_key_name }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
NEW_TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ needs.create-management-cluster.outputs.kubeconfig_contents }}
TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ secrets.TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS }}
create-tap-build-cluster:
if: github.event.inputs.footprint == 'multi-cluster'
uses: ./.github/workflows/tkg-workload-cluster-on-aws.yml
needs: [create-keypair,create-management-cluster]
with:
cluster-name: "tap-build"
vpc-id: ${{ needs.create-vnet.outputs.vpc_id }}
private-subnet-ids: ${{ needs.create-vnet.outputs.private_subnet_ids }}
public-subnet-ids: ${{ needs.create-vnet.outputs.public_subnet_ids }}
control-plane-node-machine-type: ${{ github.event.inputs.control-plane-node-machine-type }}
worker-node-machine-type: ${{ github.event.inputs.worker-node-machine-type }}
region: ${{ github.event.inputs.region }}
availability-zones: ${{ github.event.inputs.availability-zones }}
ssh-keypair-name: ${{ needs.create-keypair.outputs.ssh_key_name }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
NEW_TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ needs.create-management-cluster.outputs.kubeconfig_contents }}
TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ secrets.TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS }}
create-tap-iterate-cluster:
if: github.event.inputs.footprint == 'multi-cluster'
uses: ./.github/workflows/tkg-workload-cluster-on-aws.yml
needs: [create-keypair,create-management-cluster]
with:
cluster-name: "tap-iterate"
vpc-id: ${{ needs.create-vnet.outputs.vpc_id }}
private-subnet-ids: ${{ needs.create-vnet.outputs.private_subnet_ids }}
public-subnet-ids: ${{ needs.create-vnet.outputs.public_subnet_ids }}
control-plane-node-machine-type: ${{ github.event.inputs.control-plane-node-machine-type }}
worker-node-machine-type: ${{ github.event.inputs.worker-node-machine-type }}
region: ${{ github.event.inputs.region }}
availability-zones: ${{ github.event.inputs.availability-zones }}
ssh-keypair-name: ${{ needs.create-keypair.outputs.ssh_key_name }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
NEW_TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ needs.create-management-cluster.outputs.kubeconfig_contents }}
TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ secrets.TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS }}
create-tap-view-cluster:
if: github.event.inputs.footprint == 'multi-cluster'
uses: ./.github/workflows/tkg-workload-cluster-on-aws.yml
needs: [create-keypair,create-management-cluster]
with:
cluster-name: "tap-view"
vpc-id: ${{ needs.create-vnet.outputs.vpc_id }}
private-subnet-ids: ${{ needs.create-vnet.outputs.private_subnet_ids }}
public-subnet-ids: ${{ needs.create-vnet.outputs.public_subnet_ids }}
control-plane-node-machine-type: ${{ github.event.inputs.control-plane-node-machine-type }}
worker-node-machine-type: ${{ github.event.inputs.worker-node-machine-type }}
region: ${{ github.event.inputs.region }}
availability-zones: ${{ github.event.inputs.availability-zones }}
ssh-keypair-name: ${{ needs.create-keypair.outputs.ssh_key_name }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
NEW_TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ needs.create-management-cluster.outputs.kubeconfig_contents }}
TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ secrets.TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS }}
create-tap-run-cluster:
if: github.event.inputs.footprint == 'multi-cluster'
uses: ./.github/workflows/tkg-workload-cluster-on-aws.yml
needs: [create-keypair,create-management-cluster]
with:
cluster-name: "tap-run"
vpc-id: ${{ needs.create-vnet.outputs.vpc_id }}
private-subnet-ids: ${{ needs.create-vnet.outputs.private_subnet_ids }}
public-subnet-ids: ${{ needs.create-vnet.outputs.public_subnet_ids }}
control-plane-node-machine-type: ${{ github.event.inputs.control-plane-node-machine-type }}
worker-node-machine-type: ${{ github.event.inputs.worker-node-machine-type }}
region: ${{ github.event.inputs.region }}
availability-zones: ${{ github.event.inputs.availability-zones }}
ssh-keypair-name: ${{ needs.create-keypair.outputs.ssh_key_name }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
NEW_TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ needs.create-management-cluster.outputs.kubeconfig_contents }}
TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS: ${{ secrets.TKG_MANAGEMENT_CLUSTER_KUBECONFIG_CONTENTS }}
create-secrets-manager:
uses: ./.github/workflows/aws-secrets-manager.yml
with:
region: ${{ github.event.inputs.region }}
action: create
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
TF_BACKEND_S3_BUCKET_NAME: ${{ secrets.TF_BACKEND_S3_BUCKET_NAME }}
AWS_KMS_ALIAS: ${{ secrets.AWS_KMS_ALIAS }}
update-secrets-manager-secrets-for-single-cluster-footprint:
if: github.event.inputs.footprint == 'single-cluster'
uses: ./.github/workflows/aws-secrets-manager-secrets.yml
needs: [create-keypair,create-secrets-manager,create-harbor-cluster,install-harbor,create-tap-cluster]
with:
secretsManagerName: ${{ needs.create-secrets-manager.outputs.secrets_manager_name }}
region: ${{ github.event.inputs.region }}
action: create
secrets:
secretsMap: '{ "harbor-admin-username" : "${{ needs.install-harbor.outputs.harbor_admin_username }}", "harbor-admin-password" : "${{ needs.install-harbor.outputs.harbor_admin_password }}", "harbor-domain" : "${{ needs.install-harbor.outputs.harbor_domain }}", "bastion-b64-ssh-private-key" : "${{ needs.create-keypair.outputs.b64_ssh_private_key }}", "b64-harbor-cluster-kubeconfig-contents" : "${{ needs.create-harbor-cluster.outputs.kubeconfig_contents }}", "b64-tap-cluster-kubeconfig-contents" : "${{ needs.create-tap-cluster.outputs.kubeconfig_contents }}" }'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
TF_BACKEND_S3_BUCKET_NAME: ${{ secrets.TF_BACKEND_S3_BUCKET_NAME }}
AWS_KMS_ALIAS: ${{ secrets.AWS_KMS_ALIAS }}
update-secrets-manager-secrets-for-multi-cluster-footprint:
if: github.event.inputs.footprint == 'multi-cluster'
uses: ./.github/workflows/aws-secrets-manager-secrets.yml
needs: [create-keypair,create-secrets-manager,create-harbor-cluster,install-harbor,create-tap-build-cluster,create-tap-iterate-cluster,create-tap-view-cluster,create-tap-run-cluster]
with:
secretsManagerName: ${{ needs.create-secrets-manager.outputs.secrets_manager_name }}
region: ${{ github.event.inputs.region }}
action: create
secrets:
secretsMap: '{ "harbor-admin-username" : "${{ needs.install-harbor.outputs.harbor_admin_username }}", "harbor-admin-password" : "${{ needs.install-harbor.outputs.harbor_admin_password }}", "harbor-domain" : "${{ needs.install-harbor.outputs.harbor_domain }}", "bastion-b64-ssh-private-key" : "${{ needs.create-keypair.outputs.b64_ssh_private_key }}", "b64-harbor-cluster-kubeconfig-contents" : "${{ needs.create-harbor-cluster.outputs.kubeconfig_contents }}", "b64-tap-build-cluster-kubeconfig-contents" : "${{ needs.create-tap-build-cluster.outputs.kubeconfig_contents }}", "b64-tap-iterate-cluster-kubeconfig-contents" : "${{ needs.create-tap-iterate-cluster.outputs.kubeconfig_contents }}", "b64-tap-view-cluster-kubeconfig-contents" : "${{ needs.create-tap-view-cluster.outputs.kubeconfig_contents }}", "b64-tap-run-cluster-kubeconfig-contents" : "${{ needs.create-tap-run-cluster.outputs.kubeconfig_contents }}" }'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
TF_BACKEND_S3_BUCKET_NAME: ${{ secrets.TF_BACKEND_S3_BUCKET_NAME }}
AWS_KMS_ALIAS: ${{ secrets.AWS_KMS_ALIAS }}