-
Notifications
You must be signed in to change notification settings - Fork 1
/
content_service.tf
135 lines (110 loc) · 2.96 KB
/
content_service.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
resource "kubernetes_deployment" "gits_content_service" {
depends_on = [helm_release.content_service_db, helm_release.dapr, helm_release.keel, kubernetes_secret.image_pull]
metadata {
name = "gits-content-service"
labels = {
app = "gits-content-service"
}
namespace = kubernetes_namespace.gits.metadata[0].name
annotations = {
"keel.sh/policy" = "force"
"keel.sh/match-tag" = "true"
"keel.sh/trigger" = "poll"
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "gits-content-service"
}
}
template {
metadata {
labels = {
app = "gits-content-service"
}
annotations = {
"dapr.io/enabled" = true
"dapr.io/app-id" = "content-service"
"dapr.io/app-port" = 4001
"dapr.io/http-port" = 4000
}
}
spec {
image_pull_secrets {
name = kubernetes_secret.image_pull.metadata[0].name
}
container {
image = "ghcr.io/it-rex-platform/content_service:latest"
image_pull_policy = "Always"
name = "gits-content-service"
resources {
limits = {
cpu = "0.5"
memory = "512Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
env {
name = "SPRING_DATASOURCE_URL"
value = "jdbc:postgresql://content-service-db-postgresql:5432/content-service"
}
env {
name = "SPRING_DATASOURCE_USERNAME"
value = "gits"
}
env {
name = "SPRING_DATASOURCE_PASSWORD"
value = random_password.content_service_db_pass.result
}
liveness_probe {
http_get {
path = "/actuator/health/liveness"
port = 4001
}
initial_delay_seconds = 30
period_seconds = 9
}
readiness_probe {
http_get {
path = "/actuator/health/readiness"
port = 4001
}
initial_delay_seconds = 30
period_seconds = 9
}
}
}
}
}
}
resource "random_password" "content_service_db_pass" {
length = 32
special = false
}
resource "helm_release" "content_service_db" {
name = "content-service-db"
repository = "oci://registry-1.docker.io/bitnamicharts"
chart = "postgresql"
namespace = kubernetes_namespace.gits.metadata[0].name
set {
name = "global.postgresql.auth.database"
value = "content-service"
}
set {
name = "postgres.auth.enablePostgresUser"
value = "false"
}
set {
name = "global.postgresql.auth.username"
value = "gits"
}
set {
name = "global.postgresql.auth.password"
value = random_password.content_service_db_pass.result
}
}