Skip to content

Commit

Permalink
Refactor ADOT to essentials submodule due to dependency on cert-manag…
Browse files Browse the repository at this point in the history
…er (#92)

* Refactor ADOT to essentials submodule due to dependency on cert-manager

* remove resolve_conflicts_on_update

* Add ADOT addon version to use latest by default but allow override;

* Add k8s version var for adot reference

* Use data resource to load cluster version

---------

Co-authored-by: Poh Peng <thepoppingone@users.noreply.github.com>
  • Loading branch information
thepoppingone and thepoppingone authored Aug 1, 2023
1 parent 6e15a77 commit 9b0eacc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions modules/essentials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ module "eks_essentials" {
| [kubernetes_storage_class_v1.default](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class_v1) | resource |
| [aws_arn.node_termination_handler_sqs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/arn) | data source |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_eks_addon_version.latest_adot](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_addon_version) | data source |
| [aws_eks_cluster.cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) | data source |
| [aws_iam_policy_document.ecr_cache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.fluent_bit](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.node_termination_handler_sqs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
Expand All @@ -119,6 +121,7 @@ module "eks_essentials" {

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_adot_addon_version"></a> [adot\_addon\_version](#input\_adot\_addon\_version) | value of the adot addon version | `string` | `null` | no |
| <a name="input_affinity"></a> [affinity](#input\_affinity) | Pod affinity | `map(string)` | `{}` | no |
| <a name="input_autoscaling_mode"></a> [autoscaling\_mode](#input\_autoscaling\_mode) | Autoscaling mode: cluster\_autoscaler or karpenter | `string` | `"cluster_autoscaler"` | no |
| <a name="input_brupop_chart_name"></a> [brupop\_chart\_name](#input\_brupop\_chart\_name) | Chart name for brupop | `string` | `"bottlerocket-brupop"` | no |
Expand Down
15 changes: 13 additions & 2 deletions modules/essentials/adot.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
data "aws_eks_cluster" "cluster" {
name = var.cluster_name
}

data "aws_eks_addon_version" "latest_adot" {
addon_name = "adot"
kubernetes_version = data.aws_eks_cluster.cluster.version
most_recent = true
}

resource "aws_eks_addon" "adot_operator" {
cluster_name = var.cluster_name
addon_name = "adot"
cluster_name = var.cluster_name
addon_name = "adot"
addon_version = try(var.adot_addon_version, data.aws_eks_addon_version.latest_adot.version)

depends_on = [
helm_release.cert_manager,
Expand Down
8 changes: 8 additions & 0 deletions modules/essentials/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ variable "worker_iam_role_name" {
type = string
}

########
# ADOT
########
variable "adot_addon_version" {
description = "value of the adot addon version"
type = string
default = null
}

############################
# K8S Resources
Expand Down

0 comments on commit 9b0eacc

Please sign in to comment.