-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathporter.yaml
207 lines (197 loc) · 6.5 KB
/
porter.yaml
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
name: hello-keyvault
version: 0.1.2
description: "An example Porter configuration"
registry: ghcr.io/asalbers
dockerfile: Dockerfile.tmpl
mixins:
- exec
- az
install:
- az: # logging in
description: "Logging into Azure..."
arguments:
- login
suppress-output: true
flags:
debug: ""
service-principal:
username: "'{{bundle.credentials.AZURE_CLIENT_ID}}'"
password: "'{{bundle.credentials.AZURE_SP_PASSWORD}}'"
tenant: "'{{bundle.credentials.AZURE_TENANT_ID_OR_DNS}}'"
- az: # setting the subscription
description: "Setting the Azure subscription...."
suppress-output: true
arguments:
- "account"
- "set"
flags:
subscription: "{{ bundle.credentials.AZURE_SUBSCRIPTION_ID}}"
- exec:
command: bash
description: "Creating or using the Azure resource group...."
arguments:
- ./upsertGroup.sh
- "{{bundle.parameters.AZURE_RESOURCE_GROUP_NAME}}"
- "{{bundle.parameters.AZURE_GROUP_REGION}}"
- exec:
command: bash
description: "Setting random string...."
arguments:
- ./helpers.sh
- random_string
outputs:
- name: random_string
regex: "(.*)"
- az:
description: "Creating the KeyVault..."
suppress-output: true
arguments:
- keyvault
- create
flags:
location: "eastus2"
name: "test-vault-{{bundle.outputs.random_string}}"
resource-group: "{{bundle.parameters.AZURE_RESOURCE_GROUP_NAME}}"
enable-rbac-authorization: "true"
outputs:
- name: "keyvault_name"
jsonPath: "$.name"
upgrade:
- exec:
description: "World 2.0"
command: ./helpers.sh
arguments:
- upgrade
uninstall:
- az: # logging in
description: "Logging into Azure..."
arguments:
- login
suppress-output: true
flags:
debug: ""
service-principal:
username: "'{{bundle.credentials.AZURE_CLIENT_ID}}'"
password: "'{{bundle.credentials.AZURE_SP_PASSWORD}}'"
tenant: "'{{bundle.credentials.AZURE_TENANT_ID_OR_DNS}}'"
- az: # setting the subscription
description: "Setting the Azure subscription...."
suppress-output: true
arguments:
- "account"
- "set"
flags:
subscription: "{{ bundle.credentials.AZURE_SUBSCRIPTION_ID}}"
- az:
description: "Deleting the KeyVault..."
suppress-output: true
arguments:
- keyvault
- delete
flags:
name: "vat-vault-{{bundle.parameters.random_string}}"
resource-group: "{{bundle.parameters.AZURE_RESOURCE_GROUP_NAME}}"
# Below is an example of how to define credentials
# See https://porter.sh/author-bundles/#credentials
credentials:
- name: AZURE_CLIENT_ID
description: "The client id for the service principal used to automate the bundle's actions."
env: AZURE_CLIENT_ID
- name: AZURE_TENANT_ID_OR_DNS
description: "The tenant identity in which the service principal resides."
env: AZURE_TENANT_ID_OR_DNS
- name: AZURE_SP_PASSWORD
description: "The service principal password that is used to log into Azure inside the bundle."
env: AZURE_SP_PASSWORD
- name: AZURE_SUBSCRIPTION_ID
description: "The Azure subscription into which to deploy."
env: AZURE_SUB_ID
# Below is an example of how to define parameters
# See https://porter.sh/author-bundles/#parameters
parameters:
- name: AZURE_RESOURCE_GROUP_NAME
description: "The azure resource group to use or create for the cluster resources."
type: string
default: hellokeyvault
- name: AZURE_GROUP_REGION
description: "The azure resource group to use or create for the cluster resources."
type: string
default: eastus2
- name: random_string
description: "The random string used to create resources. This is automatically generated and reused, but can be overridden."
type: string
applyTo:
- "upgrade"
- "uninstall"
source:
output: random_string
- name: keyvault_name
description: "The name of the created KeyVault."
type: string
source:
output: keyvault_name
applyTo:
- "upgrade"
- "uninstall"
- name: AZURE_GROUP_REGION
description: "The azure resource group to use or create for the cluster resources."
type: string
default: eastus2
outputs:
- name: random_string
description: "The random string to use in generating Azure resources."
type: string
applyTo:
- "install"
- name: keyvault_name
description: "The keyvault name that is created."
type: string
applyTo:
- "install"
# The following values are consumed by the Azure Portal and turned into visual blades and UI elements.
custom:
com.azure.creatuidef:
blades:
Credentials:
displayOrder: 1
label: Azure Credentials
Parameters:
displayOrder: 2
label: App Parameters
elements:
- name: AZURE_GROUP_REGION
tooltip: "A region for the environment to be created."
displayName: "Azure region name"
displayOrder: 1
uitype: Microsoft.Common.TextBox
bladename: Parameters
- name: AZURE_CLIENT_ID
description: "The client id for the service principal used to automate the bundle's actions."
tooltip: A client id with permission to create resources in a tenant.
displayName: Client ID
displayOrder: 1
uitype: Microsoft.Common.PasswordTextBox
bladename: Credentials
- name: deploymentTime
hide: true
- name: AZURE_SP_PASSWORD
description: "The service principal password that is used to log into Azure inside the bundle."
displayOrder: 2
tooltip: An Azure SP password or secret for the client ID
displayName: Client secret
bladename: Credentials
uitype: Microsoft.Common.PasswordTextBox
- name: AZURE_TENANT_ID_OR_DNS
description: "The tenant identity in which the service principal resides."
displayOrder: 3
tooltip: An Azure tenant id for operational control.
displayName: Tenant ID
bladename: Credentials
uitype: Microsoft.Common.PasswordTextBox
- name: AZURE_SUBSCRIPTION_ID
description: "The Azure subscription into which to deploy."
tooltip: "A subscription for the environment to be created."
displayName: "Subscription id"
displayOrder: 4
uitype: Microsoft.Common.TextBox
bladename: Credentials