-
Notifications
You must be signed in to change notification settings - Fork 12
/
middlemanager.tf
163 lines (141 loc) · 3.72 KB
/
middlemanager.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
resource "kubernetes_service" "mm_cs" {
metadata {
name = "mm-cs"
namespace = var.namespace
labels = local.middlemanager_labels
}
spec {
port {
name = "mm"
port = 8084
}
selector = local.middlemanager_labels
}
}
resource "kubernetes_deployment" "middlemanager" {
metadata {
name = "middlemanager"
namespace = var.namespace
labels = local.middlemanager_labels
}
spec {
replicas = var.middlemanager_replicas
selector {
match_labels = local.middlemanager_labels
}
template {
metadata {
labels = local.middlemanager_labels
}
spec {
container {
name = "middlemanager"
image = local.druid_image
image_pull_policy = "Always"
port {
name = "middlemanager"
container_port = 8084
}
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.middlemanager_env_variables
content {
name = env.value.name
value = env.value.value
}
}
resources {
limits {
cpu = var.middlemanager_limits_cpu
memory = var.middlemanager_limits_memory
}
requests {
cpu = var.middlemanager_requests_cpu
memory = var.middlemanager_requests_memory
}
}
volume_mount {
name = "data"
mount_path = "/var/druid/"
}
liveness_probe {
http_get {
path = "/status/health"
port = "8084"
}
initial_delay_seconds = 60
}
readiness_probe {
http_get {
path = "/status/health"
port = "8084"
}
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.middlemanager_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 = ["middlemanager"]
}
}
topology_key = "kubernetes.io/hostname"
}
}
}
termination_grace_period_seconds = 1800
}
}
}
}