This repository has been archived by the owner on Oct 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
315 lines (291 loc) · 18.1 KB
/
multi-cluster-tanzu-application-platform-install-on-azure-dispatch.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
name: "multi-cluster-tanzu-application-platform-install-on-azure-dispatch"
on:
workflow_dispatch:
inputs:
cluster-provider:
description: "The Kubernetes service provider"
type: choice
required: true
options:
- aks
- tkg»azure
default: "aks"
container-image-registry-provider:
description: "The container image registry provider"
required: true
type: choice
options:
- azure-container-registry
- harbor-on-azure
default: "azure-container-registry"
secrets-manager-instance-name:
description: "The name of a Azure Key Vault instance"
required: true
domain:
description: "A domain that the installation of TAP will be addressable from"
required: true
default: "foo.com"
subdomains:
description: "Comma-separated list of subdomains for each cluster hosting iterate, view, and run TAP profiles"
required: true
default: "view,iterate,run"
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
dev-namespace:
description: "A namespace that will accommodate Workloads"
required: true
default: "default"
backstage-catalog:
description: "A Git repository and path to a Backstage catalog file"
required: true
jobs:
obtain-secrets-from-secrets-manager:
runs-on: ubuntu-22.04
outputs:
container-image-registry-provider: ${{ steps.vars.outputs.container-image-registry-provider }}
acr-admin-username: ${{ steps.vars.outputs.acr-admin-username }}
acr-admin-password: ${{ steps.vars.outputs.acr-admin-password }}
acr-url: ${{ steps.vars.outputs.acr-url }}
harbor-admin-username: ${{ steps.vars.outputs.harbor-admin-username }}
harbor-admin-password: ${{ steps.vars.outputs.harbor-admin-password }}
harbor-domain: ${{ steps.vars.outputs.harbor-domain }}
b64-harbor-cluster-kubeconfig-contents: ${{ steps.vars.outputs.b64-harbor-cluster-kubeconfig-contents }}
b64-tap-build-cluster-kubeconfig-contents: ${{ steps.vars.outputs.b64-tap-build-cluster-kubeconfig-contents }}
b64-tap-iterate-cluster-kubeconfig-contents: ${{ steps.vars.outputs.b64-tap-iterate-cluster-kubeconfig-contents }}
b64-tap-view-cluster-kubeconfig-contents: ${{ steps.vars.outputs.b64-tap-view-cluster-kubeconfig-contents }}
b64-tap-run-cluster-kubeconfig-contents: ${{ steps.vars.outputs.b64-tap-run-cluster-kubeconfig-contents }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Fetch secrets from secret manager instance"
id: vars
uses: ./docker/actions/azure/tanzu-cli-setup-action
with:
csp-api-token: ${{ secrets.CSP_API_TOKEN }}
azure-ad-client-id: ${{ secrets.AZURE_AD_CLIENT_ID }}
azure-ad-client-secret: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-ad-tenant-id: ${{ secrets.AZURE_AD_TENANT_ID }}
command: |
ACR_ADMIN_USERNAME=$(az keyvault secret show --name acr-admin-username --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "harbor-admin-username=$ACR_ADMIN_USERNAME" >> $GITHUB_OUTPUT \
&& ACR_ADMIN_PASSWORD=$(az keyvault secret show --name acr-admin-password --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "acr-admin-password=$ACR_ADMIN_PASSWORD" >> $GITHUB_OUTPUT \
&& ACR_URL=$(az keyvault secret show --name acr-url --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "acr-url=$ACR_URL" >> $GITHUB_OUTPUT \
&& HARBOR_ADMIN_USERNAME=$(az keyvault secret show --name harbor-admin-username --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "harbor-admin-username=$HARBOR_ADMIN_USERNAME" >> $GITHUB_OUTPUT \
&& HARBOR_ADMIN_PASSWORD=$(az keyvault secret show --name harbor-admin-password --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "harbor-admin-password=$HARBOR_ADMIN_PASSWORD" >> $GITHUB_OUTPUT \
&& HARBOR_DOMAIN=$(az keyvault secret show --name harbor-domain --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "harbor-domain=$HARBOR_DOMAIN" >> $GITHUB_OUTPUT \
&& HARBOR_KCONFIG=$(az keyvault secret show --name b64-harbor-cluster-kubeconfig --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "b64-harbor-cluster-kubeconfig-contents=$HARBOR_KCONFIG" >> $GITHUB_OUTPUT \
&& TAP_BUILD_KCONFIG=$(az keyvault secret show --name b64-tap-build-cluster-kubeconfig --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "b64-tap-build-cluster-kubeconfig-contents=$TAP_BUILD_KCONFIG" >> $GITHUB_OUTPUT \
&& TAP_ITERATE_KCONFIG=$(az keyvault secret show --name b64-tap-iterate-cluster-kubeconfig --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "b64-tap-iterate-cluster-kubeconfig-contents=$TAP_ITERATE_KCONFIG" >> $GITHUB_OUTPUT \
&& TAP_VIEW_KCONFIG=$(az keyvault secret show --name b64-tap-view-cluster-kubeconfig --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "b64-tap-view-cluster-kubeconfig-contents=$TAP_VIEW_KCONFIG" >> $GITHUB_OUTPUT \
&& TAP_RUN_KCONFIG=$(az keyvault secret show --name b64-tap-run-cluster-kubeconfig --vault-name ${{ github.event.inputs.secrets-manager-instance-name }} | jq -r .value) \
&& echo "b64-tap-run-cluster-kubeconfig-contents=$TAP_RUN_KCONFIG" >> $GITHUB_OUTPUT
obtain-registry-creds:
needs: obtain-secrets-from-secrets-manager
runs-on: ubuntu-22.04
outputs:
container-image-registry-username: ${{ steps.vars.outputs.container-image-registry-username }}
container-image-registry-password: ${{ steps.vars.outputs.container-image-registry-password }}
container-image-registry-url: ${{ steps.vars.outputs.container-image-registry-url }}
ootb-supply-chain-repo: ${{ steps.vars.outputs.ootb-supply-chain-repo }}
build-service-repo: ${{ steps.vars.outputs.build-service-repo }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Fetch secrets from secret manager instance"
id: vars
env:
CONTAINER_IMAGE_REGISTRY_PROVIDER: ${{ needs.obtain-secrets-from-secrets-manager.outputs.container-image-registry-provider }}
run: |
if [ "acr" == "$CONTAINER_IMAGE_REGISTRY_PROVIDER" ]; then
echo "container-image-registry-username=${{ needs.obtain-secrets-from-secrets-manager.outputs.acr-admin-username }}" >> $GITHUB_OUTPUT
echo "container-image-registry-password=${{ needs.obtain-secrets-from-secrets-manager.outputs.acr-admin-password }}" >> $GITHUB_OUTPUT
echo "container-image-registry-url=${{ needs.obtain-secrets-from-secrets-manager.outputs.acr-url }}" >> $GITHUB_OUTPUT
echo "build-service-repo=build-service" >> $GITHUB_OUTPUT
echo "ootb-supply-chain-repo=supply-chain" >> $GITHUB_OUTPUT
fi
if [ "harbor" == "$CONTAINER_IMAGE_REGISTRY_PROVIDER" ]; then
echo "container-image-registry-username=${{ needs.obtain-secrets-from-secrets-manager.outputs.harbor-admin-username }}" >> $GITHUB_OUTPUT
echo "container-image-registry-password=${{ needs.obtain-secrets-from-secrets-manager.outputs.harbor-admin-password }}" >> $GITHUB_OUTPUT
echo "container-image-registry-url=${{ needs.obtain-secrets-from-secrets-manager.outputs.harbor-domain }}" >> $GITHUB_OUTPUT
echo "build-service-repo=tanzu/build-service" >> $GITHUB_OUTPUT
echo "ootb-supply-chain-repo=tanzu/supply-chain" >> $GITHUB_OUTPUT
fi
assemble-domain-names:
runs-on: ubuntu-22.04
outputs:
iterate-domain: ${{ steps.vars.outputs.iterate_domain }}
view-domain: ${{ steps.vars.outputs.view_domain }}
run-domain: ${{ steps.vars.outputs.run_domain }}
steps:
- uses: jungwinter/split@v2
id: split
with:
msg: '${{ github.event.inputs.subdomains }}'
separator: ','
- name: Assemble fully-qualified domain names
id: vars
run: |
echo "iterate_domain=${{ steps.split.outputs._0 }}.${{ github.event.inputs.domain }}" >> $GITHUB_OUTPUT
echo "view_domain=${{ steps.split.outputs._1 }}.${{ github.event.inputs.domain }}" >> $GITHUB_OUTPUT
echo "run_domain=${{ steps.split.outputs._2 }}.${{ github.event.inputs.domain }}" >> $GITHUB_OUTPUT
determine-target-repo:
runs-on: ubuntu-22.04
env:
CONTAINER_IMAGE_REGISTRY_PROVIDER: "${{ github.event.inputs.container-image-registry-provider }}"
outputs:
result: ${{ steps.vars.outputs.target_repo }}
steps:
- id: vars
run: |
case $CONTAINER_IMAGE_REGISTRY_PROVIDER in
azure-container-registry)
echo "target_repo=tanzu-application-platform" >> $GITHUB_OUTPUT
;;
harbor-on-azure)
echo "target_repo=tanzu" >> $GITHUB_OUTPUT
;;
esac
install-tap-build-on-azure:
needs: [ obtain-secrets-from-secrets-manager,obtain-registry-creds,prepare-metadata-store-secrets,determine-target-repo ]
uses: ./.github/workflows/install-tanzu-application-platform.yml
with:
domain: ${{ github.event.inputs.domain }}
dev-namespace: ${{ github.event.inputs.dev-namespace }}
backstage-catalog: ${{ github.event.inputs.backstage-catalog }}
container-image-registry-url: ${{ needs.obtain-registry-creds.outputs.container-image-registry-url }}
container-image-registry-username: ${{ needs.obtain-registry-creds.outputs.container-image-registry-username }}
container-image-registry-password: ${{ needs.obtain-registry-creds.outputs.container-image-registry-password }}
ootb-supply-chain-repo: ${{ needs.obtain-registry-creds.outputs.ootb-supply-chain-repo }}
build-service-repo: ${{ needs.obtain-registry-creds.outputs.build-service-repo }}
email-address: ${{ github.event.inputs.email-address }}
cluster-provider: ${{ github.event.inputs.cluster-provider }}
deployment-name: "tap"
active-profile: "build"
target-repo: ${{ needs.determine-target-repo.outputs.result }}
secrets:
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
KUBECONFIG_CONTENTS: ${{ needs.obtain-secrets-from-secrets-manager.outputs.b64-tap-build-cluster-kubeconfig-contents }}
OIDC_AUTH_PROVIDER: ${{ secrets.OIDC_AUTH_PROVIDER }}
OIDC_AUTH_CLIENT_ID: ${{ secrets.OIDC_AUTH_CLIENT_ID }}
OIDC_AUTH_CLIENT_SECRET: ${{ secrets.OIDC_AUTH_CLIENT_SECRET }}
PA_TOKEN: ${{ secrets.PA_TOKEN }}
TANZU_NETWORK_USERNAME: ${{ secrets.TANZU_NETWORK_USERNAME }}
TANZU_NETWORK_PASSWORD: ${{ secrets.TANZU_NETWORK_PASSWORD }}
install-tap-iterate-on-azure:
needs: [ obtain-secrets-from-secrets-manager,obtain-registry-creds,assemble-domain-names,determine-target-repo ]
uses: ./.github/workflows/install-tanzu-application-platform.yml
with:
domain: ${{ needs.assemble-domain-names.outputs.iterate-domain }}
dev-namespace: ${{ github.event.inputs.dev-namespace }}
backstage-catalog: ${{ github.event.inputs.backstage-catalog }}
container-image-registry-url: ${{ needs.obtain-registry-creds.outputs.container-image-registry-url }}
container-image-registry-username: ${{ needs.obtain-registry-creds.outputs.container-image-registry-username }}
container-image-registry-password: ${{ needs.obtain-registry-creds.outputs.container-image-registry-password }}
ootb-supply-chain-repo: ${{ needs.obtain-registry-creds.outputs.ootb-supply-chain-repo }}
build-service-repo: ${{ needs.obtain-registry-creds.outputs.build-service-repo }}
email-address: ${{ github.event.inputs.email-address }}
cluster-provider: ${{ github.event.inputs.cluster-provider }}
deployment-name: "tap"
active-profile: "iterate"
target-repo: ${{ needs.determine-target-repo.outputs.result }}
secrets:
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
KUBECONFIG_CONTENTS: ${{ needs.obtain-secrets-from-secrets-manager.outputs.b64-tap-iterate-cluster-kubeconfig-contents }}
OIDC_AUTH_PROVIDER: ${{ secrets.OIDC_AUTH_PROVIDER }}
OIDC_AUTH_CLIENT_ID: ${{ secrets.OIDC_AUTH_CLIENT_ID }}
OIDC_AUTH_CLIENT_SECRET: ${{ secrets.OIDC_AUTH_CLIENT_SECRET }}
PA_TOKEN: ${{ secrets.PA_TOKEN }}
TANZU_NETWORK_USERNAME: ${{ secrets.TANZU_NETWORK_USERNAME }}
TANZU_NETWORK_PASSWORD: ${{ secrets.TANZU_NETWORK_PASSWORD }}
install-tap-view-on-azure:
needs: [ obtain-secrets-from-secrets-manager,obtain-registry-creds,assemble-domain-names,determine-target-repo ]
uses: ./.github/workflows/install-tanzu-application-platform.yml
with:
domain: ${{ needs.assemble-domain-names.outputs.view-domain }}
dev-namespace: ${{ github.event.inputs.dev-namespace }}
backstage-catalog: ${{ github.event.inputs.backstage-catalog }}
container-image-registry-url: ${{ needs.obtain-registry-creds.outputs.container-image-registry-url }}
container-image-registry-username: ${{ needs.obtain-registry-creds.outputs.container-image-registry-username }}
container-image-registry-password: ${{ needs.obtain-registry-creds.outputs.container-image-registry-password }}
ootb-supply-chain-repo: ${{ needs.obtain-registry-creds.outputs.ootb-supply-chain-repo }}
build-service-repo: ${{ needs.obtain-registry-creds.outputs.build-service-repo }}
email-address: ${{ github.event.inputs.email-address }}
cluster-provider: ${{ github.event.inputs.cluster-provider }}
deployment-name: "tap"
active-profile: "view"
target-repo: ${{ needs.determine-target-repo.outputs.result }}
secrets:
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
KUBECONFIG_CONTENTS: ${{ needs.obtain-secrets-from-secrets-manager.outputs.b64-tap-view-cluster-kubeconfig-contents }}
OIDC_AUTH_PROVIDER: ${{ secrets.OIDC_AUTH_PROVIDER }}
OIDC_AUTH_CLIENT_ID: ${{ secrets.OIDC_AUTH_CLIENT_ID }}
OIDC_AUTH_CLIENT_SECRET: ${{ secrets.OIDC_AUTH_CLIENT_SECRET }}
PA_TOKEN: ${{ secrets.PA_TOKEN }}
TANZU_NETWORK_USERNAME: ${{ secrets.TANZU_NETWORK_USERNAME }}
TANZU_NETWORK_PASSWORD: ${{ secrets.TANZU_NETWORK_PASSWORD }}
prepare-metadata-store-secrets:
needs: [obtain-secrets-from-secrets-manager,install-tap-view-on-azure]
uses: ./.github/workflows/prepare-metadata-store-secrets.yml
with:
cluster-provider: ${{ github.event.inputs.cluster-provider }}
secrets:
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
TAP_BUILD_KUBECONFIG_CONTENTS: ${{ needs.obtain-secrets-from-secrets-manager.outputs.b64-tap-build-cluster-kubeconfig-contents }}
TAP_VIEW_KUBECONFIG_CONTENTS: ${{ needs.obtain-secrets-from-secrets-manager.outputs.b64-tap-view-cluster-kubeconfig-contents }}
install-tap-run-on-azure:
needs: [ obtain-secrets-from-secrets-manager,obtain-registry-creds,assemble-domain-names,determine-target-repo ]
uses: ./.github/workflows/install-tanzu-application-platform.yml
with:
domain: ${{ needs.assemble-domain-names.outputs.run-domain }}
dev-namespace: ${{ github.event.inputs.dev-namespace }}
backstage-catalog: ${{ github.event.inputs.backstage-catalog }}
container-image-registry-url: ${{ needs.obtain-registry-creds.outputs.container-image-registry-url }}
container-image-registry-username: ${{ needs.obtain-registry-creds.outputs.container-image-registry-username }}
container-image-registry-password: ${{ needs.obtain-registry-creds.outputs.container-image-registry-password }}
ootb-supply-chain-repo: ${{ needs.obtain-registry-creds.outputs.ootb-supply-chain-repo }}
build-service-repo: ${{ needs.obtain-registry-creds.outputs.build-service-repo }}
email-address: ${{ github.event.inputs.email-address }}
cluster-provider: ${{ github.event.inputs.cluster-provider }}
deployment-name: "tap"
active-profile: "run"
target-repo: ${{ needs.determine-target-repo.outputs.result }}
secrets:
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
KUBECONFIG_CONTENTS: ${{ needs.obtain-secrets-from-secrets-manager.outputs.b64-tap-run-cluster-kubeconfig-contents }}
OIDC_AUTH_PROVIDER: ${{ secrets.OIDC_AUTH_PROVIDER }}
OIDC_AUTH_CLIENT_ID: ${{ secrets.OIDC_AUTH_CLIENT_ID }}
OIDC_AUTH_CLIENT_SECRET: ${{ secrets.OIDC_AUTH_CLIENT_SECRET }}
PA_TOKEN: ${{ secrets.PA_TOKEN }}
TANZU_NETWORK_USERNAME: ${{ secrets.TANZU_NETWORK_USERNAME }}
TANZU_NETWORK_PASSWORD: ${{ secrets.TANZU_NETWORK_PASSWORD }}