Skip to content

Commit 2520788

Browse files
authored
Merge pull request #62 from artefactory/dev
bump
2 parents ff131e8 + cde33cd commit 2520788

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1216
-423
lines changed

.github/workflows/conftest.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
on: push
2+
name: Conftest
3+
jobs:
4+
conftest:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@master
8+
- name: test
9+
uses: instrumenta/conftest-action@master
10+
with:
11+
files: tracking_server/Dockerfile

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@
22
.terraform
33
*.tfstate
44
*.tfstate.backup
5-
*.tfvars
5+
*.tfvars
6+
IaC/*/*.hcl
7+
IaC/*.hcl
8+
9+
#secrets
10+
secrets/
11+
12+
#python
13+
*/__pycache__/

IaC/main.tf

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
terraform {
1919
backend "gcs" {
2020
}
21-
required_version = "~> 0.13.2"
21+
required_version = "> 0.13.2"
2222
required_providers {
2323
google = "~> 3.13"
2424
}
@@ -36,29 +36,32 @@ resource "random_id" "artifacts_bucket_name_suffix" {
3636
byte_length = 5
3737
}
3838

39-
resource "random_password" "password" {
40-
length = 16
41-
}
42-
4339
module "network" {
44-
source = "./modules/network"
40+
source = "./modules/network"
4541
network_name = var.network_name
4642
}
4743

4844
module "mlflow" {
49-
source = "./modules/mlflow"
50-
artifacts_bucket_name = "${var.artifacts_bucket}-${random_id.artifacts_bucket_name_suffix.hex}"
51-
db_password_value = random_password.password.result
52-
server_docker_image = var.mlflow_docker_image
53-
project_id = var.project_id
45+
source = "./modules/mlflow"
46+
mlflow_server = var.mlflow_server
47+
artifacts_bucket_name = "${var.artifacts_bucket}-${random_id.artifacts_bucket_name_suffix.hex}"
48+
server_docker_image = var.mlflow_docker_image
49+
project_id = var.project_id
5450
consent_screen_support_email = var.consent_screen_support_email
55-
web_app_users = var.web_app_users
56-
network_self_link = module.network.network_self_link
57-
network_short_name = module.network.network_short_name
51+
web_app_users = var.web_app_users
52+
network_self_link = module.network.network_self_link
53+
network_short_name = module.network.network_short_name
54+
create_default_service = var.create_default_service == 1 ? true : false
55+
oauth_client_id = var.oauth_client_id
56+
oauth_client_secret = var.oauth_client_secret
57+
create_brand = var.create_brand
58+
brand_name = var.brand_name
5859
}
5960

6061
module "log_pusher" {
61-
source = "./modules/mlflow/log_pusher"
62-
project_id = var.project_id
63-
depends_on = [module.mlflow]
62+
source = "./modules/mlflow/log_pusher"
63+
app_id = module.mlflow.app_id
64+
mlflow_service = module.mlflow.mlflow_service
65+
artifacts_bucket = module.mlflow.artifacts_bucket_name
66+
project_id = var.project_id
6467
}

IaC/modules/mlflow/artifacts/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ resource "google_storage_bucket" "this" {
3131
}
3232
}
3333
uniform_bucket_level_access = var.storage_uniform
34+
force_destroy = true
3435
}

IaC/modules/mlflow/artifacts/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ output "url" {
1919
description = "gcs uri"
2020
value = google_storage_bucket.this.url
2121
}
22+
23+
output "name" {
24+
description = "gcs bucket name"
25+
value = google_storage_bucket.this.name
26+
}

IaC/modules/mlflow/artifacts/variables.tf

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,35 @@
1616
# along with this program; if not, write to the Free Software Foundation,
1717
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1818
variable "bucket_name" {
19-
description = "Name of the bucket."
20-
type = string
19+
description = "Name of the bucket."
20+
type = string
2121
}
2222
variable "bucket_location" {
23-
description = "Location of the bucket."
24-
type = string
25-
default = "EUROPE-WEST1"
23+
description = "Location of the bucket."
24+
type = string
25+
default = "EUROPE-WEST1"
2626
}
2727
variable "versioning_enabled" {
28-
description = "True if you want to version your bucket."
29-
type = bool
30-
default = true
28+
description = "True if you want to version your bucket."
29+
type = bool
30+
default = true
3131
}
3232
variable "number_of_version" {
33-
description = "Number of version you want to keep with the versionning."
34-
type = number
35-
default = 1
33+
description = "Number of version you want to keep with the versionning."
34+
type = number
35+
default = 1
3636
}
3737
variable "storage_class" {
38-
description = "Storage class of your bucket"
39-
type = string
40-
default ="STANDARD"
38+
description = "Storage class of your bucket"
39+
type = string
40+
default = "STANDARD"
4141
}
4242
variable "module_depends_on" {
4343
type = any
4444
default = null
4545
}
4646
variable "storage_uniform" {
47-
type = bool
48-
description = "Wether or not uniform level acces is to be activated for the buckets"
49-
default = true
47+
type = bool
48+
description = "Wether or not uniform level acces is to be activated for the buckets"
49+
default = true
5050
}

IaC/modules/mlflow/database/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ resource "google_sql_database_instance" "this_instance" {
3535
}
3636
availability_type = var.availability_type
3737
}
38+
deletion_protection = false
3839
}
3940

4041
resource "google_sql_database" "this_database" {
41-
name = var.database_name
42-
instance = google_sql_database_instance.this_instance.name
42+
name = var.database_name
43+
instance = google_sql_database_instance.this_instance.name
4344
depends_on = [google_sql_database_instance.this_instance]
4445
}
4546

4647
resource "google_sql_user" "this_user" {
47-
name = var.username
48-
instance = google_sql_database_instance.this_instance.name
49-
password = var.password
48+
name = var.username
49+
instance = google_sql_database_instance.this_instance.name
50+
password = var.password
5051
depends_on = [google_sql_database_instance.this_instance]
5152
}

IaC/modules/mlflow/database/variables.tf

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,42 @@
1616
# along with this program; if not, write to the Free Software Foundation,
1717
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1818
variable "instance_prefix" {
19-
type = string
20-
description = "Name of the database instance you want to deploy"
21-
default = "mlflow"
19+
type = string
20+
description = "Name of the database instance you want to deploy"
21+
default = "mlflow"
2222
}
2323
variable "database_version" {
24-
type = string
25-
description = "Version of the database instance you use"
26-
default = "MYSQL_5_7"
24+
type = string
25+
description = "Version of the database instance you use"
26+
default = "MYSQL_5_7"
2727
}
2828
variable "region" {
29-
type = string
30-
description = "Region of the database instance"
31-
default = "europe-west1"
29+
type = string
30+
description = "Region of the database instance"
31+
default = "europe-west1"
3232
}
3333
variable "size" {
34-
type = string
35-
description = "Size of the database instance"
36-
default = "db-f1-micro"
34+
type = string
35+
description = "Size of the database instance"
36+
default = "db-f1-micro"
3737
}
3838
variable "availability_type" {
39-
type = string
40-
description = "Availability of your instance"
41-
default = "ZONAL"
39+
type = string
40+
description = "Availability of your instance"
41+
default = "ZONAL"
4242
}
4343
variable "database_name" {
44-
type = string
45-
description = "Name of the database created"
46-
default = "mlflow"
44+
type = string
45+
description = "Name of the database created"
46+
default = "mlflow"
4747
}
4848
variable "username" {
49-
type = string
50-
description = "Username to connect to database instance"
49+
type = string
50+
description = "Username to connect to database instance"
5151
}
5252
variable "password" {
53-
type = string
54-
description = "Password to connect to database instance"
53+
type = string
54+
description = "Password to connect to database instance"
5555
}
5656
variable "module_depends_on" {
5757
type = any

IaC/modules/mlflow/log_pusher/main.tf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ resource "google_service_account" "log_pusher" {
2020
display_name = "mlflow log pusher"
2121
}
2222

23-
resource "google_project_iam_member" "log_pusher_iap" {
23+
resource "google_iap_app_engine_service_iam_member" "log_pusher_iap" {
2424
project = var.project_id
25+
app_id = var.app_id
26+
service = var.mlflow_service
2527
role = "roles/iap.httpsResourceAccessor"
26-
member = "serviceAccount:${google_service_account.log_pusher.email}"
28+
member = "serviceAccount:${google_service_account.log_pusher.email}"
2729
}
2830

29-
resource "google_project_iam_member" "log_pusher_storage" {
30-
project = var.project_id
31-
role = "roles/storage.objectAdmin"
31+
resource "google_storage_bucket_iam_member" "log_pusher_storage" {
32+
bucket = var.artifacts_bucket
33+
role = "roles/storage.objectAdmin"
3234
member = "serviceAccount:${google_service_account.log_pusher.email}"
3335
}

IaC/modules/mlflow/log_pusher/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@
1717
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1818
variable "project_id" {
1919
type = string
20+
}
21+
variable "app_id" {
22+
type = string
23+
}
24+
variable "mlflow_service" {
25+
type = string
26+
}
27+
variable "artifacts_bucket" {
28+
type = string
2029
}

IaC/modules/mlflow/main.tf

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,53 @@
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with this program; if not, write to the Free Software Foundation,
1717
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
1819
module "artifacts" {
19-
source = "./artifacts"
20-
bucket_name = var.artifacts_bucket_name
21-
bucket_location = var.artifacts_bucket_location
22-
number_of_version = var.artifacts_number_of_version
23-
storage_class = var.artifacts_storage_class
20+
source = "./artifacts"
21+
bucket_name = var.artifacts_bucket_name
22+
bucket_location = var.artifacts_bucket_location
23+
number_of_version = var.artifacts_number_of_version
24+
storage_class = var.artifacts_storage_class
2425
}
2526

2627
module "db_secret" {
27-
source = "./secret_manager"
28-
secret_id = var.db_password_name
29-
secret_value = var.db_password_value
28+
source = "./secret_manager"
29+
secret_id = var.db_password_name
3030
}
3131

3232
module "database" {
33-
source = "./database"
34-
instance_prefix = var.db_instance_prefix
35-
database_version = var.db_version
36-
region = var.db_region
37-
size = var.db_size
38-
availability_type = var.db_availability_type
39-
database_name = var.db_name
40-
username = var.db_username
41-
password = module.db_secret.secret_value
42-
network_self_link = var.network_self_link
33+
source = "./database"
34+
instance_prefix = var.db_instance_prefix
35+
database_version = var.db_version
36+
region = var.db_region
37+
size = var.db_size
38+
availability_type = var.db_availability_type
39+
database_name = var.db_name
40+
username = var.db_username
41+
password = module.db_secret.secret_value
42+
network_self_link = var.network_self_link
4343
}
4444

4545
module "server" {
46-
source = "./server"
47-
server_name = var.mlflow_server
48-
location = var.server_location
49-
docker_image_name = var.server_docker_image
50-
env_variables = var.server_env_variables
51-
db_private_ip = module.database.private_ip
52-
project_id = var.project_id
53-
db_password_name = var.db_password_name
54-
db_username = var.db_username
55-
db_name = var.db_name
56-
db_instance = module.database.instance_connection_name
57-
gcs_backend = module.artifacts.url
58-
module_depends_on = var.module_depends_on
59-
consent_screen_support_email = var.consent_screen_support_email
60-
web_app_users = var.web_app_users
61-
network_short_name = var.network_short_name
46+
source = "./server"
47+
mlflow_server = var.mlflow_server
48+
create_default_service = var.create_default_service
49+
location = var.server_location
50+
docker_image_name = var.server_docker_image
51+
env_variables = var.server_env_variables
52+
db_private_ip = module.database.private_ip
53+
project_id = var.project_id
54+
db_password_name = var.db_password_name
55+
db_username = var.db_username
56+
db_name = var.db_name
57+
db_instance = module.database.instance_connection_name
58+
gcs_backend = module.artifacts.url
59+
module_depends_on = var.module_depends_on
60+
consent_screen_support_email = var.consent_screen_support_email
61+
web_app_users = var.web_app_users
62+
network_short_name = var.network_short_name
63+
oauth_client_id = var.oauth_client_id
64+
oauth_client_secret = var.oauth_client_secret
65+
create_brand = var.create_brand
66+
brand_name = var.brand_name
6267
}

IaC/modules/mlflow/outputs.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
output "app_id" {
2+
value = module.server.app_id
3+
}
4+
5+
output "mlflow_service" {
6+
value = module.server.mlflow_service
7+
}
8+
9+
output "artifacts_bucket_name" {
10+
value = module.artifacts.name
11+
}

0 commit comments

Comments
 (0)