@@ -10,23 +10,19 @@ An InfraKit instance plugin which creates Google Compute Engine instances.
10
10
11
11
### Building
12
12
13
- To build the instance plugin, run ` make binaries ` . The plugin binary will be located at
14
- ` ./ build/infrakit-instance-gcp ` .
13
+ To build the instance plugin, run ` make binaries ` . The plugin will then show up as part of the main infrakit CLI
14
+ ` build/infrakit plugin start google ` .
15
15
16
16
### Running
17
17
18
18
``` bash
19
- ${PATH_TO_INFRAKIT} /infrakit-flavor-vanilla
20
- ${PATH_TO_INFRAKIT} /infrakit-group-default
21
- ./build/infrakit-instance-gcp --project=[GCP_PROJECT] --zone=[GCP_ZONE]
22
-
23
- ${PATH_TO_INFRAKIT} /infrakit group commit gcp-example-1.json
19
+ INFRAKIT_GOOGLE_PROJECT=my-project INFRAKIT_GOOGLE_ZONE=us-west1 build/infrakit plugin start google
24
20
```
25
21
26
22
#### Project and zone selection
27
23
28
- Google Cloud project and zone can be passed on the command line with ` --project `
29
- and ` --zone ` . In case a value is not provided, the plugin will fallback to:
24
+ Google Cloud project and zone can be passed on the command line with ` INFRAKIT_GOOGLE_PROJECT `
25
+ and ` INFRAKIT_GOOGLE_ZONE ` env variables . In case a value is not provided, the plugin will fallback to:
30
26
+ Querying the [ Metadata server] [ metadata ] when running on GCE
31
27
+ ` CLOUDSDK_CORE_PROJECT ` and ` CLOUDSDK_CORE_ZONE ` environment variables
32
28
45
41
46
42
### Example configuration
47
43
48
- ``` json
44
+ To continue with an example, we will use the [ default] ( https://github.com/docker/infrakit/tree/master/cmd/group ) Group
45
+ plugin:
46
+
47
+ ``` bash
48
+ $ build/infrakit plugin start group
49
+ INFO[11-06| 16:58:10] config module=cli/plugin url= fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
50
+ INFO[11-06| 16:58:10] Launching module=cli/plugin kind=group name=group-stateless fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
51
+ INFO[11-06| 16:58:10] Starting plugin module=core/launch executor=inproc key=group name=group-stateless exec=inproc fn=github.com/docker/infrakit/pkg/launch.(* Monitor).Start.func1
52
+ INFO[11-06| 16:58:10] Object is an event producer module=rpc/server object=& {keyed:0xc4201862f8} discover=/Users/infrakit/.infrakit/plugins/group-stateless fn=github.com/docker/infrakit/pkg/rpc/server.startAtPath
53
+ INFO[11-06| 16:58:10] Listening module=rpc/server discover=/Users/infrakit/.infrakit/plugins/group-stateless fn=github.com/docker/infrakit/pkg/rpc/server.startAtPath
54
+ INFO[11-06| 16:58:10] Waiting for startup module=core/launch key=group name=group-stateless config=" {\n\" Kind\" : \" group\" ,\n\" Options\" : {\n\" PollInterval\" : \" 10s\" ,\n\" MaxParallelNum\" : 0,\n\" PollIntervalGroupSpec\" : \" 10s\" ,\n\" PollIntervalGroupDetail\" : \" 10s\" \n}\n}" as=group-stateless fn=github.com/docker/infrakit/pkg/launch.(* Monitor).Start.func1
55
+ INFO[11-06| 16:58:10] Done waiting on plugin starts module=cli/plugin fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
56
+ INFO[11-06| 16:58:10] PID file created module=run path=/Users/infrakit/.infrakit/plugins/group-stateless.pid fn=github.com/docker/infrakit/pkg/run.run.func1
57
+ INFO[11-06| 16:58:10] Server started module=run discovery=/Users/infrakit/.infrakit/plugins/group-stateless fn=github.com/docker/infrakit/pkg/run.run.func1
58
+ ```
59
+
60
+ and the [ Vanilla] ( https://github.com/docker/infrakit/tree/master/pkg/example/flavor/vanilla ) Flavor plugin:
61
+
62
+ ``` bash
63
+ $ build/infrakit plugin start vanilla
64
+ INFO[11-06| 16:59:01] config module=cli/plugin url= fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
65
+ INFO[11-06| 16:59:01] Launching module=cli/plugin kind=vanilla name=vanilla fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
66
+ INFO[11-06| 16:59:01] Starting plugin module=core/launch executor=inproc key=vanilla name=vanilla exec=inproc fn=github.com/docker/infrakit/pkg/launch.(* Monitor).Start.func1
67
+ INFO[11-06| 16:59:01] Listening module=rpc/server discover=/Users/infrakit/.infrakit/plugins/vanilla fn=github.com/docker/infrakit/pkg/rpc/server.startAtPath
68
+ INFO[11-06| 16:59:01] Waiting for startup module=core/launch key=vanilla name=vanilla config=" {\n\" Kind\" : \" vanilla\" ,\n\" Options\" : {\n\" DelimLeft\" : \"\" ,\n\" DelimRight\" : \"\" ,\n\" MultiPass\" : true,\n\" CacheDir\" : \"\" \n}\n}" as=vanilla fn=github.com/docker/infrakit/pkg/launch.(* Monitor).Start.func1
69
+ INFO[11-06| 16:59:01] Done waiting on plugin starts module=cli/plugin fn=github.com/docker/infrakit/cmd/infrakit/plugin.Command.func2
70
+ INFO[11-06| 16:59:01] PID file created module=run path=/Users/infrakit/.infrakit/plugins/vanilla.pid fn=github.com/docker/infrakit/pkg/run.run.func1
71
+ INFO[11-06| 16:59:01] Server started module=run discovery=/Users/infrakit/.infrakit/plugins/vanilla fn=github.com/docker/infrakit/pkg/run.run.func1
72
+ ```
73
+
74
+ We will use a basic configuration that creates a single instance:
75
+
76
+ ``` bash
77
+ $ cat << EOF > gcp-vanilla.json
49
78
{
50
- "ID" : " gcp-example-1 " ,
79
+ "ID": "gcp-example",
51
80
"Properties": {
52
81
"Allocation": {
53
82
"Size": 1
54
83
},
55
84
"Instance": {
56
- "Plugin" : " instance-gcp " ,
85
+ "Plugin": "google/compute ",
57
86
"Properties": {
58
87
"NamePrefix": "test",
59
- "Description" : " Test of GCP infrakit" ,
88
+ "Description": "Test of Google infrakit",
60
89
"Network": "default",
61
90
"Tags": ["tag1", "tag2"],
62
91
"MachineType": "n1-standard-1",
73
102
}
74
103
},
75
104
"Flavor": {
76
- "Plugin" : " flavor- vanilla" ,
105
+ "Plugin": "vanilla",
77
106
"Properties": {
78
107
"Init": [
79
108
"sh -c \"echo 'Hello, World!' > /hello\""
@@ -84,75 +113,21 @@ too.
84
113
}
85
114
` ` `
86
115
87
- ## Group plugin
88
-
89
- An InfraKit group plugin which wraps Google Compute Engine's managed instance
90
- groups.
91
-
92
- ### Building
93
-
94
- To build the group plugin, run ` make binaries ` . The plugin binary will be located at
95
- ` ./build/infrakit-group-gcp ` .
96
-
97
- ### Running
116
+ Finally, instruct the Group plugin to start watching the group:
98
117
99
118
` ` ` bash
100
- ${PATH_TO_INFRAKIT} /infrakit-flavor-vanilla
101
- ./build/infrakit-instance-gcp --project=[GCP_PROJECT] --zone=[GCP_ZONE] --name=group
102
-
103
- ${PATH_TO_INFRAKIT} /infrakit group commit gcp-example-2.json
119
+ $ build/infrakit group-stateless commit gcp-vanilla.json
104
120
` ` `
105
121
106
- #### Project and zone selection
107
-
108
- Works the same as the instance plugin.
109
-
110
- #### Pets versus Cattle
122
+ # # Group plugin
111
123
112
- This plugin supports only pets via ` Allocation/Size ` . It doesn't support
113
- ` Allocation/LogicalIDs ` .
114
- This plugin doesn't need an instance plugin since instances are managed directly
115
- by GCP.
124
+ An InfraKit group plugin which wraps Google Compute Engine' s managed instance
125
+ groups.
116
126
117
- ### Example configuration
127
+ The CLI will report the newly-created instance from the above example, via:
118
128
119
- ``` json
120
- {
121
- "ID" : " gcp-example-2" ,
122
- "Properties" : {
123
- "Allocation" : {
124
- "Size" : 2
125
- },
126
- "Instance" : {
127
- "Properties" : {
128
- "Description" : " Test of GCP infrakit" ,
129
- "Network" : " default" ,
130
- "Tags" : [" tag1" , " tag2" ],
131
- "MachineType" : " n1-standard-1" ,
132
- "Disks" :[{
133
- "Boot" : true ,
134
- "SizeGb" : 60 ,
135
- "Image" : " https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1404-trusty-v20161205" ,
136
- "Type" : " pd-standard" ,
137
- "AutoDelete" : false ,
138
- "ReuseExisting" : true
139
- }],
140
- "Scopes" : [
141
- " https://www.googleapis.com/auth/cloudruntimeconfig" ,
142
- " https://www.googleapis.com/auth/logging.write"
143
- ]
144
- }
145
- },
146
- "Flavor" : {
147
- "Plugin" : " flavor-vanilla" ,
148
- "Properties" : {
149
- "Init" : [
150
- " sh -c \" echo 'Hello, World!' > /hello\" "
151
- ]
152
- }
153
- }
154
- }
155
- }
129
+ ```bash
130
+ $ build/infrakit group-stateless inspect gcp-example
156
131
```
157
132
158
133
## Reporting security issues
0 commit comments