Commit graph

291 commits

Author SHA1 Message Date
Daniel Imfeld d66e78c5ca Parse information for all GCE network interface.
* No longer setting Device name in the network interface since we can't
match up the info here with real device names.
* Add attributes for all external IPs if more than one exists.
2015-10-07 13:35:20 -05:00
Daniel Imfeld 70350aead9 Compact tags and attribute reading code. 2015-10-07 12:39:23 -05:00
Daniel Imfeld dc1c8e5273 TestNetworkFingerprint_notAWS passes even when actually on AWS 2015-10-06 21:21:42 -05:00
Daniel Imfeld 892cad6775 NonXXX tests should pass when actually running in their respective environments.
Fixes #224
2015-10-06 21:16:28 -05:00
Daniel Imfeld 32d5c61779 Consolidate GCEMetadataClient into EnvGCEFingerprint
This allows easier reuse of the same client across multiple functions.
2015-10-05 13:13:25 -05:00
Daniel Imfeld a85dda68fe And add a comment to the constant. 2015-10-05 12:59:02 -05:00
Daniel Imfeld adbb23e267 Use a constant for the default GCE metadata URL 2015-10-05 12:57:45 -05:00
Daniel Imfeld 46bbfc3549 isAWS should return false on GCE
GCE and AWS both expose metadata servers, and GCE's 404 response
includes the URL in the content, which maatches the regex. So,
check the response code as well and if a 4xx code comes back,
take that to meanit's not AWS.
2015-10-05 00:42:34 -05:00
Daniel Imfeld a43a262e66 Fingerprinting code for GCE nodes
This reads the following:

* hostname
* instance id
* machine-type
* zone
* internal IP
* external IP (if any)
* tags
* attributes

Atributes are placed under the platform.gce.attr.* hierarchy.

Tags are set up as platform.gce.tag.TagName=true.
2015-10-05 00:40:43 -05:00
Alex Dadgar aeb400cd8a update test to reflect not uppercasing passed env vars 2015-10-02 17:49:18 -07:00
Antoine POPINEAU a03ce2b39c Removed capitalization of user-defined envvars. 2015-10-02 17:46:55 -07:00
Antoine POPINEAU 56944536fc Moved the envvars logic to TaskEnvironment and TaskEnvironmentVariables(). Added tests there. 2015-10-02 17:46:55 -07:00
Antoine POPINEAU 722141bfa6 Added a jobspec directive to specify envvars. Updated Docker driver to use them accordingly. 2015-10-02 17:46:55 -07:00
Alex Dadgar e60e6ff8f5 Add debug line when setting link speed to default 2015-10-02 17:32:17 -07:00
Alex Dadgar 4cc8588cb5 Merges 2015-10-02 17:32:11 -07:00
Alex Dadgar faf8002d2d go-fmt 2015-10-02 10:54:04 -07:00
Alex Dadgar 0c7f3e21d7 Merge pull request #199 from achanda/double_call
Fix two issues where settings were not taking effect
2015-10-02 10:52:41 -07:00
Abhishek Chanda 3751b46673 Make sure createHostConfig is called only once
The second call discards any mods to port binding or
network type

Fixes #185 and #196
2015-10-02 10:43:37 -07:00
Antoine POPINEAU f35ebe14ad Merge branch 'master' into dev/net-fingerprint 2015-10-02 09:38:35 +02:00
Antoine POPINEAU 36daef1625 Renamed all instances of Iface to NetworkInterface. 2015-10-02 09:29:18 +02:00
Alex Dadgar 191ea91cdd Merge pull request #184 from achanda/docker_net
Enable setting networking mode for docker
2015-10-01 19:32:48 -07:00
Abhishek Chanda 0cb649bd5f Enable setting networking mode for docker
This patch enables setting networking mode for the docker
driver. This does not handle the `container` mode.
Closes #175
2015-10-01 18:52:41 -07:00
Antoine POPINEAU 3a4b304a53 Refactored code. 2015-10-01 21:16:39 +02:00
Antoine POPINEAU 2e1488fb04 Comment some undocumented code. 2015-10-01 20:39:10 +02:00
Ryan Uber 836fd8a015 Merge pull request #153 from aldergren/master
Prevent df on linux from adding line breaks to output
2015-10-01 11:21:02 -07:00
Antoine POPINEAU b01912abdc Forgot some error checking. 2015-10-01 17:33:40 +02:00
Antoine POPINEAU 70d34da1bc Client config param added to specify net iface to use for fingerprinting. Added a Golang-native method for determining the interface IP address. 2015-10-01 17:31:47 +02:00
Orivej Desh 443d2deb32 Update obsolete comments 2015-09-29 20:33:11 +00:00
Orivej Desh d844997661 Fix "ifconfig not found" warning 2015-09-29 20:06:37 +00:00
Niklas Aldergren 9145d8ffb9 Prevent df on linux from adding line breaks to output 2015-09-29 13:23:41 +02:00
Orivej Desh 4ecf7a0f74 Improve link speed fingerprint error reporting
With disconnected eth0 log output now looks like:

[WARN] fingerprint.network: Unable to parse IP in output of '/bin/ifconfig eth0'
[WARN] fingerprint.network: Unable to parse Speed in output of '/usr/sbin/ethtool eth0'

In a virtual machine:

[WARN] fingerprint.network: Unable to parse Speed in output of '/sbin/ethtool eth0'
[WARN] fingerprint.network: Unable to read link speed from /sys/class/net/eth0/speed
2015-09-28 23:34:25 +00:00
Mitchell Hashimoto 690634d245 client: fix windows build errors 2015-09-27 23:53:25 -07:00
Armon Dadgar 6ff19853ef docker: check for missing unix socket 2015-09-27 17:49:58 -07:00
Alex Dadgar d314b514f8 Better Sprintf 2015-09-27 17:41:43 -07:00
Alex Dadgar f8e434aa1d Add environment package 2015-09-27 17:37:25 -07:00
Alex Dadgar 7ba9681a94 Fix args in test 2015-09-27 17:37:24 -07:00
Alex Dadgar a4a440da8e ParseAndReplace args at the executor level 2015-09-27 17:37:24 -07:00
Alex Dadgar 76dfa9bb0f Check err 2015-09-27 17:37:24 -07:00
Alex Dadgar b95d349a3e Set the allocdir correctly when using the linux executor 2015-09-27 17:37:24 -07:00
Alex Dadgar a45f9f2e71 Pull task environments into their own type to be reusable across drivers and executors 2015-09-27 17:37:24 -07:00
Alex Dadgar a96f6dfa6d Remove cruft from rebase 2015-09-27 17:37:24 -07:00
Alex Dadgar a7eebcbd5b merge fixes 2015-09-27 17:37:24 -07:00
Chris Bednarski 162247ffbe Correct implementation of config check for container and image cleanup; moved into Start and Open because handle does not have the config object 2015-09-27 13:59:38 -07:00
Chris Bednarski 9455370d8e Merge branch 'master' into f-docker-config-cleanup 2015-09-26 21:52:02 -07:00
Chris Bednarski 5678859752 Add configuration option for whether Nomad will clean up containers and images when they are no longer used 2015-09-26 18:53:15 -07:00
Chris Bednarski 79488baa4d Add all containers when searching for images that are still in used, since the container using the image may be stopped 2015-09-26 18:51:36 -07:00
Chris Bednarski af314b0f4d Log an info when an image can't be removed because it's still in use 2015-09-26 00:34:57 -07:00
Chris Bednarski 5632a33036 Use env.Get, remove sha256 checks, and change from regexp to strconv to test for int 2015-09-25 23:55:01 -07:00
Chris Bednarski 7021ac3ce8 Add docker 'command' to docs; cleanup some comments 2015-09-25 23:28:23 -07:00
Chris Bednarski 23407c54af Replace docker version and docker ps with native calls; no more exec! 2015-09-25 23:13:40 -07:00