Skip to content

Commit

Permalink
Add Kube Prometheus Stack to the DemoApps (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-ojeda-binbash authored Jan 17, 2023
1 parent 4c8cd3e commit 14d11e1
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 9 deletions.
6 changes: 3 additions & 3 deletions apps-devstg/us-east-1/k8s-eks-demoapps/cluster/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ provider "kubernetes" {
# Backend Config (partial)
#
terraform {
required_version = "~> 1.1.9"
required_version = "~> 1.2"

required_providers {
aws = "~> 4.11.0"
kubernetes = "~> 2.11.0"
aws = "~> 4.11"
kubernetes = "~> 2.11"
}

backend "s3" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ module "cluster" {
# max_size = 6
# desired_size = 1
# capacity_type = "ON_DEMAND"
# instance_types = ["t2.medium", "t3.medium"]
# instance_types = ["t3.medium"]
# }
spot = {
desired_capacity = 1
max_capacity = 6
min_capacity = 1
capacity_type = "SPOT"
instance_types = ["t2.medium", "t3.medium"]
instance_types = ["t3.medium"]
}
}

Expand Down
4 changes: 2 additions & 2 deletions apps-devstg/us-east-1/k8s-eks-demoapps/identities/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ provider "aws" {
# Backend Config (partial)
#
terraform {
required_version = "~> 1.1.9"
required_version = "~> 1.2"

required_providers {
aws = "~> 4.11.0"
aws = "~> 4.11"
}

backend "s3" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,16 @@ resource "helm_release" "metrics_server" {
version = "5.8.4"
values = [file("chart-values/metrics-server.yaml")]
}

#------------------------------------------------------------------------------
# Prometheus Stack
#------------------------------------------------------------------------------
resource "helm_release" "kube_prometheus_stack" {
count = var.enable_prometheus_stack ? 1 : 0
name = "kube-prometheus-stack"
namespace = kubernetes_namespace.prometheus[0].id
repository = "https://prometheus-community.github.io/helm-charts"
chart = "kube-prometheus-stack"
version = "43.2.1"
values = [file("chart-values/kube-prometheus-stack.yaml")]
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,12 @@ resource "kubernetes_namespace" "velero" {
name = "velero"
}
}

resource "kubernetes_namespace" "prometheus" {
count = var.enable_prometheus_stack ? 1 : 0

metadata {
labels = local.labels
name = "prometheus"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ logging = {
]
}
# metrics
enable_prometheus_stack = true
enable_prometheus_dependencies = false
enable_grafana_dependencies = false
# datadog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ variable "enable_ingressmonitorcontroller" {
default = false
}

variable "enable_prometheus_stack" {
type = bool
default = false
}

variable "enable_prometheus_dependencies" {
type = bool
default = false
Expand Down
4 changes: 2 additions & 2 deletions apps-devstg/us-east-1/k8s-eks-demoapps/network/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ provider "aws" {
# Backend Config (partial)
#
terraform {
required_version = "~> 1.1.9"
required_version = "~> 1.2"

required_providers {
aws = "~> 4.11.0"
aws = "~> 4.11"
}

backend "s3" {
Expand Down
1 change: 1 addition & 0 deletions management/global/sso/policies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ data "aws_iam_policy_document" "devops" {
"route53resolver:*",
"s3:*",
"ses:*",
"secretsmanager:*",
"shield:*",
"sns:*",
"sqs:*",
Expand Down

0 comments on commit 14d11e1

Please sign in to comment.