Commit Graph

46 Commits

Author SHA1 Message Date
Tim Gross 35b1b3bed7
structs: filter NomadTokenID from job diff (#8773)
Multiregion deployments use the `NomadTokenID` to allow the deploymentwatcher
to send RPCs between regions with the original submitter's ACL token. This ID
should be filtered from diffs so that it doesn't cause a difference for
purposes of job plans.
2020-08-28 13:40:51 -04:00
Seth Hoenig 5b072029f2 consul/connect: add initial support for ingress gateways
This PR adds initial support for running Consul Connect Ingress Gateways (CIGs) in Nomad. These gateways are declared as part of a task group level service definition within the connect stanza.

```hcl
service {
  connect {
    gateway {
      proxy {
        // envoy proxy configuration
      }
      ingress {
        // ingress-gateway configuration entry
      }
    }
  }
}
```

A gateway can be run in `bridge` or `host` networking mode, with the caveat that host networking necessitates manually specifying the Envoy admin listener (which cannot be disabled) via the service port value.

Currently Envoy is the only supported gateway implementation in Consul, and Nomad only supports running Envoy as a gateway using the docker driver.

Aims to address #8294 and tangentially #8647
2020-08-21 16:21:54 -05:00
Tim Gross ec96ddf648
fix swapped old/new multiregion plan diffs (#8378)
The multiregion plan diffs swap the old and new versions for each region when
they're edited (rather than added/removed). The `multiregionRegionDiff`
function call incorrectly reversed its arguments for existing regions.
2020-07-08 10:10:50 -04:00
Nick Ethier 0bc0403cc3 Task DNS Options (#7661)
Co-Authored-By: Tim Gross <tgross@hashicorp.com>
Co-Authored-By: Seth Hoenig <shoenig@hashicorp.com>
2020-06-18 11:01:31 -07:00
Tim Gross 6851024925 Multiregion structs
Initial struct definitions, jobspec parsing, validation, and conversion
between Nomad structs and API structs for multi-region deployments.
2020-06-17 11:00:14 -04:00
Lang Martin d3c4700cd3
server: stop after client disconnect (#7939)
* jobspec, api: add stop_after_client_disconnect

* nomad/state/state_store: error message typo

* structs: alloc methods to support stop_after_client_disconnect

1. a global AllocStates to track status changes with timestamps. We
   need this to track the time at which the alloc became lost
   originally.

2. ShouldClientStop() and WaitClientStop() to actually do the math

* scheduler/reconcile_util: delayByStopAfterClientDisconnect

* scheduler/reconcile: use delayByStopAfterClientDisconnect

* scheduler/util: updateNonTerminalAllocsToLost comments

This was setup to only update allocs to lost if the DesiredStatus had
already been set by the scheduler. It seems like the intention was to
update the status from any non-terminal state, and not all lost allocs
have been marked stop or evict by now

* scheduler/testing: AssertEvalStatus just use require

* scheduler/generic_sched: don't create a blocked eval if delayed

* scheduler/generic_sched_test: several scheduling cases
2020-05-13 16:39:04 -04:00
Drew Bailey 0d4bb6bf92
guard against nil maps 2020-04-06 12:25:50 -04:00
Drew Bailey 3b8afce9e6
test added and removed 2020-04-06 11:53:46 -04:00
Drew Bailey 9874e7b21d
Group shutdown delay fixes
Group shutdown delay updates were not properly handled in Update hook.
This commit also ensures that plan output is displayed.
2020-04-06 11:29:12 -04:00
Tim Gross 7dc6ee2d27 structs: add taskgroup networks and services to plan diffs
Adds a check for differences in `job.Diff` so that task group networks
and services, including new Consul connect stanzas, show up in the job
plan outputs.
2019-08-20 16:18:30 -04:00
Lang Martin 10a3fd61b0 comment replace COMPAT 0.7.0 for job.Update with more current info 2019-05-22 12:34:57 -04:00
Alex Dadgar a2a56a930c Diff 2018-10-08 17:02:58 -07:00
Preetha Appan e85a721cfb
Include affinities in job and task diff, and more test cases 2018-09-04 16:10:11 -05:00
Preetha Appan 9f0caa9c3d
Affinity parsing, api and structs 2018-09-04 16:10:11 -05:00
Alex Dadgar f4af30fbb5
Canary tags structs 2018-05-07 14:50:01 -05:00
Josh Soref 052623bda1 spelling: primitive 2018-03-11 18:38:46 +00:00
Preetha Appan 8408835af8
Wrap reschedule events in another struct and other review feedback 2018-01-31 09:56:53 -06:00
Alex Dadgar fe491421a3 Fix empty map 2017-09-28 16:15:04 -07:00
Michael Schurter f9b66cbb60 Diff CheckRestart objects 2017-09-28 14:06:18 -07:00
Michael Schurter c5529bdd16 Put header diff in its own function 2017-08-17 16:49:14 -07:00
Michael Schurter 9a466bcf5e Add diff support for ServiceCheck.Header 2017-08-17 16:49:14 -07:00
Alex Dadgar 09dfa2fc10 Rename CreateDeployments and remove cancelling behavior in state_store 2017-07-07 12:10:04 -07:00
Alex Dadgar 10b040aea3 New update block; still need to handle the upgrade path 2017-05-08 17:44:26 -07:00
Alex Dadgar e7b128271f Diff code fixes 2017-04-16 16:54:40 -07:00
Alex Dadgar 3b323603b5 Fix diff 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:42:10 -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 3ba8faeae3 Add leader task to api and server side 2017-02-10 16:57:47 -08:00
Alex Dadgar 2057acea3e missing tests 2017-01-25 21:27:44 -08:00
Alex Dadgar 8196a58c4c Rename dispatch_input to dispatch_payload 2017-01-25 21:27:44 -08:00
Michael Schurter 1f7b5b4b47 Rename Constructor -> Parameterized Job 2017-01-20 12:43:10 -08:00
Alex Dadgar d8de7b59a5 JobDiff 2016-12-15 15:40:18 -08:00
Alex Dadgar b4c3f015bc Template diff 2016-09-26 15:36:11 -07:00
Alex Dadgar 59df3dcf58 Vault diff 2016-09-21 13:49:34 -07:00
Diptanu Choudhury 1b3c5e98c8 Renaming LocalDisk to EphemeralDisk (#1710)
Renaming LocalDisk to EphemeralDisk
2016-09-14 15:43:42 -07:00
Diptanu Choudhury 3dec7cd2c9 Added LocalDisk to diff 2016-08-26 20:38:50 -07:00
Alex Dadgar 8e231fa382 Rename ConsulService back to Service 2016-06-12 16:36:49 -07:00
Sean Chittenden 7956eb0c80
Rename structs.Task's `Service` attribute to `ConsulService` 2016-06-10 15:54:39 -04:00
Sean Chittenden 4973ec32bb
Rename structs.Services to structs.ConsulServices 2016-06-10 15:54:39 -04:00
Alex Dadgar 0c653c3c8f Fix determining whether a job is edited 2016-05-17 15:48:35 -07:00
Alex Dadgar a5ab96d40e Merge pull request #1168 from hashicorp/f-plan-endpoint
Job.Plan endpoint
2016-05-16 13:15:40 -07:00
Sean Chittenden dc28ab0cb5
Speling police 2016-05-15 09:41:34 -07:00
Alex Dadgar bed4cb7a9f Fixes 2016-05-13 11:53:11 -07:00
Alex Dadgar 24bfaa70ac Fix switching diff structures 2016-05-11 15:36:28 -07:00
Alex Dadgar 59e244d18e Add service diff 2016-05-11 15:25:59 -07:00
Alex Dadgar 967011e25c contextual diff 2016-05-11 11:11:26 -07:00
Alex Dadgar b4bb28c425 Job diff using generic structures 2016-05-10 22:23:34 -07:00