-
Notifications
You must be signed in to change notification settings - Fork 0
/
1-deployment.tf
90 lines (75 loc) · 2.52 KB
/
1-deployment.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
resource "kubernetes_deployment" "deployment" {
wait_for_rollout = false
metadata {
name = var.settings.name
namespace = var.settings.namespace
labels = {
app = var.settings.type
}
}
spec {
replicas = var.settings.resources.replicas
strategy {
type = "RollingUpdate"
rolling_update {
max_surge = 1
max_unavailable = 1
}
}
selector {
match_labels = {
app = var.settings.name
type = var.settings.type
}
}
template {
metadata {
name = var.settings.name
labels = {
app = var.settings.name
type = var.settings.type
}
}
spec {
termination_grace_period_seconds = 0
# node_selector = {
# "kubernetes.civo.com/civo-node-pool" = "services"
# }
image_pull_secrets {
name = "ghcr"
}
container {
name = var.settings.name
image = "ghcr.io/convictionsai/${var.settings.name}:${var.settings.version}"
resources {
requests = {
cpu = var.settings.resources.requests.cpu
memory = var.settings.resources.requests.memory
}
limits = {
cpu = var.settings.resources.limits.cpu
memory = var.settings.resources.limits.memory
}
}
env {
name = "PORT"
value = var.settings.networking.ports[ 0 ].port
}
dynamic "port" {
for_each = var.settings.networking.ports
content {
container_port = port.value.port
}
}
dynamic "env" {
for_each = var.settings.env
content {
name = env.key
value = env.value
}
}
}
}
}
}
}