From 86fcaa582f9f2951a510920111364d000ebf352e Mon Sep 17 00:00:00 2001 From: Carlos Santana Date: Mon, 30 Oct 2023 08:53:42 -0400 Subject: [PATCH] add variables to enable auto deploy addons and workloads Signed-off-by: Carlos Santana --- patterns/gitops/getting-started-argocd/README.md | 11 +++++++++-- .../getting-started-argocd/bootstrap/workloads.yaml | 2 -- patterns/gitops/getting-started-argocd/main.tf | 11 +++++++++++ patterns/gitops/getting-started-argocd/variables.tf | 12 ++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/patterns/gitops/getting-started-argocd/README.md b/patterns/gitops/getting-started-argocd/README.md index 5dba764a0e..b221cde3d3 100644 --- a/patterns/gitops/getting-started-argocd/README.md +++ b/patterns/gitops/getting-started-argocd/README.md @@ -89,16 +89,19 @@ The output looks like the following: ``` The labels offer a straightforward way to enable or disable an addon in ArgoCD for the cluster. ```shell -kubectl get secret -n argocd -l argocd.argoproj.io/secret-type=cluster -o json | jq '.items[0].metadata.labels' +kubectl get secret -n argocd -l argocd.argoproj.io/secret-type=cluster -o json | jq '.items[0].metadata.labels' | grep -v false | jq . ``` The output looks like the following: ```json { + "argocd.argoproj.io/secret-type": "cluster", "aws_cluster_name": "getting-started-gitops", + "cluster_name": "in-cluster", "enable_argocd": "true", "enable_aws_load_balancer_controller": "true", "enable_metrics_server": "true", - "kubernetes_version": "1.28", + "environment": "dev", + "kubernetes_version": "1.28" } ``` @@ -169,6 +172,10 @@ Check the application's CPU and memory metrics: ```shell kubectl top pods -n game-2048 ``` +Check all pods CPU and memory metrics: +```shell +kubectl top pods -A +``` ## Destroy the EKS Cluster To tear down all the resources and the EKS cluster, run the following command: diff --git a/patterns/gitops/getting-started-argocd/bootstrap/workloads.yaml b/patterns/gitops/getting-started-argocd/bootstrap/workloads.yaml index 8c883ea346..abebd17f9e 100644 --- a/patterns/gitops/getting-started-argocd/bootstrap/workloads.yaml +++ b/patterns/gitops/getting-started-argocd/bootstrap/workloads.yaml @@ -29,6 +29,4 @@ spec: syncOptions: - CreateNamespace=true retry: - backoff: - duration: 1m limit: 60 diff --git a/patterns/gitops/getting-started-argocd/main.tf b/patterns/gitops/getting-started-argocd/main.tf index 42bfe363df..a4a0413d89 100644 --- a/patterns/gitops/getting-started-argocd/main.tf +++ b/patterns/gitops/getting-started-argocd/main.tf @@ -121,6 +121,16 @@ locals { } ) + argocd_app_of_appsets_addons = var.enable_gitops_auto_addons ? { + addons = file("${path.module}/bootstrap/addons.yaml") + } : {} + argocd_app_of_appsets_workloads = var.enable_gitops_auto_workloads ? { + workloads = file("${path.module}/bootstrap/workloads.yaml") + } : {} + + argocd_apps = merge(local.argocd_app_of_appsets_addons, local.argocd_app_of_appsets_workloads) + + tags = { Blueprint = local.name GithubRepo = "github.com/aws-ia/terraform-aws-eks-blueprints" @@ -137,6 +147,7 @@ module "gitops_bridge_bootstrap" { metadata = local.addons_metadata addons = local.addons } + apps = local.argocd_apps } ################################################################################ diff --git a/patterns/gitops/getting-started-argocd/variables.tf b/patterns/gitops/getting-started-argocd/variables.tf index d0ef0fe9b7..b4c7511302 100644 --- a/patterns/gitops/getting-started-argocd/variables.tf +++ b/patterns/gitops/getting-started-argocd/variables.tf @@ -74,3 +74,15 @@ variable "gitops_workload_path" { type = string default = "getting-started-argocd/k8s" } + +variable "enable_gitops_auto_addons" { + description = "Automatically deploy addons" + type = bool + default = false +} + +variable "enable_gitops_auto_workloads" { + description = "Automatically deploy addons" + type = bool + default = false +}