Skip to content

Commit

Permalink
include settings for loki, prometheus and istio
Browse files Browse the repository at this point in the history
Signed-off-by: Luiz Oliveira <ziuloliveira@gmail.com>
  • Loading branch information
Ziul committed Oct 9, 2023
1 parent db77546 commit ca94a34
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 2 deletions.
7 changes: 7 additions & 0 deletions deploy/kubernetes/terraform/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 39 additions & 1 deletion deploy/kubernetes/terraform/addons.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ module "eks_blueprints_addons" {
values = [templatefile("${path.module}/values/ingress-nginx.yaml", {})]
}

kube_prometheus_stack = {
values = [templatefile("${path.module}/values/kube_prometheus_stack.yaml", {})]
}

aws_load_balancer_controller = {
set = [
{
Expand Down Expand Up @@ -66,7 +70,7 @@ module "admin_team" {
# Enables elevated, admin privileges for this team
enable_admin = true
users = [
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${var.role_name}",
# "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${var.role_name}",
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:user/alongir",
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:user/Mert",
]
Expand All @@ -92,3 +96,37 @@ resource "kubectl_manifest" "sock_shop" {
wait_for_rollout = true
count = var.enable_sock_shop ? 1 : 0
}

resource "helm_release" "istio" {
name = "istio-base"
repository = "https://istio-release.storage.googleapis.com/charts"
chart = "base"
namespace = "istio-system"
create_namespace = true
values = [templatefile("${path.module}/values/istio.yaml", {
defaultRevision = "default"
})]
count = var.enable_istio ? 1 : 0
}

resource "helm_release" "istiod" {
name = "istiod"
repository = "https://istio-release.storage.googleapis.com/charts"
chart = "istiod"
namespace = "istio-system"
create_namespace = true
values = [templatefile("${path.module}/values/istio.yaml", {
defaultRevision = "default"
})]
count = var.enable_istio ? 1 : 0
depends_on = [ helm_release.istio ]
}

resource "helm_release" "loki" {
name = "loki"
repository = "https://grafana.github.io/helm-charts"
chart = "loki-stack"
namespace = "kube-prometheus-stack"
depends_on = [ module.eks_blueprints_addons ]
values = [templatefile("${path.module}/values/loki.yaml", {})]
}
20 changes: 19 additions & 1 deletion deploy/kubernetes/terraform/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,27 @@ module "eks" {
manage_aws_auth_configmap = true
aws_auth_roles = flatten([
module.admin_team.aws_auth_configmap_role,
# {
# groups = ["system:masters"]
# rolearn = "arn:aws:iam::745696693350:role/AWSReservedSSO_AdministratorAccess_4ad944a45478ee7e"
# username = "alongir"
# },{
# groups = ["system:masters"]
# rolearn = "arn:aws:iam::745696693350:role/AWSReservedSSO_AdministratorAccess_4ad944a45478ee7e"
# username = "Mert"
# }
])
aws_auth_users = flatten([
module.admin_team.aws_auth_configmap_role,
# module.admin_team.aws_auth_configmap_role,
{
groups = ["system:masters"]
userarn = "arn:aws:iam::745696693350:user/alongir"
username = "alongir"
},{
groups = ["system:masters"]
userarn = "arn:aws:iam::745696693350:user/Mert"
username = "Mert"
}
])

tags = local.tags
Expand Down
Empty file.
19 changes: 19 additions & 0 deletions deploy/kubernetes/terraform/values/kube_prometheus_stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
grafana:
additionalDataSources: []
# - name: prometheus-sample
# access: proxy
# basicAuth: true
# basicAuthPassword: pass
# basicAuthUser: daco
# editable: false
# jsonData:
# tlsSkipVerify: true
# orgId: 1
# type: prometheus
# url: https://{{ printf "%s-prometheus.svc" .Release.Name }}:9090
# version: 1

prometheus:
prometheusSpec:
scrapeInterval: 2s
evaluationInterval: 30s
6 changes: 6 additions & 0 deletions deploy/kubernetes/terraform/values/loki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tableManager:
retention_period: 1d

monitoring:
dashboards:
enabled: true
5 changes: 5 additions & 0 deletions deploy/kubernetes/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ variable "enable_ingress_nginx" {
default = false
}

variable "enable_istio" {
description = "Enables Istio installation"
type = bool
default = true
}
variable "role_name" {
description = "Default role name"
type = string
Expand Down

0 comments on commit ca94a34

Please sign in to comment.