github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/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  
    83        mount_options {
    84          fs_type = "ext4"
    85        }
    86      }
    87  
    88      volume "baz" {
    89        type   = "csi"
    90        source = "bar-vol"
    91  
    92        mount_options {
    93          mount_flags = ["ro"]
    94        }
    95      }
    96  
    97      restart {
    98        attempts = 5
    99        interval = "10m"
   100        delay    = "15s"
   101        mode     = "delay"
   102      }
   103  
   104      reschedule {
   105        attempts = 5
   106        interval = "12h"
   107      }
   108  
   109      ephemeral_disk {
   110        sticky = true
   111        size   = 150
   112      }
   113  
   114      update {
   115        max_parallel      = 3
   116        health_check      = "checks"
   117        min_healthy_time  = "1s"
   118        healthy_deadline  = "1m"
   119        progress_deadline = "1m"
   120        auto_revert       = false
   121        auto_promote      = false
   122        canary            = 2
   123      }
   124  
   125      migrate {
   126        max_parallel     = 2
   127        health_check     = "task_states"
   128        min_healthy_time = "11s"
   129        healthy_deadline = "11m"
   130      }
   131  
   132      affinity {
   133        attribute = "${node.datacenter}"
   134        value     = "dc2"
   135        operator  = "="
   136        weight    = 100
   137      }
   138  
   139      spread {
   140        attribute = "${node.datacenter}"
   141        weight    = 50
   142  
   143        target "dc1" {
   144          percent = 50
   145        }
   146  
   147        target "dc2" {
   148          percent = 25
   149        }
   150  
   151        target "dc3" {
   152          percent = 25
   153        }
   154      }
   155  
   156      stop_after_client_disconnect = "120s"
   157  
   158      task "binstore" {
   159        driver = "docker"
   160        user   = "bob"
   161        leader = true
   162        kind   = "connect-proxy:test"
   163  
   164        affinity {
   165          attribute = "${meta.foo}"
   166          value     = "a,b,c"
   167          operator  = "set_contains"
   168          weight    = 25
   169        }
   170  
   171        config {
   172          image = "hashicorp/binstore"
   173  
   174          labels {
   175            FOO = "bar"
   176          }
   177        }
   178  
   179        volume_mount {
   180          volume      = "foo"
   181          destination = "/mnt/foo"
   182        }
   183  
   184        restart {
   185          attempts = 10
   186        }
   187  
   188        logs {
   189          max_files     = 14
   190          max_file_size = 101
   191        }
   192  
   193        env {
   194          HELLO = "world"
   195          LOREM = "ipsum"
   196        }
   197  
   198        service {
   199          meta {
   200            abc = "123"
   201          }
   202  
   203  
   204          canary_meta {
   205            canary = "boom"
   206          }
   207  
   208          tags        = ["foo", "bar"]
   209          canary_tags = ["canary", "bam"]
   210          port        = "http"
   211  
   212          check {
   213            name         = "check-name"
   214            type         = "tcp"
   215            interval     = "10s"
   216            timeout      = "2s"
   217            port         = "admin"
   218            grpc_service = "foo.Bar"
   219            grpc_use_tls = true
   220  
   221            check_restart {
   222              limit           = 3
   223              grace           = "10s"
   224              ignore_warnings = true
   225            }
   226          }
   227        }
   228  
   229        resources {
   230          cpu    = 500
   231          memory = 128
   232  
   233          network {
   234            mbits = "100"
   235  
   236            port "one" {
   237              static = 1
   238            }
   239  
   240            port "two" {
   241              static = 2
   242            }
   243  
   244            port "three" {
   245              static = 3
   246            }
   247  
   248            port "http" {}
   249  
   250            port "https" {}
   251  
   252            port "admin" {}
   253          }
   254  
   255          device "nvidia/gpu" {
   256            count = 10
   257  
   258            constraint {
   259              attribute = "${device.attr.memory}"
   260              value     = "2GB"
   261              operator  = ">"
   262            }
   263  
   264            affinity {
   265              attribute = "${device.model}"
   266              value     = "1080ti"
   267              weight    = 50
   268            }
   269          }
   270  
   271          device "intel/gpu" {}
   272        }
   273  
   274        kill_timeout = "22s"
   275  
   276        shutdown_delay = "11s"
   277  
   278        artifact {
   279          source = "http://foo.com/artifact"
   280  
   281          options {
   282            checksum = "md5:b8a4f3f72ecab0510a6a31e997461c5f"
   283          }
   284        }
   285  
   286        artifact {
   287          source      = "http://bar.com/artifact"
   288          destination = "test/foo/"
   289          mode        = "file"
   290  
   291          options {
   292            checksum = "md5:ff1cc0d3432dad54d607c1505fb7245c"
   293          }
   294        }
   295  
   296        vault {
   297          namespace = "ns1"
   298          policies  = ["foo", "bar"]
   299        }
   300  
   301        template {
   302          source        = "foo"
   303          destination   = "foo"
   304          change_mode   = "foo"
   305          change_signal = "foo"
   306          splay         = "10s"
   307          env           = true
   308          vault_grace   = "33s"
   309        }
   310  
   311        template {
   312          source          = "bar"
   313          destination     = "bar"
   314          perms           = "777"
   315          left_delimiter  = "--"
   316          right_delimiter = "__"
   317        }
   318      }
   319  
   320      task "storagelocker" {
   321        driver = "docker"
   322  
   323        lifecycle {
   324          hook    = "prestart"
   325          sidecar = true
   326        }
   327  
   328        config {
   329          image = "hashicorp/storagelocker"
   330        }
   331  
   332        resources {
   333          cpu    = 500
   334          memory = 128
   335        }
   336  
   337        constraint {
   338          attribute = "kernel.arch"
   339          value     = "amd64"
   340        }
   341  
   342        vault {
   343          policies      = ["foo", "bar"]
   344          env           = false
   345          change_mode   = "signal"
   346          change_signal = "SIGUSR1"
   347        }
   348      }
   349  
   350      constraint {
   351        attribute = "kernel.os"
   352        value     = "linux"
   353      }
   354  
   355      meta {
   356        elb_mode     = "tcp"
   357        elb_interval = 10
   358        elb_checks   = 3
   359      }
   360    }
   361  }