generated from lisa1976/google-deployment-manager-couchbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployment.py
42 lines (38 loc) · 1.33 KB
/
deployment.py
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
def GenerateConfig(context):
config={}
config['resources'] = []
for cluster in context.properties['clusters']:
clusterJSON = {
'name': context.env['deployment'] + '-' + cluster['cluster'],
'type': 'cluster.py',
'properties': {
'couchbaseUsername': context.properties['couchbaseUsername'],
'couchbasePassword': context.properties['couchbasePassword'],
'cluster': cluster['cluster'],
'region': cluster['region'],
'groups': cluster['groups'],
}
}
config['resources'].append(clusterJSON)
serviceAccount = {
'name': context.env['deployment'] + '-sa',
'type': 'iam.v1.serviceAccount',
'properties': {
'accountId': context.env['deployment'] + '-sa',
'displayName': context.env['deployment'] + '-sa'
}
}
config['resources'].append(serviceAccount)
firewall = {
'name': context.env['deployment'] + '-firewall',
'type': 'compute.v1.firewall',
'properties': {
'sourceRanges': ['0.0.0.0/0'],
'allowed': [{
'IPProtocol': 'tcp',
'ports': ['8091', '4984', '4985']
}]
}
}
config['resources'].append(firewall)
return config