Commit Graph

1193 Commits

Author SHA1 Message Date
Michael Schurter 4910f867e7 Use spiffy new Go 1.8 subtest feature 2017-04-19 12:42:48 -07:00
Michael Schurter 3e8dd386ee Forgot an important word 2017-04-19 12:42:48 -07:00
Michael Schurter 947e31e9c2 Only register HTTPS agent check when Consul>=0.7.2
Support for TLSSkipVerify in other checks coming soon!
2017-04-19 12:42:48 -07:00
Michael Schurter 383f21559e Explain weird timer logic 2017-04-19 12:42:48 -07:00
Michael Schurter 4db840b54e Metricsify new Consul client 2017-04-19 12:42:48 -07:00
Michael Schurter 59c687c940 Always fail script checks when deadline exceeded 2017-04-19 12:42:48 -07:00
Michael Schurter ca29bb2cac Test script check exit codes 2017-04-19 12:42:47 -07:00
Michael Schurter 6f6431ce0b Follow _testing.go convention for testing tools 2017-04-19 12:42:47 -07:00
Michael Schurter 2a11508cc8 Rework to account for ports not being in IDs
Previous implementation assumed all struct fields were included in
service and check IDs. Service IDs never include port labels and check
IDs *optionally* include port labels, so lots of things had to change.

Added a really big test to exercise this.
2017-04-19 12:42:47 -07:00
Michael Schurter 6e0fd86361 Remove commits return value
...and still protect against leaking agent entries in Consul on
shutdown.
2017-04-19 12:42:47 -07:00
Michael Schurter fb52bbfa45 Explain PortLabel handling in RegisterAgent 2017-04-19 12:42:47 -07:00
Michael Schurter 2728216f6f Plumb alloc id + task name into script check logs 2017-04-19 12:42:47 -07:00
Michael Schurter 01b20cbb59 Stop being lazy and just type out struct{}{} 2017-04-19 12:42:47 -07:00
Michael Schurter 5e908dbf38 Use nifty testtask sleep command for xplat compat 2017-04-19 12:42:47 -07:00
Michael Schurter 8c433cfba1 Add comments, clarify names, fix PR comments 2017-04-19 12:42:47 -07:00
Michael Schurter 40b3987e90 Explain cleanup defer in test 2017-04-19 12:42:47 -07:00
Michael Schurter 7c8ad71da5 Fix comment to reflect reality 2017-04-19 12:42:47 -07:00
Michael Schurter 745ad9521f Move ScriptExecutor to driver 2017-04-19 12:42:47 -07:00
Michael Schurter 926d141532 Fix shutdown when consul is down 2017-04-19 12:42:47 -07:00
Michael Schurter 87b28cfb75 Switch ServiceClient to synchronizing state
Previously it applied a stream of operations. Reconciling state is less
complex and error prone at the cost of slightly higher CPU/memory usage.
2017-04-19 12:42:47 -07:00
Michael Schurter 244251490a Add UpdateTask method instead of Remove/Add 2017-04-19 12:42:47 -07:00
Michael Schurter 8118c41931 Remove some lies 2017-04-19 12:42:47 -07:00
Michael Schurter 0143bef8c7 Remove unused syncInterval 2017-04-19 12:42:47 -07:00
Michael Schurter e204a287ed Refactor Consul Syncer into new ServiceClient
Fixes #2478 #2474 #1995 #2294

The new client only handles agent and task service advertisement. Server
discovery is mostly unchanged.

The Nomad client agent now handles all Consul operations instead of the
executor handling task related operations. When upgrading from an
earlier version of Nomad existing executors will be told to deregister
from Consul so that the Nomad agent can re-register the task's services
and checks.

Drivers - other than qemu - now support an Exec method for executing
abritrary commands in a task's environment. This is used to implement
script checks.

Interfaces are used extensively to avoid interacting with Consul in
tests that don't assert any Consul related behavior.
2017-04-19 12:42:47 -07:00
Alex Dadgar e7b128271f Diff code fixes 2017-04-16 16:54:40 -07:00
Alex Dadgar 7b3f3f80fb Status shows type of job 2017-04-15 17:08:05 -07:00
Alex Dadgar 34332af70e GC and some fixes 2017-04-15 17:08:05 -07:00
Alex Dadgar 3145086a42 non-purge deregisters 2017-04-15 17:08:05 -07:00
Alex Dadgar 45ad95e862 Agent API + api package 2017-04-15 17:08:05 -07:00
Alex Dadgar f97664512b Upsert Job Histories 2017-04-15 17:08:05 -07:00
Adam Stankiewicz 4daf4cb8c9
Remove unnecessary parameter from NewHTTPServer 2017-04-10 16:24:49 +02:00
Alex Dadgar 81b78f77e1 Track task start/finish time & improve logs errors
This PR adds tracking to when a task starts and finishes and the logs
API takes advantage of this and returns better errors when asking for
logs that do not exist.
2017-03-31 16:14:11 -07:00
Alex Dadgar 103e8d21fb Fix dispatch of periodic job
This PR fixes an issue in which when a periodic and parameterized job
was dispatched, an allocation would be immediately created.

Fixes https://github.com/hashicorp/nomad/issues/2470
2017-03-27 16:55:17 -07:00
Alex Dadgar df9ce2680b Fix output alignment and remove no-change DC
Old Output:

```
+/- Job: "example"
    Datacenters {
  Datacenters: "dc1"
}
+/- Task Group: "cache" (1 create/destroy update)
  +/- RestartPolicy {
    +/- Attempts: "10" => "9"
        Delay:    "25000000000"
        Interval: "300000000000"
        Mode:     "delay"
  }
  +/- EphemeralDisk {
        Migrate: "false"
    +/- SizeMB:  "300" => "301"
        Sticky:  "false"
  }
  +/- Task: "redis" (forces create/destroy update)
    +   Meta[key]: "value"
    +/- Config {
          image:           "redis:3.2"
      +/- port_map[0][db]: "6379" => "6380"
    }
    +/- Resources {
          CPU:      "500"
          DiskMB:   "0"
          IOPS:     "0"
      +/- MemoryMB: "256" => "257"
    }
    +/- Service {
          Name:      "global-redis-check"
          PortLabel: "db"
      +/- Check {
            Command:       ""
            InitialStatus: ""
            Interval:      "10000000000"
            Name:          "alive"
            Path:          ""
            PortLabel:     ""
            Protocol:      ""
        +/- Timeout:       "2000000000" => "3000000000"
            Type:          "tcp"
      }
    }
```

New Output:

```
+/- Job: "example"
+/- Task Group: "cache" (1 create/destroy update)
  +/- RestartPolicy {
    +/- Attempts: "10" => "9"
        Delay:    "25000000000"
        Interval: "300000000000"
        Mode:     "delay"
      }
  +/- EphemeralDisk {
        Migrate: "false"
    +/- SizeMB:  "300" => "301"
        Sticky:  "false"
      }
  +/- Task: "redis" (forces create/destroy update)
    +   Meta[key]: "value"
    +/- Config {
          image:           "redis:3.2"
      +/- port_map[0][db]: "6379" => "6380"
        }
    +/- Resources {
          CPU:      "500"
          DiskMB:   "0"
          IOPS:     "0"
      +/- MemoryMB: "256" => "257"
        }
    +/- Service {
          Name:      "global-redis-check"
          PortLabel: "db"
      +/- Check {
            Command:       ""
            InitialStatus: ""
            Interval:      "10000000000"
            Name:          "alive"
            Path:          ""
            PortLabel:     ""
            Protocol:      ""
        +/- Timeout:       "2000000000" => "3000000000"
            Type:          "tcp"
          }
        }
```
2017-03-21 11:31:06 -07:00
Alex Dadgar 40d0f3ce7d Flush logs on err 2017-03-14 14:48:39 -07:00
Alex Dadgar 177bd14718 rename cpu_total_compute and docs 2017-03-14 14:15:49 -07:00
Alex Dadgar a1a7941dec Various fixes
This PR:
* Uses Go 1.8 executable lookup
* Stores any err message from stats init method
* Allows overriding of Cpu Compute for hosts where it can't be detected
2017-03-14 12:56:31 -07:00
Alex Dadgar 2a105c4eaa Merge pull request #2427 from hashicorp/f-gc-limit
Limit parallelism during garbage collection
2017-03-14 10:45:29 -07:00
Jonathan Ballet cfaa2e9a1a Allow to advertise 127.0.0.1 in non-dev mode if explicitly configured 2017-03-13 23:05:06 +01:00
Jonathan Ballet 562deb6262 Default to private IP advertise address in non-dev mode 2017-03-13 23:01:11 +01:00
Jonathan Ballet 3c5c49bedb Parse template before splitting host/port
Ref: a33af1ca0b (r105444568)
2017-03-13 21:40:37 +01:00
Alex Dadgar 70e4feb045 Limit parallelism during garbage collection
This PR introduces a parallelism limit during garbage collection. This
is used to avoid large resource usage spikes if garbage collecting many
allocations at once.
2017-03-10 16:27:00 -08:00
Ben Barnard 372303f4c6 Return AgentSelf struct from Agent.Self() instead of map
api.AgentSelf mirrors command.agent.agentSelf, and makes it easier to
work with the results of a call to Agent.Self()
2017-03-08 15:59:10 +01:00
Alex Dadgar fa413b66f9 Merge pull request #2398 from TheBits/master
Remove 'disk space' from docs
2017-03-06 14:52:12 -08:00
Alex Dadgar fcdefca1bf Display Disk resources on CLI
Fixes https://github.com/hashicorp/nomad/issues/2401
2017-03-06 12:53:24 -08:00
Sergey Mezentsev 0078af8b08 Remove 'disk space' from docs 2017-03-04 22:54:49 +03:00
Michael Schurter 2caa219352 Small init and validate smoke test 2017-03-03 16:13:25 -08:00
Alex Dadgar 3b9bdfef1c Make validate work without a Nomad agent 2017-03-03 15:02:03 -08:00
Alex Dadgar 8827b4f4d0 Fix canonicalization of services 2017-03-01 15:30:01 -08:00
Alex Dadgar ed95a69905 Fix plan 2017-03-01 14:50:26 -08:00
Alex Dadgar c58494fdb6 Handle periodic paramaterized jobs
Fixes https://github.com/hashicorp/nomad/issues/2382
2017-03-01 11:45:20 -08:00
Alex Dadgar 5be806a3df Fix vet script and fix vet problems
This PR fixes our vet script and fixes all the missed vet changes.

It also fixes pointers being printed in `nomad stop <job>` and `nomad
node-status <node>`.
2017-02-27 16:00:19 -08:00
Alex Dadgar 6910678c21 Allow random UUID 2017-02-27 13:42:37 -08:00
Alex Dadgar 6afcba9e22 Allow specification of eval/job gc threshold 2017-02-27 11:58:10 -08:00
Jonathan Ballet 72b0a7f34d Add support for late binding to IP addresses using go-sockaddr/template 2017-02-26 23:28:23 +01:00
Alex Dadgar 5fd7975750 Fix pointer dereference for stats 2017-02-25 13:36:23 -08:00
Sean Chittenden 9cde9296da
Change the default display name from the Circonus Instance ID to
`Nomad`.

The display name is already scoped to target/host.
2017-02-24 14:59:11 -08:00
Alex Dadgar 3d353ffbcd Node-status displays drivers
This PR adds the drivers that are enabled to the output of `nomad
node-status`
2017-02-22 18:54:28 -08:00
Alex Dadgar 6936c81720 Merge pull request #2302 from hashicorp/f-task-state-setup
Adding a task event for setup
2017-02-22 18:42:57 -08:00
Alex Dadgar d2cbbac76e Merge pull request #2347 from hashicorp/b-parse
Remove defaulting from parse and fix tests
2017-02-22 18:42:43 -08:00
Diptanu Choudhury 98921575af Adding a task event for setup 2017-02-22 18:28:07 -08:00
Alex Dadgar ed670f0226 Revert "Deregistering non-existant job returns 404" 2017-02-22 18:22:02 -08:00
Alex Dadgar c105e5a080 Fix wrong types 2017-02-22 16:56:51 -08:00
Alex Dadgar b5995c6cd7 Vendor + test fixes 2017-02-22 15:55:33 -08:00
Troy Swanson e94b987075 s/successfully/successful 2017-02-21 10:58:33 -06:00
Alex Dadgar 1e5183fb89 Deregistering non-existant job returns 404
Fixes https://github.com/hashicorp/nomad/issues/2326
2017-02-20 20:10:21 -08:00
Alex Dadgar b49fceb491 rebase 2017-02-20 16:43:28 -08:00
Alex Dadgar 693dd21420 Add leader and timezone to conversion 2017-02-20 16:36:41 -08:00
Alex Dadgar 9d5ef6e5f2 fix pointer 2017-02-20 16:22:31 -08:00
Alex Dadgar 99538ddf1c Add defaulting test and fix types on the agent job endpoint tests 2017-02-20 15:53:56 -08:00
Alex Dadgar b67c59f03c Merge branch 'master' into refactor-parser 2017-02-20 15:13:21 -08:00
Alex Dadgar 10735d1c0f Merge pull request #2321 from hashicorp/f-timezone
Allow specification of timezones in Periodic Jobs
2017-02-17 11:32:14 -08:00
Diptanu Choudhury ccd13e855d Merge branch 'refactor-parser' of github.com:hashicorp/nomad into refactor-parser 2017-02-16 15:18:46 -08:00
Diptanu Choudhury b1339026ae Fixed cli tests 2017-02-16 15:18:38 -08:00
Alex Dadgar b2eb7028cc Fix CLI handling of parameterized/periodic jobs 2017-02-16 14:29:34 -08:00
Alex Dadgar 5785b4518e Refactor test and fix them 2017-02-16 14:00:41 -08:00
Alex Dadgar 70e716c8bb Flatmap 2017-02-16 13:52:39 -08:00
Alex Dadgar 297ee0b1bd Fix detection of missing port 2017-02-16 13:52:39 -08:00
Diptanu Choudhury e3b92afc77 Making the job register endpoint use api.Job 2017-02-16 13:52:39 -08:00
Alex Dadgar 51dd3e6e12 Use RC to see if cause of failure 2017-02-16 13:52:39 -08:00
Diptanu Choudhury 161ce2ff87 Removing un-neccessary conversions 2017-02-16 13:52:39 -08:00
Diptanu Choudhury 571d112e6d Fixed the nomad status command 2017-02-16 13:52:39 -08:00
Diptanu Choudhury d0d7c92bab Added tests 2017-02-16 13:52:39 -08:00
Diptanu Choudhury 7567209857 Making the job spec return api.Job 2017-02-16 13:52:39 -08:00
Alex Dadgar 74a5fedadc fix test 2017-02-15 16:28:28 -08:00
Alex Dadgar 627ac3fc45 Fix escaping 2017-02-15 15:14:47 -08:00
Alex Dadgar 7e918003ba Allow specification of timezones 2017-02-15 14:37:06 -08:00
Alex Dadgar 0e6b84145c Fix interval breaking two tests 2017-02-14 17:06:30 -08:00
Alex Dadgar b6357f96c5 Merge pull request #2308 from hashicorp/f-leader-task
Leader task
2017-02-14 11:03:32 -08:00
Alex Dadgar 4432b09e03 Remove old vault status 2017-02-13 10:44:10 -08:00
Alex Dadgar 238b4bcafd Add Leader support to client 2017-02-10 17:55:19 -08:00
Alex Dadgar 2d4d9b79d8 Operator command/endpoint/documentation 2017-02-09 18:04:46 -08:00
David Bresson 1c81a71f13 avoid nil pointer dereference 2017-02-03 08:39:57 -08:00
David Bresson e7a7690815 extend config merge test to test merging to empty config 2017-02-03 08:35:18 -08:00
Diptanu Choudhury d0fe4a67a5 Merging GC related config values 2017-02-02 13:38:11 -08:00
Alex Dadgar b951b84b44 Merge pull request #2278 from hashicorp/b-consul-merge
Fix Consul Config Merging/Copying
2017-02-02 11:39:26 -08:00
Alex Dadgar 7fae2d2cea Fix Consul Config Merging/Copying
This PR fixes config merging/copying code.

Fixes https://github.com/hashicorp/nomad/issues/2264
2017-02-02 11:12:07 -08:00
Alex Dadgar 15ffdff497 Vault Client on Server handles SIGHUP
This PR allows the Vault client on the server to handle a SIGHUP. This
allows updating the Vault token and any other configuration without
downtime.
2017-02-01 14:24:10 -08:00
Diptanu Choudhury 11d7cb1230 Making the GC related fields tunable 2017-01-31 15:51:20 -08:00
Alex Dadgar 83106de217 Merge branch 'master' into d-vault 2017-01-27 15:19:34 -08:00