-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathvariables.tf
347 lines (304 loc) · 9.11 KB
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
variable "gcp_project_id" {
type = string
description = "GCP project ID"
}
variable "helm_install_timeout" {
type = number
default = 600
description = "Time in seconds to wait for any individual kubernetes operation (like Jobs for hooks)"
}
variable "cluster_name" {
type = string
default = "elasticsearch-cluster"
description = "Elasticsearch cluster name and release name"
}
variable "node_suffix" {
type = string
default = ""
description = "Suffix that will be added to the name of this instance"
}
variable "node_group" {
type = string
default = ""
description = "This is the name that will be used for each group of nodes in the cluster (values: client, master, node). In case of only one node, leave empty."
}
variable "protocol" {
type = string
default = "http"
description = "The protocol that will be used for the readinessProbe. Change this to `https` if you have `xpack.security.http.ssl.enabled` set"
}
variable "http_port" {
type = string
default = "9200"
description = "The http port that Kubernetes will use for the healthchecks and the service. If you change this you will also need to set http.port in extraEnvs"
}
variable "common_annotations" {
type = map(string)
default = {}
description = "Common annotations for all the resources"
}
variable "pod_annotations" {
type = map(string)
default = {}
description = "Configurable annotations applied to all Elasticsearch pods"
}
variable "roles" {
type = object({
master = bool
data = bool
ingest = bool
})
default = {
"master" = null
"data" = null
"ingest" = null
}
description = "A hash map with the specific roles for the node group"
}
variable "image_pull_secrets" {
type = list(string)
description = "Image Pull Secrets"
default = []
}
variable "image" {
type = string
description = "Elasticsearch image"
default = ""
}
variable "es_version" {
type = string
description = "Elasticsearch version"
}
variable "namespace" {
type = string
description = "Namespace in which service will be deployed"
}
variable "replicas" {
type = number
default = 0
description = "Kubernetes replica count for the statefulset (i.e. how many pods)"
}
variable "master_eligible_nodes" {
type = number
default = 3
description = "Number of master eligible nodes used to calculate minimumMasterNodes"
}
variable "es_config" {
type = map(string)
default = {
"elasticsearch\\.yml" : <<EOT
xpack.license.self_generated.type: basic
xpack.security.enabled: false
EOT
}
description = "Allows you to add any config files in `/usr/share/elasticsearch/config/` such as `elasticsearch.yml` and `log4j2.properties`. See [values.yaml](https://github.com/elastic/helm-charts/tree/master/elasticsearch/values.yaml) for an example of the formatting"
}
variable "termination_grace_period" {
type = number
default = 120
description = "The terminationGracePeriod in seconds used when trying to stop the pod"
}
variable "es_java_opts" {
type = string
default = "-Xmx1g -Xms1g"
description = "Java options for Elasticsearch. This is where you should configure the jvm heap size. Can be around half of requests memory."
}
variable "storage_class_name" {
type = string
default = "ssd"
description = "Storage class name"
}
variable "storage_size" {
type = string
default = "1Gi"
description = "Storage size of the storageClassName"
}
variable "resources" {
type = object({
requests = object({
cpu = string
memory = string
})
limits = object({
cpu = string
memory = string
})
})
default = {
requests = {
cpu = "400m"
memory = "3Gi"
}
limits = {
cpu = "1000m"
memory = "3Gi"
}
}
description = "Allows you to set the resources for the statefulset"
}
variable "ingress" {
type = object({
enabled = bool
hosts = list(object({
host = string
path = string
port = string
}))
annotations = map(string)
})
default = {
enabled = false
hosts = [
{
host = ""
path = "/"
port = 5601
}
]
annotations = {}
}
description = "Configurable ingress to expose the Elasticsearch service"
}
variable "extra_service_ports" {
type = object({
ports = list(object({
name = string
port = string
node_port = string
target_port = string
}))
})
default = {
ports = []
}
description = "Configurable service to expose the Elasticsearch service"
}
variable "extra_configs" {
type = list(object({
name = string
path = string
config = string
}))
default = []
description = "Additional config maps"
}
variable "extra_volumes" {
type = string
default = ""
description = "Templatable string of additional volumes to be passsed to the tpl function"
}
variable "extra_containers" {
type = string
default = ""
description = "Templatable string of additional containers to be passed to the tpl function"
}
variable "keystore" {
type = list(string)
default = []
description = "Allows you map Kubernetes secrets into the keystore."
}
variable "tolerations" {
type = list(object({
key = string
operator = string
value = string
effect = string
}))
default = []
}
variable "node_selector" {
type = map(string)
default = {}
}
locals {
default_replicas = {
"client" = 2
"master" = 3
"data" = 3
}
default_roles = {
"" = {
"master" = true
"data" = true
"ingest" = false
}
"client" = {
"master" = false
"data" = false
"ingest" = false
}
"master" = {
"master" = true
"data" = false
"ingest" = false
}
"data" = {
"master" = false
"data" = true
"ingest" = true
}
}
node_suffix = var.node_suffix != "" ? "-${var.node_suffix}" : ""
full_name_override = var.node_group != "" ? "${var.cluster_name}-${var.node_group}${local.node_suffix}" : "${var.cluster_name}${local.node_suffix}"
master_service = var.node_group != "" ? "${var.cluster_name}-master" : ""
replicas = var.replicas != 0 ? var.replicas : local.default_replicas[var.node_group]
minimum_master_nodes = floor((var.master_eligible_nodes / 2) + 1)
roles = {
"master" = coalesce(var.roles["master"], local.default_roles[var.node_group]["master"])
"data" = coalesce(var.roles["data"], local.default_roles[var.node_group]["data"])
"ingest" = coalesce(var.roles["ingest"], local.default_roles[var.node_group]["ingest"])
}
persistance_enabled = var.node_group != "client" ? true : false
pod_annotations = merge({
"ad\\.datadoghq\\.com/elasticsearch\\.check_names" : "[\"elastic\"]",
"ad\\.datadoghq\\.com/elasticsearch\\.init_configs" : "[{}]",
"ad\\.datadoghq\\.com/elasticsearch\\.instances" : "[{\"url\": \"http://%%host%%:9200\"\\, \"cluster_stats\": \"true\"\\, \"index_stats\": \"true\"\\, \"pending_task_stats\": \"true\"}]",
"ad\\.datadoghq\\.com/elasticsearch\\.tags" : " {\"gcp_project_id\": \"${var.gcp_project_id}\"\\, \"es_cluster_name\": \"${var.cluster_name}\"} ",
}, var.pod_annotations)
}
/// Monitoring variables
variable "es_monitoring" {
type = bool
default = false
description = "Enables infrastructure-level monitoring for your ES cluster - default value is false"
}
variable "monitoring_slack_alerts_channel" {
type = string
default = "@slack-alerts"
description = "Slack #alerts channel for reporting alerts about the underlying infrastructure."
}
variable "monitoring_pager_duty_platform_infra" {
type = string
default = "@pagerduty-DDDevops"
description = "Platform Infra 1st line PagerDuty."
}
variable "monitoring_pager_duty_working_hours" {
type = string
default = "@pagerduty-DDDevopsLow"
description = "Platform PagerDuty escalation policy with core time response only."
}
variable "es_health_monitoring" {
type = bool
default = false
description = "Enable monitoring of ES cluster health, with notifications sent to monitoring_slack_additional_channel and monitoring_pager_duty_team_specific"
}
variable "notify_infra_about_health" {
type = bool
default = false
description = "Send notification about ES cluster health to infra platform's channels and PD too"
}
variable "monitoring_slack_additional_channel" {
type = string
default = ""
description = "Optional additional slack channel to report warnings to. If PagerDuty is not specified, alerts will be sent to it too. You can get integration slack channel name from DataDog UI/Integrations/Integrations/Slack/Configure."
}
variable "monitoring_pager_duty_team_specific" {
type = string
default = ""
description = "Team specific PagerDuty escalation plicy."
}
variable "create_snapshot_bucket" {
type = bool
default = false
description = "Create a GCS bucket for storing snapshots"
}