238003bb003e2b9dfc42c6da70ee80f733157a8f
[csit.git] / terraform-ci-infra / 1n_nmd / minio / conf / nomad / mc.hcl
1 job "${job_name}" {
2   # The "region" parameter specifies the region in which to execute the job.
3   # If omitted, this inherits the default region name of "global".
4   # region = "global"
5   #
6   # The "datacenters" parameter specifies the list of datacenters which should
7   # be considered when placing this task. This must be provided.
8   datacenters = "${datacenters}"
9
10   # The "type" parameter controls the type of job, which impacts the scheduler's
11   # decision on placement. This configuration is optional and defaults to
12   # "service". For a full list of job types and their differences, please see
13   # the online documentation.
14   #
15   # For more information, please see the online documentation at:
16   #
17   #     https://www.nomadproject.io/docs/jobspec/schedulers.html
18   #
19   type        = "batch"
20
21   # The "group" stanza defines a series of tasks that should be co-located on
22   # the same Nomad client. Any task within a group will be placed on the same
23   # client.
24   #
25   # For more information and examples on the "group" stanza, please see
26   # the online documentation at:
27   #
28   #     https://www.nomadproject.io/docs/job-specification/group.html
29   #
30   group "prod-group1-mc" {
31     task "prod-task1-create-buckets" {
32       # The "driver" parameter specifies the task driver that should be used to
33       # run the task.
34       driver        = "docker"
35
36       %{ if use_vault_provider }
37       vault {
38         policies    = "${vault_kv_policy_name}"
39       }
40      %{ endif }
41
42       # The "config" stanza specifies the driver configuration, which is passed
43       # directly to the driver to start the task. The details of configurations
44       # are specific to each driver, so please see specific driver
45       # documentation for more information.
46       config {
47         image       = "${image}"
48         entrypoint  = [
49           "/bin/sh",
50           "-c",
51           "${command}"
52         ]
53         dns_servers  = [ "$${attr.unique.network.ip-address}" ]
54         privileged   = false
55       }
56
57       # The env stanza configures a list of environment variables to populate
58       # the task's environment before starting.
59       env {
60         %{ if use_vault_provider }
61         {{ with secret "${vault_kv_path}" }}
62         MINIO_ACCESS_KEY = "{{ .Data.data.${vault_kv_field_access_key} }}"
63         MINIO_SECRET_KEY = "{{ .Data.data.${vault_kv_field_secret_key} }}"
64         {{ end }}
65         %{ else }
66         MINIO_ACCESS_KEY = "${access_key}"
67         MINIO_SECRET_KEY = "${secret_key}"
68         %{ endif }
69         ${ envs }
70       }
71     }
72   }
73 }