-
Notifications
You must be signed in to change notification settings - Fork 101
/
main.tf
230 lines (186 loc) · 5.72 KB
/
main.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
resource "kubernetes_namespace" "daskhub_namespace" {
metadata {
name = "daskhub"
}
}
module "dask-jupyterhub" {
source = "./modules/dask-jupyterhub"
namespace = kubernetes_namespace.daskhub_namespace.metadata[0].name
}
resource "kubernetes_service_account" "daskhub-sa" {
metadata {
name = "daskhub-sa"
namespace = kubernetes_namespace.daskhub_namespace.metadata[0].name
}
}
resource "kubernetes_role" "daskhub-role" {
metadata {
name = "daskhub-role"
namespace = kubernetes_namespace.daskhub_namespace.metadata[0].name
}
rule {
api_groups = [""]
resources = ["pods"]
verbs = ["get", "list", "watch", "create", "delete"]
}
rule {
api_groups = [""]
resources = ["pods/logs"]
verbs = ["get", "list"]
}
rule {
api_groups = [""]
resources = ["services"]
verbs = ["get", "list", "watch", "create", "delete"]
}
rule {
api_groups = ["policy"]
resources = ["poddisruptionbudgets"]
verbs = ["get", "list", "watch", "create", "delete"]
}
}
resource "kubernetes_role_binding" "daskhub-rb" {
metadata {
name = "daskhub-rb"
}
role_ref {
api_group = "rbac.authorization.k8s.io"
kind = "Role"
name = "daskhub-role"
}
subject {
kind = "ServiceAccount"
name = "daskhub-sa"
}
}
resource "kubernetes_namespace" "mlflow_namespace" {
metadata {
name = var.mlflow_namespace
}
}
module "postgres" {
source = "./modules/postgres"
namespace = kubernetes_namespace.mlflow_namespace.metadata[0].name
db_username = var.db_username
db_password = var.db_password
database_name = var.database_name
}
module "mlflow" {
source = "./modules/mlflow"
namespace = kubernetes_namespace.mlflow_namespace.metadata[0].name
db_host = module.postgres.db_host
db_username = var.db_username
db_password = var.db_password
default_artifact_root = var.mlflow_artifact_root
docker_private_repo = var.mlflow_docker_private_repo
docker_registry_server = var.mlflow_docker_registry_server
docker_auth_key = var.mlflow_docker_auth_key
service_type = var.mlflow_service_type
}
resource "kubernetes_namespace" "prefect_namespace" {
metadata {
name = var.prefect_namespace
}
}
module "prefect-server" {
source = "./modules/prefect-server"
namespace = kubernetes_namespace.prefect_namespace.metadata[0].name
parent_module_name = basename(abspath(path.module))
service_type = var.prefect_service_type
agent_prefect_labels = var.prefect_agent_labels
service_account_name = var.prefect_service_account_name
seldon_manager_cluster_role_name = var.install_seldon ? "seldon-manager-role-${var.seldon_namespace}" : ""
feast_spark_operator_cluster_role_name = var.install_feast ? var.feast_spark_operator_cluster_role_name : ""
create_tenant_enabled = var.prefect_create_tenant_enabled
graphql_url = var.install_locally ? "http://localhost:4200/graphql" : "${var.protocol}://prefect.${var.hostname}/graphql/"
}
resource "kubernetes_namespace" "dask_namespace" {
metadata {
name = var.dask_namespace
}
}
module "dask" {
source = "./modules/dask"
namespace = kubernetes_namespace.dask_namespace.metadata[0].name
worker_image_pull_secret = [
{
name = "regcred"
}
]
worker_environment_variables = [
{
name = "EXTRA_PIP_PACKAGES"
value = "prefect==0.14.1 aiohttp --upgrade"
}
]
}
resource "kubernetes_namespace" "feast_namespace" {
count = var.install_feast ? 1 : 0
metadata {
name = var.feast_namespace
}
}
module "feast" {
count = var.install_feast ? 1 : 0
source = "./modules/feast"
namespace = kubernetes_namespace.feast_namespace[0].metadata[0].name
feast_core_enabled = true
feast_online_serving_enabled = true
feast_posgresql_enabled = true
feast_redis_enabled = true
feast_postgresql_password = var.feast_postgresql_password
feast_spark_operator_cluster_role_name = var.feast_spark_operator_cluster_role_name
}
resource "kubernetes_namespace" "seldon_namespace" {
count = var.install_seldon ? 1 : 0
metadata {
name = var.seldon_namespace
}
}
module "seldon" {
count = var.install_seldon ? 1 : 0
source = "./modules/seldon"
namespace = kubernetes_namespace.seldon_namespace[0].metadata[0].name
}
resource "kubernetes_namespace" "ambassador_namespace" {
count = var.ambassador_enabled ? 1 : 0
metadata {
name = var.ambassador_namespace
}
}
module "ambassador" {
count = var.ambassador_enabled ? 1 : 0
source = "./modules/ambassador"
namespace = var.ambassador_namespace
aws = var.aws
tls_certificate_arn = var.tls_certificate_arn
hostname = var.hostname
tls = var.protocol == "https" ? true : false
enable_ory_authentication = var.enable_ory_authentication
}
resource "kubernetes_namespace" "ory_namespace" {
count = var.enable_ory_authentication ? 1 : 0
metadata {
name = var.ory_namespace
}
}
module "ory" {
count = var.enable_ory_authentication ? 1 : 0
source = "./modules/ory"
namespace = kubernetes_namespace.ory_namespace[0].metadata[0].name
cookie_secret = var.ory_kratos_cookie_secret
kratos_db_password = var.ory_kratos_db_password
oauth2_providers = var.oauth2_providers
hostname = var.hostname
protocol = var.protocol
enable_registration = var.enable_registration_page
enable_password_recovery = var.enable_password_recovery
enable_verification = var.enable_verification
smtp_connection_uri = var.smtp_connection_uri
smtp_from_address = var.smtp_from_address
access_rules_path = var.access_rules_path
}
module "k8s_tools" {
source = "./modules/k8s_tools"
install_metrics_server = var.install_metrics_server
}