github.com/hernad/nomad@v1.6.112/e2e/nodedrain/input/drain_killtimeout.nomad (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  job "drain_killtimeout" {
     5  
     6    constraint {
     7      attribute = "${attr.kernel.name}"
     8      value     = "linux"
     9    }
    10  
    11    group "group" {
    12  
    13      task "task" {
    14        driver = "docker"
    15  
    16        kill_timeout = "30s" # matches the agent's max_kill_timeout
    17  
    18        config {
    19          image   = "busybox:1"
    20          command = "/bin/sh"
    21          args    = ["local/script.sh"]
    22        }
    23  
    24        # this job traps SIGINT so that we can assert that we've forced the drain
    25        # to wait until the client status has been updated
    26        template {
    27          data = <<EOF
    28  #!/bin/sh
    29  trap 'sleep 60' 2
    30  sleep 600
    31  EOF
    32  
    33          destination = "local/script.sh"
    34          change_mode = "noop"
    35        }
    36  
    37        resources {
    38          cpu    = 256
    39          memory = 128
    40        }
    41      }
    42    }
    43  }