From d58c86716c7bc830812085223275a192d4363cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Heleno?= Date: Mon, 15 Jan 2024 14:39:19 +0100 Subject: [PATCH 1/3] fix!: hardcode the release name to remove the destination cluster I found out that Argo CD passes the name of the application as a value to set the Helm chart. This means that all the templating that used `{ $.Release.Name }` would resolve to the name given to Argo CD application. In a multicluster deployment, using a single Argo CD, the names of the applications must be different. We solved that by appending the cluster name to the default application name when deploying on different clusters than `in-cluster`. However, this resulted in multiple problems for deployments that depended on the name of the application being static, so this solves that. This is a breaking change because sometimes this requires an application to be deleted and recreated. --- locals.tf | 1 - main.tf | 3 ++- variables.tf | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/locals.tf b/locals.tf index f1a877f..fcd495f 100644 --- a/locals.tf +++ b/locals.tf @@ -1,7 +1,6 @@ locals { helm_values = [{ "aws-ebs-csi-driver" = { - nameOverride = var.name controller = { serviceAccount = { annotations = { diff --git a/main.tf b/main.tf index 9de9b2e..e240bc8 100644 --- a/main.tf +++ b/main.tf @@ -76,7 +76,8 @@ resource "argocd_application" "this" { path = "charts/ebs-csi-driver" target_revision = var.target_revision helm { - values = data.utils_deep_merge_yaml.values.output + release_name = "efs-csi-driver" + values = data.utils_deep_merge_yaml.values.output } } diff --git a/variables.tf b/variables.tf index aeb60f5..47f82c8 100644 --- a/variables.tf +++ b/variables.tf @@ -67,12 +67,6 @@ variable "dependency_ids" { ## Module variables ####################### -variable "name" { - description = "Name used to override the chart name on deployment." - type = string - default = "ebs-csi-driver" -} - variable "create_role" { description = "Boolean to indicate that the OIDC assumable IAM role should be created. **If passing `iam_role_arn` this should be false, otherwise if you want to create the OIDC assumable IAM role provided by this module, you will need to specify the variable `cluster_oidc_issuer_url`.**" type = bool From fd1280cb3d974ee9519a301d9952427a05f5f3b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Heleno?= Date: Mon, 15 Jan 2024 14:41:20 +0100 Subject: [PATCH 2/3] fix!: remove the ArgoCD namespace variable Since we are hardcoding the namespace variable on all modules, the variable to set the ArgoCD namespace will no longer be needed as well. --- main.tf | 7 ++----- variables.tf | 5 ----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/main.tf b/main.tf index e240bc8..7012dd4 100644 --- a/main.tf +++ b/main.tf @@ -6,10 +6,7 @@ resource "argocd_project" "this" { count = var.argocd_project == null ? 1 : 0 metadata { name = var.destination_cluster != "in-cluster" ? "ebs-csi-driver-${var.destination_cluster}" : "ebs-csi-driver" - namespace = var.argocd_namespace - annotations = { - "devops-stack.io/argocd_namespace" = var.argocd_namespace - } + namespace = "argocd" } spec { @@ -54,7 +51,7 @@ module "iam_assumable_role_ebs" { resource "argocd_application" "this" { metadata { name = var.destination_cluster != "in-cluster" ? "ebs-csi-driver-${var.destination_cluster}" : "ebs-csi-driver" - namespace = var.argocd_namespace + namespace = "argocd" labels = merge({ "application" = "ebs-csi-driver" "cluster" = var.destination_cluster diff --git a/variables.tf b/variables.tf index 47f82c8..82fd243 100644 --- a/variables.tf +++ b/variables.tf @@ -8,11 +8,6 @@ variable "cluster_name" { default = "cluster" } -variable "argocd_namespace" { - description = "Namespace used by Argo CD where the Application and AppProject resources should be created." - type = string -} - variable "argocd_project" { description = "Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application." type = string From 5659aed5d0afe81b799945eeee136b23adaf679f Mon Sep 17 00:00:00 2001 From: lentidas Date: Mon, 15 Jan 2024 13:48:37 +0000 Subject: [PATCH 3/3] docs(terraform-docs): generate docs and write to README.adoc --- README.adoc | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/README.adoc b/README.adoc index c924f1d..b068c18 100644 --- a/README.adoc +++ b/README.adoc @@ -106,12 +106,6 @@ The following resources are used by this module: The following input variables are required: -==== [[input_argocd_namespace]] <> - -Description: Namespace used by Argo CD where the Application and AppProject resources should be created. - -Type: `string` - ==== [[input_create_role]] <> Description: Boolean to indicate that the OIDC assumable IAM role should be created. **If passing `iam_role_arn` this should be false, otherwise if you want to create the OIDC assumable IAM role provided by this module, you will need to specify the variable `cluster_oidc_issuer_url`.** @@ -160,7 +154,7 @@ Description: Override of target revision of the application chart. Type: `string` -Default: `"v2.2.0"` +Default: `"v2.4.0"` ==== [[input_helm_values]] <> @@ -202,14 +196,6 @@ Type: `map(string)` Default: `{}` -==== [[input_name]] <> - -Description: Name used to override the chart name on deployment. - -Type: `string` - -Default: `"ebs-csi-driver"` - ==== [[input_iam_role_arn]] <> Description: ARN of an OIDC assumable IAM role that has access to the EBS volumes. When specified, this is added as an annotation to the EBS CSI driver controller ServiceAccount, to allow the driver to manage EBS access points for dynamic volumes provisioning. @@ -256,9 +242,9 @@ Description: ID to pass other modules in order to refer to this module as a depe [cols="a,a",options="header,autowidth"] |=== |Name |Version +|[[provider_null]] <> |>= 3 |[[provider_utils]] <> |>= 1 |[[provider_argocd]] <> |>= 5 -|[[provider_null]] <> |>= 3 |=== = Modules @@ -292,12 +278,6 @@ Description: ID to pass other modules in order to refer to this module as a depe |`"cluster"` |no -|[[input_argocd_namespace]] <> -|Namespace used by Argo CD where the Application and AppProject resources should be created. -|`string` -|n/a -|yes - |[[input_argocd_project]] <> |Name of the Argo CD AppProject where the Application should be created. If not set, the Application will be created in a new AppProject only for this Application. |`string` @@ -319,7 +299,7 @@ Description: ID to pass other modules in order to refer to this module as a depe |[[input_target_revision]] <> |Override of target revision of the application chart. |`string` -|`"v2.2.0"` +|`"v2.4.0"` |no |[[input_helm_values]] <> @@ -360,12 +340,6 @@ object({ |`{}` |no -|[[input_name]] <> -|Name used to override the chart name on deployment. -|`string` -|`"ebs-csi-driver"` -|no - |[[input_create_role]] <> |Boolean to indicate that the OIDC assumable IAM role should be created. **If passing `iam_role_arn` this should be false, otherwise if you want to create the OIDC assumable IAM role provided by this module, you will need to specify the variable `cluster_oidc_issuer_url`.** |`bool`