-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmulti.json
107 lines (97 loc) · 4.46 KB
/
multi.json
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
{{/*
Infrakit Groups Config
This is a template JSON for managing two groups of instances - managers and workers - on AWS.
To keep things simple, we use the metadata api on AWS to determine subnets and vpc ids.
This is to support the use case where infrakit is running *inside* the cloud environment where
the instances it manages reside.
*/}}
{{ source "common.ikt" }} {{/* a common template included here to define global variables */}}
{{/* Local variables */}}
{{ $swarmLeaderIP := var `/cluster/swarm/join/ip` }}
{{ $managerIPs := var `/cluster/swarm/manager/ips` }}
{{ $workerSize := sub (var `/cluster/size`) (len $managerIPs) }}
{{ $dockerEngine := `unix:///var/run/docker.sock` }} {{/* for this flavor to connect to */}}
{{ $managerInit := cat (var `/infrakit/config/root`) `/manager-init.sh` | nospace }}
{{ $workerInit := cat (var `/infrakit/config/root`) `/worker-init.sh` | nospace }}
{{ $myGroups := include (cat (var `/cluster/provider`) `/groups.json` | nospace) | jsonDecode }}
[
{
"Plugin": "group",
"Properties": {
"ID": "managers",
"Properties": {
"Allocation": {
"LogicalIDs": {{ $managerIPs | jsonEncode }}
},
"Flavor": {
"Plugin": "swarm/manager",
"Properties": {
"Attachments" : {
"{{index $managerIPs 0}}" : [
{ "ID":"{{index $managerIPs 0}}", "Type":"ebs" }
],
"{{index $managerIPs 1}}" : [
{ "ID":"{{index $managerIPs 1}}", "Type":"ebs" }
],
"{{index $managerIPs 2}}" : [
{ "ID":"{{index $managerIPs 2}}", "Type":"ebs" }
]
},
"InitScriptTemplateURL": "{{ $managerInit }}",
"SwarmJoinIP": "{{ $swarmLeaderIP }}",
"Docker" : {
"Host" : "{{ $dockerEngine }}"
}
}
},
"Instance": {{ $myGroups.Managers | jsonEncode }}
}
}
}
,
{
"Plugin": "group",
"Properties": {
"ID": "workers",
"Properties": {
"Allocation": {
"Size": {{ $workerSize }}
},
"Flavor": {
"Plugin": "swarm/worker",
"Properties": {
"InitScriptTemplateURL": "{{ $workerInit }}",
"SwarmJoinIP": "{{ $swarmLeaderIP }}",
"Docker" : {
"Host" : "{{ $dockerEngine }}"
}
}
},
"Instance": {
"Plugin": "selector/tiered",
"Properties": {
"aws/ec2-instance": {
"region": "eu-central-1a",
"type": "t2.micro"
},
"gcp/compute": {
"MachineType": "n1-standard-1",
"Disks":[{
"Boot": true,
"SizeGb": 60,
"Image": "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1404-trusty-v20161205",
"Type": "pd-standard",
"AutoDelete": false,
"ReuseExisting": true
}],
"Scopes": [
"https://www.googleapis.com/auth/cloudruntimeconfig",
"https://www.googleapis.com/auth/logging.write"
]
}
}
}
}
}
}
]