github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/jobspec/test-fixtures/basic.hcl (about)

     1  job "binstore-storagelocker" {
     2    region       = "fooregion"
     3    namespace    = "foonamespace"
     4    type         = "batch"
     5    priority     = 52
     6    all_at_once  = true
     7    datacenters  = ["us2", "eu1"]
     8    consul_token = "abc"
     9    vault_token  = "foo"
    10  
    11    meta {
    12      foo = "bar"
    13    }
    14  
    15    constraint {
    16      attribute = "kernel.os"
    17      value     = "windows"
    18    }
    19  
    20    constraint {
    21      attribute = "${attr.vault.version}"
    22      value     = ">= 0.6.1"
    23      operator  = "semver"
    24    }
    25  
    26    affinity {
    27      attribute = "${meta.team}"
    28      value     = "mobile"
    29      operator  = "="
    30      weight    = 50
    31    }
    32  
    33    spread {
    34      attribute = "${meta.rack}"
    35      weight    = 100
    36  
    37      target "r1" {
    38        percent = 40
    39      }
    40  
    41      target "r2" {
    42        percent = 60
    43      }
    44    }
    45  
    46    update {
    47      stagger           = "60s"
    48      max_parallel      = 2
    49      health_check      = "manual"
    50      min_healthy_time  = "10s"
    51      healthy_deadline  = "10m"
    52      progress_deadline = "10m"
    53      auto_revert       = true
    54      auto_promote      = true
    55      canary            = 1
    56    }
    57  
    58    task "outside" {
    59      driver = "java"
    60  
    61      config {
    62        jar_path = "s3://my-cool-store/foo.jar"
    63      }
    64  
    65      meta {
    66        my-cool-key = "foobar"
    67      }
    68    }
    69  
    70    group "binsl" {
    71      count = 5
    72  
    73      volume "foo" {
    74        type   = "host"
    75        source = "/path"
    76      }
    77  
    78      volume "bar" {
    79        type            = "csi"
    80        source          = "bar-vol"
    81        read_only       = true
    82        attachment_mode = "file-system"
    83        access_mode     = "single-mode-writer"
    84  
    85        mount_options {
    86          fs_type = "ext4"
    87        }
    88      }
    89  
    90      volume "baz" {
    91        type   = "csi"
    92        source = "bar-vol"
    93  
    94        mount_options {
    95          mount_flags = ["ro"]
    96        }
    97  
    98        per_alloc = true
    99      }
   100  
   101      restart {
   102        attempts = 5
   103        interval = "10m"
   104        delay    = "15s"
   105        mode     = "delay"
   106      }
   107  
   108      reschedule {
   109        attempts = 5
   110        interval = "12h"
   111      }
   112  
   113      ephemeral_disk {
   114        sticky = true
   115        size   = 150
   116      }
   117  
   118      update {
   119        max_parallel      = 3
   120        health_check      = "checks"
   121        min_healthy_time  = "1s"
   122        healthy_deadline  = "1m"
   123        progress_deadline = "1m"
   124        auto_revert       = false
   125        auto_promote      = false
   126        canary            = 2
   127      }
   128  
   129      migrate {
   130        max_parallel     = 2
   131        health_check     = "task_states"
   132        min_healthy_time = "11s"
   133        healthy_deadline = "11m"
   134      }
   135  
   136      affinity {
   137        attribute = "${node.datacenter}"
   138        value     = "dc2"
   139        operator  = "="
   140        weight    = 100
   141      }
   142  
   143      spread {
   144        attribute = "${node.datacenter}"
   145        weight    = 50
   146  
   147        target "dc1" {
   148          percent = 50
   149        }
   150  
   151        target "dc2" {
   152          percent = 25
   153        }
   154  
   155        target "dc3" {
   156          percent = 25
   157        }
   158      }
   159  
   160      stop_after_client_disconnect = "120s"
   161      max_client_disconnect        = "120h"
   162  
   163      task "binstore" {
   164        driver = "docker"
   165        user   = "bob"
   166        leader = true
   167        kind   = "connect-proxy:test"
   168  
   169        affinity {
   170          attribute = "${meta.foo}"
   171          value     = "a,b,c"
   172          operator  = "set_contains"
   173          weight    = 25
   174        }
   175  
   176        config {
   177          image = "hashicorp/binstore"
   178  
   179          labels {
   180            FOO = "bar"
   181          }
   182        }
   183  
   184        volume_mount {
   185          volume      = "foo"
   186          destination = "/mnt/foo"
   187        }
   188  
   189        restart {
   190          attempts = 10
   191        }
   192  
   193        logs {
   194          max_files     = 14
   195          max_file_size = 101
   196        }
   197  
   198        env {
   199          HELLO = "world"
   200          LOREM = "ipsum"
   201        }
   202  
   203        service {
   204          meta {
   205            abc = "123"
   206          }
   207  
   208  
   209          canary_meta {
   210            canary = "boom"
   211          }
   212  
   213          tags        = ["foo", "bar"]
   214          canary_tags = ["canary", "bam"]
   215          port        = "http"
   216  
   217          check {
   218            name         = "check-name"
   219            type         = "tcp"
   220            interval     = "10s"
   221            timeout      = "2s"
   222            port         = "admin"
   223            grpc_service = "foo.Bar"
   224            grpc_use_tls = true
   225  
   226            check_restart {
   227              limit           = 3
   228              grace           = "10s"
   229              ignore_warnings = true
   230            }
   231          }
   232        }
   233  
   234        resources {
   235          cpu        = 500
   236          memory     = 128
   237          memory_max = 256
   238  
   239          network {
   240            mbits = "100"
   241  
   242            port "one" {
   243              static = 1
   244            }
   245  
   246            port "two" {
   247              static = 2
   248            }
   249  
   250            port "three" {
   251              static = 3
   252            }
   253  
   254            port "http" {}
   255  
   256            port "https" {}
   257  
   258            port "admin" {}
   259          }
   260  
   261          device "nvidia/gpu" {
   262            count = 10
   263  
   264            constraint {
   265              attribute = "${device.attr.memory}"
   266              value     = "2GB"
   267              operator  = ">"
   268            }
   269  
   270            affinity {
   271              attribute = "${device.model}"
   272              value     = "1080ti"
   273              weight    = 50
   274            }
   275          }
   276  
   277          device "intel/gpu" {}
   278        }
   279  
   280        kill_timeout = "22s"
   281  
   282        shutdown_delay = "11s"
   283  
   284        artifact {
   285          source = "http://foo.com/artifact"
   286  
   287          options {
   288            checksum = "md5:b8a4f3f72ecab0510a6a31e997461c5f"
   289          }
   290        }
   291  
   292        artifact {
   293          source      = "http://bar.com/artifact"
   294          destination = "test/foo/"
   295          mode        = "file"
   296  
   297          options {
   298            checksum = "md5:ff1cc0d3432dad54d607c1505fb7245c"
   299          }
   300        }
   301  
   302        vault {
   303          namespace = "ns1"
   304          policies  = ["foo", "bar"]
   305        }
   306  
   307        template {
   308          source               = "foo"
   309          destination          = "foo"
   310          change_mode          = "foo"
   311          change_signal        = "foo"
   312          splay                = "10s"
   313          env                  = true
   314          vault_grace          = "33s"
   315          error_on_missing_key = true
   316        }
   317  
   318        template {
   319          source      = "bar"
   320          destination = "bar"
   321          change_mode = "script"
   322          change_script {
   323            command       = "/bin/foo"
   324            args          = ["-debug", "-verbose"]
   325            timeout       = "5s"
   326            fail_on_error = false
   327          }
   328          perms           = "777"
   329          uid             = 1001
   330          gid             = 20
   331          left_delimiter  = "--"
   332          right_delimiter = "__"
   333        }
   334      }
   335  
   336      task "storagelocker" {
   337        driver = "docker"
   338  
   339        lifecycle {
   340          hook    = "prestart"
   341          sidecar = true
   342        }
   343  
   344        config {
   345          image = "hashicorp/storagelocker"
   346        }
   347  
   348        resources {
   349          cpu    = 500
   350          memory = 128
   351        }
   352  
   353        constraint {
   354          attribute = "kernel.arch"
   355          value     = "amd64"
   356        }
   357  
   358        vault {
   359          policies      = ["foo", "bar"]
   360          env           = false
   361          change_mode   = "signal"
   362          change_signal = "SIGUSR1"
   363        }
   364      }
   365  
   366      constraint {
   367        attribute = "kernel.os"
   368        value     = "linux"
   369      }
   370  
   371      meta {
   372        elb_mode     = "tcp"
   373        elb_interval = 10
   374        elb_checks   = 3
   375      }
   376    }
   377  }