docker-archive / deploykit

A toolkit for creating and managing declarative, self-healing infrastructure.
Apache License 2.0
2.25k stars 264 forks source link

Tutorial Fails with Client.Timeout #910

Open ghost opened 5 years ago

ghost commented 5 years ago

If you following the tutorial here, you can provision an instance using the provided example file. However, continuing the example by committing a group fails with an error.

To reproduce With infrakit started and using the provided group.yml file: infrakit local group commit -y ./group.yml --log-debug-V 0 --log 5

Result

DBUG[09-25|18:58:54] reading template                         module=cli/core url=http://10.50.7.50/rosette/group.yml fn=github.com/docker/infrakit/pkg/cli.templateProcessor.func3
DBUG[09-25|18:58:54] rendered                                 module=cli/core view="#\r\n#  A group of workers\r\n#\r\n#  Start up -- plugin start should include manager, vanilla, simulator, and group\r\n#  Then commit\r\n#\r\n#  infrakit group controller commit -y docs/tutorial/group.yml\r\n#\r\nkind: group\r\nmetadata:\r\n    name: workers\r\nproperties:\r\n    Allocation:\r\n      Size: 5\r\n    Flavor:\r\n      Plugin: vanilla\r\n      Properties:\r\n        Init:\r\n          - sudo apt-get update -y\r\n          - sudo apt-get install wget curl\r\n          - wget -qO- https://get.docker.com | sh\r\n        Tags:\r\n          custom.tag1 : tutorial\r\n          custom.tag2 : single-instance\r\n          custom.tag3 : by-group\r\n\r\n    Instance:\r\n      Plugin: simulator/compute\r\n      # This section here for the Instance plugin is the same as the example\r\n      # for creating a single instance.  The Tags and Init sections are now\r\n      # handled by the Flavor plugin\r\n      Properties:\r\n        apiProperty1 : value1\r\n        apiProperty2 : value2" fn=github.com/docker/infrakit/pkg/cli.templateProcessor.func3
DBUG[09-25|18:58:54] looking up controller backend            module=run/scope name=group fn=github.com/docker/infrakit/pkg/run/scope.fullScope.Controller.func1
DBUG[09-25|18:58:54] Discovered plugin                        module=discovery/local address=/.infrakit/plugins/group V=1000 fn=github.com/docker/infrakit/pkg/discovery/local.(*dirPluginDiscovery).List
DBUG[09-25|18:58:54] Discovered plugin                        module=discovery/local address=/.infrakit/plugins/group-stateless V=1000 fn=github.com/docker/infrakit/pkg/discovery/local.(*dirPluginDiscovery).List
DBUG[09-25|18:58:54] Discovered plugin                        module=discovery/local address=/.infrakit/plugins/simulator V=1000 fn=github.com/docker/infrakit/pkg/discovery/local.(*dirPluginDiscovery).List
DBUG[09-25|18:58:54] Discovered plugin                        module=discovery/local address=/.infrakit/plugins/vanilla V=1000 fn=github.com/docker/infrakit/pkg/discovery/local.(*dirPluginDiscovery).List
DBUG[09-25|18:58:54] Discovered plugin                        module=discovery/local address=/.infrakit/plugins/group V=1000 fn=github.com/docker/infrakit/pkg/discovery/local.(*dirPluginDiscovery).List
DBUG[09-25|18:58:54] Discovered plugin                        module=discovery/local address=/.infrakit/plugins/group-stateless V=1000 fn=github.com/docker/infrakit/pkg/discovery/local.(*dirPluginDiscovery).List
DBUG[09-25|18:58:54] Discovered plugin                        module=discovery/local address=/.infrakit/plugins/simulator V=1000 fn=github.com/docker/infrakit/pkg/discovery/local.(*dirPluginDiscovery).List
DBUG[09-25|18:58:54] Discovered plugin                        module=discovery/local address=/.infrakit/plugins/vanilla V=1000 fn=github.com/docker/infrakit/pkg/discovery/local.(*dirPluginDiscovery).List
DBUG[09-25|18:58:54] Client SEND                              module=rpc/client addr=/.infrakit/plugins/group payload="POST / HTTP/1.1\r\nHost: h\r\nContent-Type: application/json\r\n\r\n{\"jsonrpc\":\"2.0\",\"method\":\"Handshake.Hello\",\"params\":{},\"id\":1675921662065898680}" V=1100 fn=github.com/docker/infrakit/pkg/rpc/client.client.Call
DBUG[09-25|18:58:54] Client RECEIVE                           module=rpc/client addr=/.infrakit/plugins/group payload="HTTP/1.1 200 OK\r\nContent-Length: 318\r\nContent-Type: text/plain; charset=utf-8\r\nDate: Tue, 25 Sep 2018 18:58:54 GMT\r\n\r\n{\"jsonrpc\":\"2.0\",\"result\":{\"Objects\":{\"Controller/0.1.1\":[{\"Name\":\"groups\",\"ProxyFor\":\"\"},{\"Name\":\"\",\"ProxyFor\":\"\"}],\"Group/0.1.1\":[{\"Name\":\"groups\",\"ProxyFor\":\"\"}],\"Stack/0.1.1\":[{\"Name\":\".\",\"ProxyFor\":\"\"}],\"Updatable/0.1.1\":[{\"Name\":\"status\",\"ProxyFor\":\"\"},{\"Name\":\"vars\",\"ProxyFor\":\"\"}]}},\"id\":1675921662065898680}\n" V=1100 fn=github.com/docker/infrakit/pkg/rpc/client.client.Call
DBUG[09-25|18:58:54] Client SEND                              module=rpc/client addr=/.infrakit/plugins/group payload="POST / HTTP/1.1\r\nHost: h\r\nContent-Type: application/json\r\n\r\n{\"jsonrpc\":\"2.0\",\"method\":\"Controller.Commit\",\"params\":{\"Name\":\"group\",\"Operation\":0,\"Spec\":{\"kind\":\"group\",\"version\":\"\",\"metadata\":{\"name\":\"workers\",\"tags\":null},\"properties\":{\"Allocation\":{\"Size\":5},\"Flavor\":{\"Plugin\":\"vanilla\",\"Properties\":{\"Init\":[\"sudo apt-get update -y\",\"sudo apt-get install wget curl\",\"wget -qO- https://get.docker.com | sh\"],\"Tags\":{\"custom.tag1\":\"tutorial\",\"custom.tag2\":\"single-instance\",\"custom.tag3\":\"by-group\"}}},\"Instance\":{\"Plugin\":\"simulator/compute\",\"Properties\":{\"apiProperty1\":\"value1\",\"apiProperty2\":\"value2\"}}}}},\"id\":3751559271277998634}" V=1100 fn=github.com/docker/infrakit/pkg/rpc/client.client.Call
Error: Post http://h: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

Comments Outside of a potential regression, it seems as though the Group plugin is proxing for a real Controller implementation which does not exist in the tutorial setup. I can see some recent Controller implementations, but I am not sure which one to use in this case.

ghost commented 5 years ago

TLDR: I got it working. You need to specify a list of Controller implementation(s) to the Manager plugin using the INFRAKIT_MANAGER_CONTROLLERS environment variable as well as add the controller plugin to the plugin list. This changes the group command to use the Stack interface instead of the Group interface. So to achieve similar results in the tutorial, use the group/groups command to commit the given group.yml file. Detailed commands are below.

Launch Infrakit

INFRAKIT_MANAGER_CONTROLLERS=resource \
   infrakit plugin start manager group resource vanilla simulator

In another shell:

infrakit local group/groups commit -y ./group.yml

To verify:

infrakit local group/workers ls
ID                              LOGICAL                         TAGS
1537985111915511818               -                             custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator
1537985111916528594               -                             custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator
1537985111916885134               -                             custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator
1537985111917523752               -                             custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator
1537985111917927281               -                             custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator

For the record, it does not seem to matter which controller implementation you use when committing the group. For example, the commit will work if you use pool instead.

From my perspective, this issue may be closed unless you would like to target it against the docs.

thebsdbox commented 5 years ago

If you’d like to correct the docs that would be awesome! If not I’ll try and take your notes and do it once I’m back.

Thanks for your work!

On Wed, 26 Sep 2018 at 20:16, Robert Bergstrom notifications@github.com wrote:

TLDR: I got it working. You need to specify a list of Controller implementation(s) to the Manager plugin using the INFRAKIT_MANAGER_CONTROLLERS environment variable as well as add the controller plugin to the plugin list. This changes the group command to use the Stack interface instead of the Group interface. So to achieve similar results in the tutorial, use the group/groups command to commit the given group.yml file. Detailed commands are below.

Launch Infrakit

INFRAKIT_MANAGER_CONTROLLERS=resource \ infrakit plugin start manager group resource vanilla simulator

In another shell:

infrakit local group/groups commit -y ./group.yml

To verify:

infrakit local group/workers ls

ID LOGICAL TAGS 1537985111915511818 - custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator 1537985111916528594 - custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator 1537985111916885134 - custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator 1537985111917523752 - custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator 1537985111917927281 - custom.tag1=tutorial,custom.tag2=single-instance,custom.tag3=by-group,infrakit.config.hash=oskdoyfaewtrrmwlychnja3ejwz574ue,infrakit.group=workers,simulator=simulator

For the record, it does not seem to matter which controller implementation you use when committing the group. For example, the commit will work if you use pool instead.

From my perspective, this issue may be closed unless you would like to target it against the docs.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/docker/infrakit/issues/910#issuecomment-424818268, or mute the thread https://github.com/notifications/unsubscribe-auth/ABlQJs_QPqcHhlXHrkPxspgYX-dQxiNKks5ue8SMgaJpZM4W5U1P .