This project is mirrored from https://gitee.com/mirrors/nomad.git. Pull mirroring failed .
Repository mirroring has been paused due to too many failed attempts. It can be resumed by a project maintainer.
  1. 18 Apr, 2022 1 commit
    • Seth Hoenig's avatar
      ci: purge consul/sdk in favor of nomad/sdk · 0ad63293
      Seth Hoenig authored
      This PR substitutes consul/sdk for nomad/sdk.
      
      Major difference in the implementation of freeport, where the
      new version is based on ephemoral ports instead of pre-allocated
      port blocks.
      0ad63293
  2. 06 Apr, 2022 1 commit
  3. 29 Mar, 2022 2 commits
    • Michael Schurter's avatar
      template: fix comments and docs · 3ca38ee4
      Michael Schurter authored
      
      Review notes from @lgfa29
      Co-authored-by: default avatarLuiz Aoqui <luiz@hashicorp.com>
      3ca38ee4
    • Michael Schurter's avatar
      template: disallow `writeToFile` by default · f87ec7e6
      Michael Schurter authored
      Resolves #12095 by WONTFIXing it.
      
      This approach disables `writeToFile` as it allows arbitrary host
      filesystem writes and is only a small quality of life improvement over
      multiple `template` stanzas.
      
      This approach has the significant downside of leaving people who have
      altered their `template.function_denylist` *still vulnerable!* I added
      an upgrade note, but we should have implemented the denylist as a
      `map[string]bool` so that new funcs could be denied without overriding
      custom configurations.
      
      This PR also includes a bug fix that broke enabling all consul-template
      funcs. We repeatedly failed to differentiate between a nil (unset)
      denylist and an empty (allow all) one.
      f87ec7e6
  4. 15 Mar, 2022 1 commit
  5. 10 Jan, 2022 1 commit
    • Derek Strickland's avatar
      Expose Consul template configuration parameters (#11606) · 43edd0e7
      Derek Strickland authored
      
      This PR exposes the following existing`consul-template` configuration options to Nomad jobspec authors in the `{job.group.task.template}` stanza.
      
      - `wait`
      
      It also exposes the following`consul-template` configuration to Nomad operators in the `{client.template}` stanza.
      
      - `max_stale`
      - `block_query_wait`
      - `consul_retry`
      - `vault_retry` 
      - `wait` 
      
      Finally, it adds the following new Nomad-specific configuration to the `{client.template}` stanza that allows Operators to set bounds on what `jobspec` authors configure.
      
      - `wait_bounds`
      Co-authored-by: default avatarTim Gross <tgross@hashicorp.com>
      Co-authored-by: default avatarMichael Schurter <mschurter@hashicorp.com>
      43edd0e7
  6. 18 Oct, 2021 1 commit
    • Michael Schurter's avatar
      client: never embed alloc_dir in chroot · 37f053ff
      Michael Schurter authored
      Fixes #2522
      
      Skip embedding client.alloc_dir when building chroot. If a user
      configures a Nomad client agent so that the chroot_env will embed the
      client.alloc_dir, Nomad will happily infinitely recurse while building
      the chroot until something horrible happens. The best case scenario is
      the filesystem's path length limit is hit. The worst case scenario is
      disk space is exhausted.
      
      A bad agent configuration will look something like this:
      
      ```hcl
      data_dir = "/tmp/nomad-badagent"
      
      client {
        enabled = true
      
        chroot_env {
          # Note that the source matches the data_dir
          "/tmp/nomad-badagent" = "/ohno"
          # ...
        }
      }
      ```
      
      Note that `/ohno/client` (the state_dir) will still be created but not
      `/ohno/alloc` (the alloc_dir).
      While I cannot think of a good reason why someone would want to embed
      Nomad's client (and possibly server) directories in chroots, there
      should be no cause for harm. chroots are only built when Nomad runs as
      root, and Nomad disables running exec j...
      37f053ff
  7. 04 Jan, 2021 2 commits
  8. 16 Dec, 2020 1 commit
    • Tim Gross's avatar
      template: trigger change_mode for dynamic secrets on restore (#9636) · 004f1c97
      Tim Gross authored
      When a task is restored after a client restart, the template runner will
      create a new lease for any dynamic secret (ex. Consul or PKI secrets
      engines). But because this lease is being created in the prestart hook, we
      don't trigger the `change_mode`.
      
      This changeset uses the the existence of the task handle to detect a
      previously running task that's been restored, so that we can trigger the
      template `change_mode` if the template is changed, as it will be only with
      dynamic secrets.
      004f1c97
  9. 18 Nov, 2020 2 commits
    • Michael Schurter's avatar
      5b83ca0b
    • Michael Schurter's avatar
      client: fix interpolation in template source · cd7226d3
      Michael Schurter authored
      While Nomad v0.12.8 fixed `NOMAD_{ALLOC,TASK,SECRETS}_DIR` use in
      `template.destination`, interpolating these variables in
      `template.source` caused a path escape error.
      
      **Why not apply the destination fix to source?**
      
      The destination fix forces destination to always be relative to the task
      directory. This makes sense for the destination as a destination outside
      the task directory would be unreachable by the task. There's no reason
      to ever render a template outside the task directory. (Using `..` does
      allow destinations to escape the task directory if
      `template.disable_file_sandbox = true`. That's just awkward and unsafe
      enough I hope no one uses it.)
      
      There is a reason to source a template outside a task
      directory. At least if there weren't then I can't think of why we
      implemented `template.disable_file_sandbox`. So v0.12.8 left the
      behavior of `template.source` the more straightforward "Interpolate and
      validate."
      
      However, since outside of `raw_exec` every other driver uses absolute
      paths for `NOMAD_*_DIR` interpolation, this means those variables are
      unusable unless `disable_file_sandbox` is set.
      
      **The Fix**
      
      The variables are now interpolated as relative paths *only for the
      purpose of rendering templates.* This is an unfortunate special case,
      but reflects the fact that the templates view of the filesystem is
      completely different (unconstrainted) vs the task's view (chrooted).
      Arguably the values of these variables *should be context-specific.*
      I think it's more reasonable to think of the "hack" as templating
      running uncontainerized than that giving templates different paths is a
      hack.
      
      **TODO**
      
      - [ ] E2E tests
      - [ ] Job validation may still be broken and prevent my fix from
            working?
      
      **raw_exec**
      
      `raw_exec` is actually broken _a different way_ as exercised by tests in
      this commit. I think we should probably remove these tests and fix that
      in a followup PR/release, but I wanted to leave them in for the initial
      review and discussion. Since non-containerized source paths are broken
      anyway, perhaps there's another solution to this entire problem I'm
      overlooking?
      cd7226d3
  10. 21 Oct, 2020 1 commit
    • Tim Gross's avatar
      artifact/template: prevent file sandbox escapes · 076db2ef
      Tim Gross authored
      Ensure that the client honors the client configuration for the
      `template.disable_file_sandbox` field when validating the jobspec's
      `template.source` parameter, and not just with consul-template's own `file`
      function.
      
      Prevent interpolated `template.source`, `template.destination`, and
      `artifact.destination` fields from escaping file sandbox.
      076db2ef
  11. 01 Oct, 2020 1 commit
  12. 24 Aug, 2020 2 commits
  13. 24 Jul, 2020 1 commit
    • Drew Bailey's avatar
      oss compoments for multi-vault namespaces · 19810365
      Drew Bailey authored
      adds in oss components to support enterprise multi-vault namespace feature
      
      upgrade specific doc on vault multi-namespaces
      
      vault docs
      
      update test to reflect new error
      19810365
  14. 09 May, 2020 1 commit
    • Mahmood Ali's avatar
      Deflake TestTaskTemplateManager_BlockedEvents test · 8e655086
      Mahmood Ali authored
      This change deflakes TestTaskTemplateManager_BlockedEvents test, because
      it is expecting a number of events without accounting for transitional
      state.
      
      The test TestTaskTemplateManager_BlockedEvents attempts to ensure that a
      template rendering emits blocked events for missing template ksys.
      
      It works by setting a template that requires keys 0,1,2,3,4 and then
      eventually sets keys 0,1,2,3 and ensures that we get a final event indicating
      that keys 3 and 4 are still missing.
      
      The test waits to get a blocked event for the final state, but it can
      fail if receives a blocked event for a transitional state (e.g. one
      reporting 2,3,4,5 are missing).
      
      This fixes the test by ensuring that it waits until the final message
      before assertion.
      
      Also, it clarifies the intent of the test with stricter assertions and
      additional comments.
      8e655086
  15. 23 Feb, 2020 1 commit
  16. 16 Feb, 2020 1 commit
  17. 12 Aug, 2019 1 commit
    • Tim Gross's avatar
      client/template: configuration for function blacklist and sandboxing · ffb83e1e
      Tim Gross authored
      When rendering a task template, the `plugin` function is no longer
      permitted by default and will raise an error. An operator can opt-in
      to permitting this function with the new `template.function_blacklist`
      field in the client configuration.
      
      When rendering a task template, path parameters for the `file`
      function will be treated as relative to the task directory by
      default. Relative paths or symlinks that point outside the task
      directory will raise an error. An operator can opt-out of this
      protection with the new `template.disable_file_sandbox` field in the
      client configuration.
      ffb83e1e
  18. 05 Aug, 2019 1 commit
  19. 21 May, 2019 1 commit
  20. 10 Apr, 2019 4 commits
  21. 28 Jan, 2019 1 commit
  22. 30 Nov, 2018 2 commits
  23. 16 Oct, 2018 4 commits
  24. 12 Jun, 2018 2 commits
  25. 11 Mar, 2018 1 commit
  26. 10 Nov, 2017 1 commit
  27. 14 Sep, 2017 1 commit
  28. 10 Aug, 2017 1 commit
    • Alex Dadgar's avatar
      Template emits events explaining why it is blocked · 1e7ae913
      Alex Dadgar authored
      This PR does the following:
      * Adds a mechanism to emit events in the TaskRunner
      * Vendors a new version of Consul-Template that allows extraction of
      missing dependencies
      * Adds logic to our consul_template.go to determine missing events and
      emit them in a batched fashion.
      * Refactors the consul_template code to split the run method and take in
      a config struct rather than many parameters.
      
      Fixes https://github.com/hashicorp/nomad/issues/2578
      1e7ae913