2019-07-29 17:14:13 -07:00
|
|
|
def GenerateConfig(context):
|
|
|
|
|
|
|
|
|
|
resources = [{
|
2020-06-03 16:11:00 -07:00
|
|
|
'name': context.properties['infra_id'] + '-master-0',
|
2019-07-29 17:14:13 -07:00
|
|
|
'type': 'compute.v1.instance',
|
|
|
|
|
'properties': {
|
|
|
|
|
'disks': [{
|
|
|
|
|
'autoDelete': True,
|
|
|
|
|
'boot': True,
|
|
|
|
|
'initializeParams': {
|
|
|
|
|
'diskSizeGb': context.properties['root_volume_size'],
|
2019-10-02 11:27:03 -07:00
|
|
|
'diskType': 'zones/' + context.properties['zones'][0] + '/diskTypes/pd-ssd',
|
2019-07-29 17:14:13 -07:00
|
|
|
'sourceImage': context.properties['image']
|
|
|
|
|
}
|
|
|
|
|
}],
|
2019-09-23 21:14:42 -07:00
|
|
|
'machineType': 'zones/' + context.properties['zones'][0] + '/machineTypes/' + context.properties['machine_type'],
|
2019-07-29 17:14:13 -07:00
|
|
|
'metadata': {
|
|
|
|
|
'items': [{
|
|
|
|
|
'key': 'user-data',
|
|
|
|
|
'value': context.properties['ignition']
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
'networkInterfaces': [{
|
|
|
|
|
'subnetwork': context.properties['control_subnet']
|
|
|
|
|
}],
|
|
|
|
|
'serviceAccounts': [{
|
|
|
|
|
'email': context.properties['service_account_email'],
|
|
|
|
|
'scopes': ['https://www.googleapis.com/auth/cloud-platform']
|
|
|
|
|
}],
|
|
|
|
|
'tags': {
|
|
|
|
|
'items': [
|
|
|
|
|
context.properties['infra_id'] + '-master',
|
|
|
|
|
]
|
|
|
|
|
},
|
2019-09-23 21:14:42 -07:00
|
|
|
'zone': context.properties['zones'][0]
|
2019-07-29 17:14:13 -07:00
|
|
|
}
|
|
|
|
|
}, {
|
2020-06-03 16:11:00 -07:00
|
|
|
'name': context.properties['infra_id'] + '-master-1',
|
2019-07-29 17:14:13 -07:00
|
|
|
'type': 'compute.v1.instance',
|
|
|
|
|
'properties': {
|
|
|
|
|
'disks': [{
|
|
|
|
|
'autoDelete': True,
|
|
|
|
|
'boot': True,
|
|
|
|
|
'initializeParams': {
|
|
|
|
|
'diskSizeGb': context.properties['root_volume_size'],
|
2019-10-02 11:27:03 -07:00
|
|
|
'diskType': 'zones/' + context.properties['zones'][1] + '/diskTypes/pd-ssd',
|
2019-07-29 17:14:13 -07:00
|
|
|
'sourceImage': context.properties['image']
|
|
|
|
|
}
|
|
|
|
|
}],
|
2019-09-23 21:14:42 -07:00
|
|
|
'machineType': 'zones/' + context.properties['zones'][1] + '/machineTypes/' + context.properties['machine_type'],
|
2019-07-29 17:14:13 -07:00
|
|
|
'metadata': {
|
|
|
|
|
'items': [{
|
|
|
|
|
'key': 'user-data',
|
|
|
|
|
'value': context.properties['ignition']
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
'networkInterfaces': [{
|
|
|
|
|
'subnetwork': context.properties['control_subnet']
|
|
|
|
|
}],
|
|
|
|
|
'serviceAccounts': [{
|
|
|
|
|
'email': context.properties['service_account_email'],
|
|
|
|
|
'scopes': ['https://www.googleapis.com/auth/cloud-platform']
|
|
|
|
|
}],
|
|
|
|
|
'tags': {
|
|
|
|
|
'items': [
|
|
|
|
|
context.properties['infra_id'] + '-master',
|
|
|
|
|
]
|
|
|
|
|
},
|
2019-09-23 21:14:42 -07:00
|
|
|
'zone': context.properties['zones'][1]
|
2019-07-29 17:14:13 -07:00
|
|
|
}
|
|
|
|
|
}, {
|
2020-06-03 16:11:00 -07:00
|
|
|
'name': context.properties['infra_id'] + '-master-2',
|
2019-07-29 17:14:13 -07:00
|
|
|
'type': 'compute.v1.instance',
|
|
|
|
|
'properties': {
|
|
|
|
|
'disks': [{
|
|
|
|
|
'autoDelete': True,
|
|
|
|
|
'boot': True,
|
|
|
|
|
'initializeParams': {
|
|
|
|
|
'diskSizeGb': context.properties['root_volume_size'],
|
2019-10-02 11:27:03 -07:00
|
|
|
'diskType': 'zones/' + context.properties['zones'][2] + '/diskTypes/pd-ssd',
|
2019-07-29 17:14:13 -07:00
|
|
|
'sourceImage': context.properties['image']
|
|
|
|
|
}
|
|
|
|
|
}],
|
2019-09-23 21:14:42 -07:00
|
|
|
'machineType': 'zones/' + context.properties['zones'][2] + '/machineTypes/' + context.properties['machine_type'],
|
2019-07-29 17:14:13 -07:00
|
|
|
'metadata': {
|
|
|
|
|
'items': [{
|
|
|
|
|
'key': 'user-data',
|
|
|
|
|
'value': context.properties['ignition']
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
'networkInterfaces': [{
|
|
|
|
|
'subnetwork': context.properties['control_subnet']
|
|
|
|
|
}],
|
|
|
|
|
'serviceAccounts': [{
|
|
|
|
|
'email': context.properties['service_account_email'],
|
|
|
|
|
'scopes': ['https://www.googleapis.com/auth/cloud-platform']
|
|
|
|
|
}],
|
|
|
|
|
'tags': {
|
|
|
|
|
'items': [
|
|
|
|
|
context.properties['infra_id'] + '-master',
|
|
|
|
|
]
|
|
|
|
|
},
|
2019-09-23 21:14:42 -07:00
|
|
|
'zone': context.properties['zones'][2]
|
2019-07-29 17:14:13 -07:00
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
return {'resources': resources}
|