Skip to content

Commit

Permalink
adding fluent-bit image retagging for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jdongo-aneo committed Oct 31, 2024
1 parent bba0953 commit 4e47002
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
1 change: 0 additions & 1 deletion infrastructure/quick-deploy/aws/armonik.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
36 changes: 36 additions & 0 deletions infrastructure/quick-deploy/aws/ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,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" {
Expand All @@ -100,3 +123,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 = <<EOT
aws ecr get-login-password --profile ${var.profile} --region --region ${local.region} | docker login --username AWS --password-stdin ${local.fluent_bit_repository_uri}
docker buildx imagetools create ${local.fluent_bit_repository_uri}:${local.fluent_bit_image_tag} --tag ${local.fluent_bit_repository_uri}:${local.fluent_bit_image_tag} --append ${var.fluent_bit.image_name}:windows-2022-${local.fluent_bit_image_tag}
EOT
}
}
2 changes: 1 addition & 1 deletion versions.tfvars.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"armonik_versions": {
"armonik": "2.20.0",
"infra": "0.5.0-pre-8-f5b8bd3",
"infra": "jd/scopeo",
"infra_plugins": "0.1.1",
"core": "0.24.3",
"api": "3.19.0",
Expand Down

0 comments on commit 4e47002

Please sign in to comment.