From 967be9efe7a9370015986770c22aee0307fcfcad Mon Sep 17 00:00:00 2001 From: Junior Dongo Date: Thu, 24 Oct 2024 05:07:13 +0200 Subject: [PATCH 1/4] fix: adjust for scopeo use --- infrastructure/quick-deploy/aws/ecr.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/infrastructure/quick-deploy/aws/ecr.tf b/infrastructure/quick-deploy/aws/ecr.tf index b565d39c1..df7fa1f69 100644 --- a/infrastructure/quick-deploy/aws/ecr.tf +++ b/infrastructure/quick-deploy/aws/ecr.tf @@ -97,7 +97,6 @@ module "default_images" { module "ecr" { source = "./generated/infra-modules/container-registry/aws/ecr" - aws_profile = var.profile kms_key_id = local.kms_key repositories = var.upload_images ? local.repositories : {} encryption_type = var.ecr.encryption_type From c5425ae2d0a5c9860382a74a319bf5904570d009 Mon Sep 17 00:00:00 2001 From: Junior Dongo Date: Thu, 24 Oct 2024 09:03:57 +0200 Subject: [PATCH 2/4] dependency for image copy --- infrastructure/quick-deploy/aws/armonik.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure/quick-deploy/aws/armonik.tf b/infrastructure/quick-deploy/aws/armonik.tf index 92a7d1872..aa894412d 100644 --- a/infrastructure/quick-deploy/aws/armonik.tf +++ b/infrastructure/quick-deploy/aws/armonik.tf @@ -76,4 +76,5 @@ module "armonik" { image = local.ecr_images["${var.pod_deletion_cost.image}:${try(coalesce(var.pod_deletion_cost.tag), "")}"].image tag = local.ecr_images["${var.pod_deletion_cost.image}:${try(coalesce(var.pod_deletion_cost.tag), "")}"].tag }) + depends_on = [module.ecr] } From d4d2920e81a609156cab176f53901ec1fcd7b981 Mon Sep 17 00:00:00 2001 From: Junior Dongo Date: Thu, 31 Oct 2024 16:54:20 +0100 Subject: [PATCH 3/4] adding fluent-bit image retagging for windows --- infrastructure/quick-deploy/aws/armonik.tf | 1 - infrastructure/quick-deploy/aws/ecr.tf | 36 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/infrastructure/quick-deploy/aws/armonik.tf b/infrastructure/quick-deploy/aws/armonik.tf index aa894412d..92a7d1872 100644 --- a/infrastructure/quick-deploy/aws/armonik.tf +++ b/infrastructure/quick-deploy/aws/armonik.tf @@ -76,5 +76,4 @@ module "armonik" { image = local.ecr_images["${var.pod_deletion_cost.image}:${try(coalesce(var.pod_deletion_cost.tag), "")}"].image tag = local.ecr_images["${var.pod_deletion_cost.image}:${try(coalesce(var.pod_deletion_cost.tag), "")}"].tag }) - depends_on = [module.ecr] } diff --git a/infrastructure/quick-deploy/aws/ecr.tf b/infrastructure/quick-deploy/aws/ecr.tf index df7fa1f69..2eac7f6e8 100644 --- a/infrastructure/quick-deploy/aws/ecr.tf +++ b/infrastructure/quick-deploy/aws/ecr.tf @@ -85,7 +85,30 @@ locals { } default_tags = module.default_images.image_tags + + #information for fluent-bit image retagging. + fluent_bit_repo_details = try( + [ + for repo in local.ecr_repositories : + { + name = repo.name + tag = repo.tag + } + if repo.image == var.fluent_bit.image_name + ][0], + null + ) + fluent_bit_repository_name = local.fluent_bit_repo_details != null ? local.fluent_bit_repo_details.name : null + fluent_bit_image_tag = local.fluent_bit_repo_details != null ? local.fluent_bit_repo_details.tag : null + + fluent_bit_repository_uri = data.aws_ecr_repository.fluent_bit.repository_url + region = data.aws_region.current.name +} + +data "aws_ecr_repository" "fluent_bit" { + name = local.fluent_bit_repository_name } +data "aws_region" "current" {} # Default tags for all images module "default_images" { @@ -102,3 +125,16 @@ module "ecr" { encryption_type = var.ecr.encryption_type tags = local.tags } + +#Temporary solution for image retagging while waiting for the muli-plateform image from fluent-bit: https://github.com/fluent/fluent-bit/issues/9509 +resource "null_resource" "ecr_login_and_build" { + count = var.upload_images ? 1 : 0 + + provisioner "local-exec" { + # Command to log in to ECR and build the image + command = < Date: Wed, 6 Nov 2024 18:10:48 +0100 Subject: [PATCH 4/4] move docker authentication to infra --- infrastructure/quick-deploy/aws/ecr.tf | 34 ++++++++------------- infrastructure/quick-deploy/aws/versions.tf | 4 +++ 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/infrastructure/quick-deploy/aws/ecr.tf b/infrastructure/quick-deploy/aws/ecr.tf index 2eac7f6e8..aa53cae7a 100644 --- a/infrastructure/quick-deploy/aws/ecr.tf +++ b/infrastructure/quick-deploy/aws/ecr.tf @@ -87,27 +87,17 @@ locals { default_tags = module.default_images.image_tags #information for fluent-bit image retagging. - fluent_bit_repo_details = try( - [ - for repo in local.ecr_repositories : - { - name = repo.name - tag = repo.tag - } - if repo.image == var.fluent_bit.image_name - ][0], - null - ) - fluent_bit_repository_name = local.fluent_bit_repo_details != null ? local.fluent_bit_repo_details.name : null - fluent_bit_image_tag = local.fluent_bit_repo_details != null ? local.fluent_bit_repo_details.tag : null - - fluent_bit_repository_uri = data.aws_ecr_repository.fluent_bit.repository_url - region = data.aws_region.current.name + fluent_bit_repository_uri = [ + for name, uri in module.ecr.repositories : uri + if can(regex("fluent-bit", name)) + ][0] + fluent_bit_image_tag = [ + for name, details in local.repositories : + details.tag if can(regex("fluent-bit", details.image)) + ][0] + region = data.aws_region.current.name } -data "aws_ecr_repository" "fluent_bit" { - name = local.fluent_bit_repository_name -} data "aws_region" "current" {} # Default tags for all images @@ -120,6 +110,7 @@ module "default_images" { module "ecr" { source = "./generated/infra-modules/container-registry/aws/ecr" + aws_profile = var.profile kms_key_id = local.kms_key repositories = var.upload_images ? local.repositories : {} encryption_type = var.ecr.encryption_type @@ -127,13 +118,12 @@ module "ecr" { } #Temporary solution for image retagging while waiting for the muli-plateform image from fluent-bit: https://github.com/fluent/fluent-bit/issues/9509 -resource "null_resource" "ecr_login_and_build" { +resource "generic_local_cmd" "build_fluent-bit_image" { count = var.upload_images ? 1 : 0 provisioner "local-exec" { - # Command to log in to ECR and build the image + # build the muti-platform image in the registry command = <