Infra: Do not strict check keys in Ansible
[csit.git] / terraform-ci-infra / 1n_nmd / minio / conf / nomad / minio.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   #     https://www.nomadproject.io/docs/jobspec/schedulers
16   #
17   type        = "service"
18
19   update {
20     # The "max_parallel" parameter specifies the maximum number of updates to
21     # perform in parallel. In this case, this specifies to update a single task
22     # at a time.
23     max_parallel      = 1
24
25     health_check      = "checks"
26
27     # The "min_healthy_time" parameter specifies the minimum time the allocation
28     # must be in the healthy state before it is marked as healthy and unblocks
29     # further allocations from being updated.
30     min_healthy_time  = "10s"
31
32     # The "healthy_deadline" parameter specifies the deadline in which the
33     # allocation must be marked as healthy after which the allocation is
34     # automatically transitioned to unhealthy. Transitioning to unhealthy will
35     # fail the deployment and potentially roll back the job if "auto_revert" is
36     # set to true.
37     healthy_deadline  = "3m"
38
39     # The "progress_deadline" parameter specifies the deadline in which an
40     # allocation must be marked as healthy. The deadline begins when the first
41     # allocation for the deployment is created and is reset whenever an allocation
42     # as part of the deployment transitions to a healthy state. If no allocation
43     # transitions to the healthy state before the progress deadline, the
44     # deployment is marked as failed.
45     progress_deadline = "10m"
46
47 %{ if use_canary }
48     # The "canary" parameter specifies that changes to the job that would result
49     # in destructive updates should create the specified number of canaries
50     # without stopping any previous allocations. Once the operator determines the
51     # canaries are healthy, they can be promoted which unblocks a rolling update
52     # of the remaining allocations at a rate of "max_parallel".
53     #
54     # Further, setting "canary" equal to the count of the task group allows
55     # blue/green deployments. When the job is updated, a full set of the new
56     # version is deployed and upon promotion the old version is stopped.
57     canary            = 1
58
59     # Specifies if the job should auto-promote to the canary version when all
60     # canaries become healthy during a deployment. Defaults to false which means
61     # canaries must be manually updated with the nomad deployment promote
62     # command.
63     auto_promote      = true
64
65     # The "auto_revert" parameter specifies if the job should auto-revert to the
66     # last stable job on deployment failure. A job is marked as stable if all the
67     # allocations as part of its deployment were marked healthy.
68     auto_revert       = true
69 %{ endif }
70   }
71
72   # All groups in this job should be scheduled on different hosts.
73   constraint {
74     operator          = "distinct_hosts"
75     value             = "true"
76   }
77
78   # The "group" stanza defines a series of tasks that should be co-located on
79   # the same Nomad client. Any task within a group will be placed on the same
80   # client.
81   #
82   #     https://www.nomadproject.io/docs/job-specification/group
83   #
84   group "prod-group1-minio" {
85     # The "count" parameter specifies the number of the task groups that should
86     # be running under this group. This value must be non-negative and defaults
87     # to 1.
88     count                = ${group_count}
89
90     # https://www.nomadproject.io/docs/job-specification/volume
91     %{ if use_host_volume }
92     volume "prod-volume1-minio" {
93       type               = "host"
94       read_only          = false
95       source             = "${host_volume}"
96     }
97     %{ endif }
98
99     # The restart stanza configures a tasks's behavior on task failure. Restarts
100     # happen on the client that is running the task.
101     #
102     # https://www.nomadproject.io/docs/job-specification/restart
103     #
104     restart {
105       interval           = "30m"
106       attempts           = 40
107       delay              = "15s"
108       mode               = "delay"
109     }
110
111     # The "task" stanza creates an individual unit of work, such as a Docker
112     # container, web application, or batch processing.
113     #
114     #     https://www.nomadproject.io/docs/job-specification/task.html
115     #
116     task "prod-task1-minio" {
117       # The "driver" parameter specifies the task driver that should be used to
118       # run the task.
119       driver             = "docker"
120
121     %{ if use_host_volume }
122       volume_mount {
123         volume           = "prod-volume1-minio"
124         destination      = "${data_dir}"
125         read_only        = false
126       }
127     %{ endif }
128
129     %{ if use_vault_provider }
130       vault {
131         policies         = "${vault_kv_policy_name}"
132       }
133     %{ endif }
134
135       # The "config" stanza specifies the driver configuration, which is passed
136       # directly to the driver to start the task. The details of configurations
137       # are specific to each driver, so please see specific driver
138       # documentation for more information.
139       config {
140         image            = "${image}"
141         dns_servers      = [ "172.17.0.1" ]
142         network_mode     = "host"
143         command          = "server"
144         args             = [ "${host}:${port}${data_dir}" ]
145         port_map {
146           http           = ${port}
147         }
148         privileged       = false
149       }
150
151       # The env stanza configures a list of environment variables to populate
152       # the task's environment before starting.
153       env {
154 %{ if use_vault_provider }
155 {{ with secret "${vault_kv_path}" }}
156         MINIO_ACCESS_KEY = "{{ .Data.data.${vault_kv_field_access_key} }}"
157         MINIO_SECRET_KEY = "{{ .Data.data.${vault_kv_field_secret_key} }}"
158 {{ end }}
159 %{ else }
160         MINIO_ACCESS_KEY = "${access_key}"
161         MINIO_SECRET_KEY = "${secret_key}"
162 %{ endif }
163         ${ envs }
164       }
165
166       # The service stanza instructs Nomad to register a service with Consul.
167       #
168       #     https://www.nomadproject.io/docs/job-specification/service
169       #
170       service {
171         name       = "${service_name}"
172         port       = "http"
173         tags       = [ "storage$${NOMAD_ALLOC_INDEX}" ]
174         check {
175           name     = "Min.io Server HTTP Check Live"
176           type     = "http"
177           port     = "http"
178           protocol = "http"
179           method   = "GET"
180           path     = "/minio/health/live"
181           interval = "10s"
182           timeout  = "2s"
183         }
184         check {
185           name     = "Min.io Server HTTP Check Ready"
186           type     = "http"
187           port     = "http"
188           protocol = "http"
189           method   = "GET"
190           path     = "/minio/health/ready"
191           interval = "10s"
192           timeout  = "2s"
193         }
194       }
195
196       # The "resources" stanza describes the requirements a task needs to
197       # execute. Resource requirements include memory, network, cpu, and more.
198       # This ensures the task will execute on a machine that contains enough
199       # resource capacity.
200       #
201       #     https://www.nomadproject.io/docs/job-specification/resources
202       #
203       resources {
204         cpu        = ${cpu}
205         memory     = ${memory}
206         # The network stanza specifies the networking requirements for the task
207         # group, including the network mode and port allocations. When scheduling
208         # jobs in Nomad they are provisioned across your fleet of machines along
209         # with other jobs and services. Because you don't know in advance what host
210         # your job will be provisioned on, Nomad will provide your tasks with
211         # network configuration when they start up.
212         #
213         #     https://www.nomadproject.io/docs/job-specification/network
214         #
215         network {
216           port "http" {
217             static = ${port}
218           }
219         }
220       }
221     }
222   }
223 }