-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdeployment.py
64 lines (54 loc) · 2.17 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import naming
def GenerateConfig(context):
config = {}
config['resources'] = []
config['outputs'] = []
runtimeconfigName = naming.RuntimeConfigName(context)
runtimeconfig = {
'name': runtimeconfigName,
'type': 'runtimeconfig.v1beta1.config',
'properties': {
'config': runtimeconfigName
}
}
config['resources'].append(runtimeconfig)
for cluster in context.properties['clusters']:
clusterName = cluster['cluster']
clusterResourceName = naming.ClusterName(context, clusterName)
clusterJSON = {
'name': clusterResourceName,
'type': 'cluster.py',
'properties': {
'runtimeconfigName': runtimeconfigName,
'serverVersion': context.properties['serverVersion'],
'syncGatewayVersion': context.properties['syncGatewayVersion'],
'couchbaseUsername': context.properties['couchbaseUsername'],
'couchbasePassword': context.properties['couchbasePassword'],
'license': context.properties['license'],
'cluster': cluster['cluster'],
'region': cluster['region'],
'groups': cluster['groups'],
}
}
config['resources'].append(clusterJSON)
for group in cluster['groups']:
groupName = group['group']
outputName = naming.ExternalIpOutputName(clusterName, groupName)
readActionName = naming.ExternalIpVariableReadActionName(context, clusterName, groupName)
config['outputs'].append({
'name': outputName,
'value': '$(ref.%s.text)' % readActionName
})
firewall = {
'name': naming.FirewallName(context),
'type': 'compute.v1.firewall',
'properties': {
'sourceRanges': ['0.0.0.0/0'],
'allowed': [{
'IPProtocol': 'tcp',
'ports': ['8091', '8092', '8093', '8094', '8095', '8096', '18091', '18092', '18093', '18094', '18095', '18096', '4984', '4985', '11210', '9130']
}]
}
}
config['resources'].append(firewall)
return config