Skip to content

Commit 7699033

Browse files
ctrombleyoavdeev
andauthored
fix: keep metadata service images in sync (#4)
* fix: keep metadata service images in sync * refactor: DRY up metaflow service container image reference * fix: rename common module output to match usages * fix: represent common module output properly and regenerate docs * fix: switch back to attribute * fix: commit pre-commit hook fixes * fix: update metadata service image name Co-authored-by: Oleg Avdeev <oleg.v.avdeev@gmail.com> Co-authored-by: Oleg Avdeev <oleg.v.avdeev@gmail.com>
1 parent f81087e commit 7699033

File tree

14 files changed

+78
-16
lines changed

14 files changed

+78
-16
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ You can find a complete example that uses this module but also includes setting
2323

2424
| Name | Source | Version |
2525
|------|--------|---------|
26+
| <a name="module_metaflow-common"></a> [metaflow-common](#module\_metaflow-common) | ./modules/common | n/a |
2627
| <a name="module_metaflow-computation"></a> [metaflow-computation](#module\_metaflow-computation) | ./modules/computation | n/a |
2728
| <a name="module_metaflow-datastore"></a> [metaflow-datastore](#module\_metaflow-datastore) | ./modules/datastore | n/a |
2829
| <a name="module_metaflow-metadata-service"></a> [metaflow-metadata-service](#module\_metaflow-metadata-service) | ./modules/metadata-service | n/a |
@@ -45,6 +46,7 @@ You can find a complete example that uses this module but also includes setting
4546
| <a name="input_extra_ui_backend_env_vars"></a> [extra\_ui\_backend\_env\_vars](#input\_extra\_ui\_backend\_env\_vars) | Additional environment variables for UI backend container | `map(string)` | `{}` | no |
4647
| <a name="input_extra_ui_static_env_vars"></a> [extra\_ui\_static\_env\_vars](#input\_extra\_ui\_static\_env\_vars) | Additional environment variables for UI static app | `map(string)` | `{}` | no |
4748
| <a name="input_iam_partition"></a> [iam\_partition](#input\_iam\_partition) | IAM Partition (Select aws-us-gov for AWS GovCloud, otherwise leave as is) | `string` | `"aws"` | no |
49+
| <a name="input_metadata_service_container_image"></a> [metadata\_service\_container\_image](#input\_metadata\_service\_container\_image) | Container image for metadata service | `string` | `""` | no |
4850
| <a name="input_resource_prefix"></a> [resource\_prefix](#input\_resource\_prefix) | string prefix for all resources | `string` | `"metaflow"` | no |
4951
| <a name="input_resource_suffix"></a> [resource\_suffix](#input\_resource\_suffix) | string suffix for all resources | `string` | `""` | no |
5052
| <a name="input_subnet1_id"></a> [subnet1\_id](#input\_subnet1\_id) | First subnet used for availability zone redundancy | `string` | n/a | yes |

locals.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
module "metaflow-common" {
2+
source = "./modules/common"
3+
}
4+
15
locals {
26
resource_prefix = length(var.resource_prefix) > 0 ? "${var.resource_prefix}-" : ""
37
resource_suffix = length(var.resource_suffix) > 0 ? "-${var.resource_suffix}" : ""
@@ -7,4 +11,9 @@ locals {
711

812
batch_s3_task_role_name = "${local.resource_prefix}batch_s3_task_role${local.resource_suffix}"
913
metaflow_batch_image_name = "${local.resource_prefix}batch${local.resource_suffix}"
14+
metadata_service_container_image = (
15+
var.metadata_service_container_image == "" ?
16+
module.metaflow-common.default_metadata_service_container_image :
17+
var.metadata_service_container_image
18+
)
1019
}

main.tf

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ module "metaflow-metadata-service" {
2020
resource_prefix = local.resource_prefix
2121
resource_suffix = local.resource_suffix
2222

23-
access_list_cidr_blocks = var.access_list_cidr_blocks
24-
api_basic_auth = var.api_basic_auth
25-
database_password = module.metaflow-datastore.database_password
26-
database_username = module.metaflow-datastore.database_username
27-
datastore_s3_bucket_kms_key_arn = module.metaflow-datastore.datastore_s3_bucket_kms_key_arn
28-
fargate_execution_role_arn = module.metaflow-computation.ecs_execution_role_arn
29-
iam_partition = var.iam_partition
30-
metaflow_vpc_id = var.vpc_id
31-
rds_master_instance_endpoint = module.metaflow-datastore.rds_master_instance_endpoint
32-
s3_bucket_arn = module.metaflow-datastore.s3_bucket_arn
33-
subnet1_id = var.subnet1_id
34-
subnet2_id = var.subnet2_id
35-
vpc_cidr_block = var.vpc_cidr_block
23+
access_list_cidr_blocks = var.access_list_cidr_blocks
24+
api_basic_auth = var.api_basic_auth
25+
database_password = module.metaflow-datastore.database_password
26+
database_username = module.metaflow-datastore.database_username
27+
datastore_s3_bucket_kms_key_arn = module.metaflow-datastore.datastore_s3_bucket_kms_key_arn
28+
fargate_execution_role_arn = module.metaflow-computation.ecs_execution_role_arn
29+
iam_partition = var.iam_partition
30+
metadata_service_container_image = local.metadata_service_container_image
31+
metaflow_vpc_id = var.vpc_id
32+
rds_master_instance_endpoint = module.metaflow-datastore.rds_master_instance_endpoint
33+
s3_bucket_arn = module.metaflow-datastore.s3_bucket_arn
34+
subnet1_id = var.subnet1_id
35+
subnet2_id = var.subnet2_id
36+
vpc_cidr_block = var.vpc_cidr_block
3637

3738
standard_tags = var.tags
3839
}
@@ -53,6 +54,7 @@ module "metaflow-ui" {
5354
s3_bucket_arn = module.metaflow-datastore.s3_bucket_arn
5455
subnet1_id = var.subnet1_id
5556
subnet2_id = var.subnet2_id
57+
ui_backend_container_image = local.metadata_service_container_image
5658

5759
METAFLOW_DATASTORE_SYSROOT_S3 = module.metaflow-datastore.METAFLOW_DATASTORE_SYSROOT_S3
5860
certificate_arn = var.ui_certificate_arn

modules/common/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
## Inputs
3+
4+
No inputs.
5+
6+
## Outputs
7+
8+
| Name | Description |
9+
|------|-------------|
10+
| <a name="output_default_metadata_service_container_image"></a> [default\_metadata\_service\_container\_image](#output\_default\_metadata\_service\_container\_image) | n/a |
11+
<!-- END_TF_DOCS -->

modules/common/locals.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
locals {
2+
default_metadata_service_container_image = "netflixoss/metaflow_metadata_service:v2.2.2"
3+
}

modules/common/outputs.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "default_metadata_service_container_image" {
2+
value = local.default_metadata_service_container_image
3+
}

modules/metadata-service/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ If the `access_list_cidr_blocks` variable is set, only traffic originating from
2323
| <a name="input_fargate_execution_role_arn"></a> [fargate\_execution\_role\_arn](#input\_fargate\_execution\_role\_arn) | The IAM role that grants access to ECS and Batch services which we'll use as our Metadata Service API's execution\_role for our Fargate instance | `string` | n/a | yes |
2424
| <a name="input_iam_partition"></a> [iam\_partition](#input\_iam\_partition) | IAM Partition (Select aws-us-gov for AWS GovCloud, otherwise leave as is) | `string` | `"aws"` | no |
2525
| <a name="input_is_gov"></a> [is\_gov](#input\_is\_gov) | Set to true if IAM partition is 'aws-us-gov' | `bool` | `false` | no |
26+
| <a name="input_metadata_service_container_image"></a> [metadata\_service\_container\_image](#input\_metadata\_service\_container\_image) | Container image for metadata service | `string` | `""` | no |
2627
| <a name="input_metaflow_vpc_id"></a> [metaflow\_vpc\_id](#input\_metaflow\_vpc\_id) | ID of the Metaflow VPC this SageMaker notebook instance is to be deployed in | `string` | n/a | yes |
2728
| <a name="input_rds_master_instance_endpoint"></a> [rds\_master\_instance\_endpoint](#input\_rds\_master\_instance\_endpoint) | The database connection endpoint in address:port format | `string` | n/a | yes |
2829
| <a name="input_resource_prefix"></a> [resource\_prefix](#input\_resource\_prefix) | Prefix given to all AWS resources to differentiate between applications | `string` | n/a | yes |

modules/metadata-service/ecs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "aws_ecs_task_definition" "this" {
1717
[
1818
{
1919
"name": "${var.resource_prefix}service${var.resource_suffix}",
20-
"image": "netflixoss/metaflow_metadata_service",
20+
"image": "${var.metadata_service_container_image}",
2121
"essential": true,
2222
"cpu": 512,
2323
"memory": 1024,

modules/metadata-service/locals.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
module "metaflow-common" {
2+
source = "../common"
3+
}
4+
15
locals {
26
# Name of ECS cluster.
37
# replace() ensures names that are composed of just prefix + suffix do not have duplicate dashes
@@ -7,6 +11,11 @@ locals {
711

812
# Name of Fargate security group used by the Metadata Service
913
metadata_service_security_group_name = "${var.resource_prefix}metadata-service-security-group${var.resource_suffix}"
14+
metadata_service_container_image = (
15+
var.metadata_service_container_image == "" ?
16+
module.metaflow-common.default_metadata_service_container_image :
17+
var.metadata_service_container_image
18+
)
1019

1120
api_gateway_endpoint_configuration_type = local.is_gov ? "REGIONAL" : "EDGE"
1221
api_gateway_key_name = "${var.resource_prefix}key${var.resource_suffix}"

modules/metadata-service/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ variable "is_gov" {
4141
description = "Set to true if IAM partition is 'aws-us-gov'"
4242
}
4343

44+
variable "metadata_service_container_image" {
45+
type = string
46+
default = ""
47+
description = "Container image for metadata service"
48+
}
49+
4450
variable "metaflow_vpc_id" {
4551
type = string
4652
description = "ID of the Metaflow VPC this SageMaker notebook instance is to be deployed in"

modules/ui/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The services are deployed behind an AWS ALB, and the module will output the ALB
2929
| <a name="input_subnet1_id"></a> [subnet1\_id](#input\_subnet1\_id) | First private subnet used for availability zone redundancy | `string` | n/a | yes |
3030
| <a name="input_subnet2_id"></a> [subnet2\_id](#input\_subnet2\_id) | Second private subnet used for availability zone redundancy | `string` | n/a | yes |
3131
| <a name="input_ui_allow_list"></a> [ui\_allow\_list](#input\_ui\_allow\_list) | A list of CIDRs the UI will be available to | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
32-
| <a name="input_ui_backend_container_image"></a> [ui\_backend\_container\_image](#input\_ui\_backend\_container\_image) | Container image for UI backend | `string` | `"netflixoss/metaflow_metadata_service:2.1.0"` | no |
32+
| <a name="input_ui_backend_container_image"></a> [ui\_backend\_container\_image](#input\_ui\_backend\_container\_image) | Container image for UI backend | `string` | `""` | no |
3333
| <a name="input_ui_static_container_image"></a> [ui\_static\_container\_image](#input\_ui\_static\_container\_image) | Container image for the UI frontend app | `string` | `"public.ecr.aws/outerbounds/metaflow_ui:v1.0.1"` | no |
3434

3535
## Outputs

modules/ui/locals.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
module "metaflow-common" {
2+
source = "../common"
3+
}
4+
15
locals {
26
# Name of ECS cluster.
37
# replace() ensures names that are composed of just prefix + suffix do not have duplicate dashes
@@ -27,4 +31,10 @@ locals {
2731
}
2832

2933
default_ui_static_env_vars = {}
34+
35+
metadata_service_container_image = (
36+
var.ui_backend_container_image == "" ?
37+
module.metaflow-common.default_metadata_service_container_image :
38+
var.ui_backend_container_image
39+
)
3040
}

modules/ui/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ variable "extra_ui_static_env_vars" {
100100

101101
variable "ui_backend_container_image" {
102102
type = string
103-
default = "netflixoss/metaflow_metadata_service:2.1.0"
103+
default = ""
104104
description = "Container image for UI backend"
105105
}
106106

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ variable "iam_partition" {
6767
description = "IAM Partition (Select aws-us-gov for AWS GovCloud, otherwise leave as is)"
6868
}
6969

70+
variable "metadata_service_container_image" {
71+
type = string
72+
default = ""
73+
description = "Container image for metadata service"
74+
}
75+
7076
variable "tags" {
7177
description = "aws tags"
7278
type = map(string)

0 commit comments

Comments
 (0)