-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcoordinator.tf
156 lines (141 loc) · 3.71 KB
/
coordinator.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
resource "kubernetes_service" "coordinator_cs" {
metadata {
name = "coordinator-cs"
namespace = var.namespace
labels = local.coordinator_labels
}
spec {
port {
name = "coordinator"
port = 8081
}
selector = local.coordinator_labels
}
}
resource "kubernetes_deployment" "coordinator" {
metadata {
name = "coordinator"
namespace = var.namespace
labels = local.coordinator_labels
}
spec {
replicas = var.coordinator_replicas
selector {
match_labels = local.coordinator_labels
}
template {
metadata {
labels = local.coordinator_labels
}
spec {
container {
name = "coordinator"
image = local.druid_image
image_pull_policy = "Always"
port {
name = "coordinator"
container_port = 8081
}
env_from {
config_map_ref {
name = "druid-common-config"
}
}
env_from {
secret_ref {
name = "druid-secret"
}
}
env {
name = "DRUID_HOST"
value_from {
field_ref {
field_path = "status.podIP"
}
}
}
dynamic "env" {
for_each = local.coordinator_env_variables
content {
name = env.value.name
value = env.value.value
}
}
resources {
limits {
cpu = var.coordinator_limits_cpu
memory = var.coordinator_limits_memory
}
requests {
cpu = var.coordinator_requests_cpu
memory = var.coordinator_requests_memory
}
}
volume_mount {
name = "data"
mount_path = "/var/druid/"
}
liveness_probe {
http_get {
path = "/status/health"
port = "8081"
}
initial_delay_seconds = 60
}
readiness_probe {
http_get {
path = "/status/health"
port = "8081"
}
initial_delay_seconds = 60
}
security_context {
capabilities {
add = ["IPC_LOCK"]
}
}
}
volume {
name = "druid-secret"
secret {
secret_name = "druid-secret"
}
}
volume {
name = "data"
}
dynamic "toleration" {
for_each = [for t in var.coordinator_tolerations : {
effect = t.effect
key = t.key
operator = t.operator
toleration_seconds = t.toleration_seconds
value = t.value
}]
content {
effect = toleration.value.effect
key = toleration.value.key
operator = toleration.value.operator
toleration_seconds = toleration.value.toleration_seconds
value = toleration.value.value
}
}
affinity {
pod_anti_affinity {
required_during_scheduling_ignored_during_execution {
label_selector {
match_expressions {
key = "app"
operator = "In"
values = ["coordinator"]
}
}
topology_key = "kubernetes.io/hostname"
}
}
}
termination_grace_period_seconds = 1800
}
}
}
}