Skip to content

Commit

Permalink
precommit ran on the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
RJrocks committed Nov 28, 2023
1 parent 9a9551c commit cb0bd4b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 28 deletions.
2 changes: 2 additions & 0 deletions modules/eks-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this
| <a name="module_helm_addon"></a> [helm\_addon](#module\_helm\_addon) | github.com/aws-ia/terraform-aws-eks-blueprints//modules/kubernetes-addons/helm-addon | v4.32.1 |
| <a name="module_istio_monitoring"></a> [istio\_monitoring](#module\_istio\_monitoring) | ./patterns/istio | n/a |
| <a name="module_java_monitoring"></a> [java\_monitoring](#module\_java\_monitoring) | ./patterns/java | n/a |
| <a name="module_kubecost"></a> [kubecost](#module\_kubecost) | ./add-ons/eks-kubecost | n/a |
| <a name="module_nginx_monitoring"></a> [nginx\_monitoring](#module\_nginx\_monitoring) | ./patterns/nginx | n/a |
| <a name="module_operator"></a> [operator](#module\_operator) | ./add-ons/adot-operator | n/a |

Expand Down Expand Up @@ -87,6 +88,7 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this
| <a name="input_enable_istio"></a> [enable\_istio](#input\_enable\_istio) | Enable ISTIO workloads monitoring, alerting and default dashboards | `bool` | `false` | no |
| <a name="input_enable_java"></a> [enable\_java](#input\_enable\_java) | Enable Java workloads monitoring, alerting and default dashboards | `bool` | `false` | no |
| <a name="input_enable_kube_state_metrics"></a> [enable\_kube\_state\_metrics](#input\_enable\_kube\_state\_metrics) | Enables or disables Kube State metrics exporter. Disabling this might affect some data in the dashboards | `bool` | `true` | no |
| <a name="input_enable_kubecost"></a> [enable\_kubecost](#input\_enable\_kubecost) | Enable kubecost on EKS cluster | `bool` | `true` | no |
| <a name="input_enable_logs"></a> [enable\_logs](#input\_enable\_logs) | Using AWS For FluentBit to collect cluster and application logs to Amazon CloudWatch | `bool` | `true` | no |
| <a name="input_enable_nginx"></a> [enable\_nginx](#input\_enable\_nginx) | Enable NGINX workloads monitoring, alerting and default dashboards | `bool` | `false` | no |
| <a name="input_enable_node_exporter"></a> [enable\_node\_exporter](#input\_enable\_node\_exporter) | Enables or disables Node exporter. Disabling this might affect some data in the dashboards | `bool` | `true` | no |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ kubecostProductConfigs:
clusterName: ${cluster_name}
projectID: ${account_id}

prometheus:
prometheus:
server:
global:
external_labels:
cluster_id: ${cluster_name}
nodeExporter:
enabled: false
enabled: false
26 changes: 13 additions & 13 deletions modules/eks-monitoring/add-ons/eks-kubecost/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ data "aws_iam_policy" "irsa_policy_2" {
}

locals {
release = "kubecost"
queryurl = "http://localhost:8005/workspaces/${var.prometheus_workspace_id}"
remotewriteurl = "https://aps-workspaces.${data.aws_region.current.name}.amazonaws.com/workspaces/${var.prometheus_workspace_id}/api/v1/remote_write"
service_account = try(var.helm_config.service_account, "${local.release}-cost-analyzer-amp")
release = "kubecost"
queryurl = "http://localhost:8005/workspaces/${var.prometheus_workspace_id}"
remotewriteurl = "https://aps-workspaces.${data.aws_region.current.name}.amazonaws.com/workspaces/${var.prometheus_workspace_id}/api/v1/remote_write"
service_account = try(var.helm_config.service_account, "${local.release}-cost-analyzer-amp")
prometheus_service_account = try(var.helm_config.prometheus_service_account, "${local.release}-prometheus-server-amp")

set_values = [
Expand All @@ -46,7 +46,7 @@ locals {
default_helm_config = {
name = local.release
chart = "cost-analyzer"
repository = "https://kubecost.github.io/cost-analyzer/"
repository = "https://kubecost.github.io/cost-analyzer/"
version = var.kubecost_helm_chart_version
namespace = local.release
values = local.default_helm_values
Expand All @@ -59,12 +59,12 @@ locals {
)

default_helm_values = [templatefile("${path.module}/config-values.yaml", {
service_account = local.service_account
prometheus_service_account = local.prometheus_service_account
account_id = var.addon_context.aws_caller_identity_account_id
aws_region = var.addon_context.aws_region_name
cluster_name = var.addon_context.eks_cluster_id
prometheus_workspace_id = var.prometheus_workspace_id
service_account = local.service_account
prometheus_service_account = local.prometheus_service_account
account_id = var.addon_context.aws_caller_identity_account_id
aws_region = var.addon_context.aws_region_name
cluster_name = var.addon_context.eks_cluster_id
prometheus_workspace_id = var.prometheus_workspace_id

})]

Expand All @@ -74,7 +74,7 @@ locals {
create_kubernetes_namespace = try(local.helm_config["create_namespace"], true)
create_kubernetes_service_account = true
create_service_account_secret_token = try(local.helm_config["create_service_account_secret_token"], false)
irsa_iam_policies = concat([data.aws_iam_policy.irsa_policy_1.arn,data.aws_iam_policy.irsa_policy_2.arn], var.irsa_policies)
irsa_iam_policies = concat([data.aws_iam_policy.irsa_policy_1.arn, data.aws_iam_policy.irsa_policy_2.arn], var.irsa_policies)
}

prometheus_irsa_config = {
Expand All @@ -83,7 +83,7 @@ locals {
create_kubernetes_namespace = false
create_kubernetes_service_account = true
create_service_account_secret_token = try(local.helm_config["create_service_account_secret_token"], false)
irsa_iam_policies = concat([data.aws_iam_policy.irsa_policy_1.arn,data.aws_iam_policy.irsa_policy_2.arn], var.irsa_policies)
irsa_iam_policies = concat([data.aws_iam_policy.irsa_policy_1.arn, data.aws_iam_policy.irsa_policy_2.arn], var.irsa_policies)
}

}
14 changes: 7 additions & 7 deletions modules/eks-monitoring/add-ons/eks-kubecost/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module "helm_addon" {
source = "github.com/aws-ia/terraform-aws-eks-blueprints//modules/kubernetes-addons/helm-addon?ref=v4.32.1"
manage_via_gitops = var.manage_via_gitops
set_values = local.set_values
helm_config = local.helm_config
irsa_config = local.irsa_config
addon_context = var.addon_context
source = "github.com/aws-ia/terraform-aws-eks-blueprints//modules/kubernetes-addons/helm-addon?ref=v4.32.1"
manage_via_gitops = var.manage_via_gitops
set_values = local.set_values
helm_config = local.helm_config
irsa_config = local.irsa_config
addon_context = var.addon_context
}

module "irsa" {
Expand All @@ -25,4 +25,4 @@ module "irsa" {
eks_cluster_id = var.addon_context.eks_cluster_id
eks_oidc_provider_arn = var.addon_context.eks_oidc_provider_arn
tags = var.addon_context.tags
}
}
3 changes: 1 addition & 2 deletions modules/eks-monitoring/add-ons/eks-kubecost/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ variable "manage_via_gitops" {

variable "prometheus_workspace_id" {
default = ""
type = string
type = string
}

variable "irsa_policies" {
Expand Down Expand Up @@ -54,4 +54,3 @@ variable "tags" {
type = map(string)
default = {}
}

8 changes: 4 additions & 4 deletions modules/eks-monitoring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ module "operator" {
}

module "kubecost" {
source = "./add-ons/eks-kubecost"
count = var.enable_kubecost ? 1 : 0
eks_cluster_id = var.eks_cluster_id
addon_context = local.context
source = "./add-ons/eks-kubecost"
count = var.enable_kubecost ? 1 : 0
eks_cluster_id = var.eks_cluster_id
addon_context = local.context
prometheus_workspace_id = var.managed_prometheus_workspace_id

}
Expand Down

0 comments on commit cb0bd4b

Please sign in to comment.