-
Notifications
You must be signed in to change notification settings - Fork 1
/
skill_level_service.tf
147 lines (118 loc) · 3.32 KB
/
skill_level_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
136
137
138
139
140
141
142
143
144
145
resource "kubernetes_deployment" "gits_skilllevel_service" {
depends_on = [helm_release.skilllevel_service_db, helm_release.dapr, helm_release.keel, kubernetes_secret.image_pull]
metadata {
name = "gits-skilllevel-service"
labels = {
app = "gits-skilllevel-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-skilllevel-service"
}
}
template {
metadata {
labels = {
app = "gits-skilllevel-service"
}
annotations = {
"dapr.io/enabled" = true
"dapr.io/app-id" = "skilllevel-service"
"dapr.io/app-port" = 8001
"dapr.io/http-port" = 8000
}
}
spec {
image_pull_secrets {
name = kubernetes_secret.image_pull.metadata[0].name
}
container {
image = "ghcr.io/it-rex-platform/skilllevel_service:latest"
image_pull_policy = "Always"
name = "gits-skilllevel-service"
resources {
limits = {
cpu = "0.5"
memory = "512Mi"
}
requests = {
cpu = "50m"
memory = "50Mi"
}
}
env {
name = "SPRING_DATASOURCE_URL"
value = "jdbc:postgresql://skilllevel-service-db-postgresql:5432/skilllevel-service"
}
env {
name = "SPRING_DATASOURCE_USERNAME"
value = "gits"
}
env {
name = "SPRING_DATASOURCE_PASSWORD"
value = random_password.skilllevel_service_db_pass.result
}
env {
name = "COURSE_SERVICE_URL"
value = "http://localhost:3500/v1.0/invoke/course-service/method/graphql"
}
env {
name = "CONTENT_SERVICE_URL"
value = "http://localhost:3500/v1.0/invoke/content-service/method/graphql"
}
liveness_probe {
http_get {
path = "/actuator/health/liveness"
port = 8001
}
initial_delay_seconds = 30
period_seconds = 9
}
readiness_probe {
http_get {
path = "/actuator/health/readiness"
port = 8001
}
initial_delay_seconds = 30
period_seconds = 9
}
}
}
}
}
}
resource "random_password" "skilllevel_service_db_pass" {
length = 32
special = false
}
resource "helm_release" "skilllevel_service_db" {
name = "skilllevel-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 = "skilllevel-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.skilllevel_service_db_pass.result
}
}