From 6db7f316274113e2f45bd67f8a709cc34ec06eed Mon Sep 17 00:00:00 2001 From: Rodrigue Koffi Date: Tue, 26 Jul 2022 21:39:34 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20Deploy=20the=20ADOT=20operator?= =?UTF-8?q?=20with=20cert-manager=201.8.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/main.tf | 31 +++++++++++++++++-- examples/outputs.tf | 4 +++ examples/workloads.tf | 4 +-- main.tf | 8 +++-- modules/core/opentelemetry-operator/locals.tf | 2 +- modules/core/opentelemetry-operator/main.tf | 7 ++--- .../core/opentelemetry-operator/variables.tf | 5 ++- outputs.tf | 5 +++ 8 files changed, 51 insertions(+), 15 deletions(-) diff --git a/examples/main.tf b/examples/main.tf index 110b566..6074eee 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -2,15 +2,40 @@ provider "aws" { region = local.region } +data "aws_eks_cluster_auth" "this" { + name = var.eks_cluster_id +} + +data "aws_eks_cluster" "this" { + name = var.eks_cluster_id +} + +provider "kubernetes" { + host = local.eks_cluster_endpoint + cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data) + token = data.aws_eks_cluster_auth.this.token +} + +provider "helm" { + kubernetes { + host = local.eks_cluster_endpoint + cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data) + token = data.aws_eks_cluster_auth.this.token + } +} + locals { name = basename(path.cwd) region = var.aws_region - vpc_cidr = "10.0.0.0/16" - //azs = slice(data.aws_availability_zones.available.names, 0, 3) + eks_oidc_issuer_url = replace(data.aws_eks_cluster.this.identity[0].oidc[0].issuer, "https://", "") + eks_cluster_endpoint = data.aws_eks_cluster.this.endpoint + eks_cluster_version = data.aws_eks_cluster.this.version tags = { - GithubRepo = "github.com/aws-ia/terraform-aws-observability-accelerator" + Source = "github.com/aws-ia/terraform-aws-observability-accelerator" } + + } diff --git a/examples/outputs.tf b/examples/outputs.tf index ab5a1d7..3b97877 100644 --- a/examples/outputs.tf +++ b/examples/outputs.tf @@ -7,3 +7,7 @@ output "aws_region" { description = "AWS Region" value = module.eks_observability_accelerator.aws_region } + +output "eks_cluster_version" { + value = module.eks_observability_accelerator.eks_cluster_version +} diff --git a/examples/workloads.tf b/examples/workloads.tf index d78378f..e4124b3 100644 --- a/examples/workloads.tf +++ b/examples/workloads.tf @@ -63,9 +63,7 @@ module "eks_observability_accelerator" { # # -- or using existing amg workspace. so we can use API for keys # managed_grafana_workspace_id = var.managed_grafana_workspace_id - tags = { - Env = "Test" - } + tags = local.tags } diff --git a/main.tf b/main.tf index c4292bf..f178743 100644 --- a/main.tf +++ b/main.tf @@ -4,13 +4,15 @@ # EKS and Managed node groups # +//* module "adot_operator" { source = "./modules/core/opentelemetry-operator" + count = var.enable_amazon_eks_adot ? 1 : 0 - count = var.enable_amazon_eks_adot ? 1 : 0 - - addon_context = local.context + kubernetes_version = local.eks_cluster_version + addon_context = local.context } +//*/ module "java" { source = "./modules/workloads/java" diff --git a/modules/core/opentelemetry-operator/locals.tf b/modules/core/opentelemetry-operator/locals.tf index d84b7d0..47163b0 100644 --- a/modules/core/opentelemetry-operator/locals.tf +++ b/modules/core/opentelemetry-operator/locals.tf @@ -11,7 +11,7 @@ locals { name = "opentelemetry" repository = "https://open-telemetry.github.io/opentelemetry-helm-charts" chart = "opentelemetry-operator" - version = "0.8.2" + version = "0.10.0" namespace = local.namespace timeout = "1200" description = "ADOT Operator helm chart" diff --git a/modules/core/opentelemetry-operator/main.tf b/modules/core/opentelemetry-operator/main.tf index 314e0d0..101c2a1 100644 --- a/modules/core/opentelemetry-operator/main.tf +++ b/modules/core/opentelemetry-operator/main.tf @@ -22,10 +22,9 @@ resource "kubernetes_namespace_v1" "adot" { data "aws_eks_addon_version" "this" { count = var.enable_amazon_eks_adot ? 1 : 0 - addon_name = local.name - # Need to allow both config routes - for managed and self-managed configs - kubernetes_version = try(var.addon_config.kubernetes_version, var.helm_config.kubernetes_version) - most_recent = try(var.addon_config.most_recent, var.helm_config.most_recent, true) + addon_name = local.name + kubernetes_version = try(var.addon_config.kubernetes_version, var.kubernetes_version) + most_recent = try(var.addon_config.most_recent, true) } resource "aws_eks_addon" "adot" { diff --git a/modules/core/opentelemetry-operator/variables.tf b/modules/core/opentelemetry-operator/variables.tf index c986188..025dc0a 100644 --- a/modules/core/opentelemetry-operator/variables.tf +++ b/modules/core/opentelemetry-operator/variables.tf @@ -14,13 +14,16 @@ variable "addon_context" { aws_region_name = string eks_cluster_id = string eks_oidc_issuer_url = string - kubernetes_version = string eks_oidc_provider_arn = string irsa_iam_role_path = string tags = map(string) }) } +variable "kubernetes_version" { + type = string +} + variable "addon_config" { description = "Amazon EKS Managed CoreDNS Add-on config" type = any diff --git a/outputs.tf b/outputs.tf index 9c86e64..3110973 100644 --- a/outputs.tf +++ b/outputs.tf @@ -7,3 +7,8 @@ output "aws_region" { description = "EKS Cluster Id" value = var.aws_region } + + +output "eks_cluster_version" { + value = data.aws_eks_cluster.eks_cluster.version +}