Skip to content

Commit

Permalink
[tf/gcp] add monitoring/logging option (aptos-labs#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
sherry-x authored May 12, 2022
1 parent 467f8d9 commit 9ed4c83
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
61 changes: 61 additions & 0 deletions terraform/aptos-node/gcp/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,64 @@ resource "helm_release" "validator" {
value = var.helm_force_update ? timestamp() : ""
}
}

resource "helm_release" "logger" {
count = var.enable_logger ? 1 : 0
name = "${terraform.workspace}-log"
chart = "${path.module}/../../helm/logger"
max_history = 10
wait = false

values = [
jsonencode({
logger = {
name = "aptos-logger"
}
chain = {
name = var.chain_name
}
serviceAccount = {
create = false
name = "${terraform.workspace}-aptos-node-validator"
}
}),
jsonencode(var.logger_helm_values),
]

set {
name = "timestamp"
value = timestamp()
}
}

resource "helm_release" "monitoring" {
count = var.enable_monitoring ? 1 : 0
name = "${terraform.workspace}-mon"
chart = "${path.module}/../../helm/monitoring"
max_history = 10
wait = false

values = [
jsonencode({
chain = {
name = var.chain_name
}
validator = {
name = var.validator_name
}
monitoring = {
prometheus = {
storage = {
class = kubernetes_storage_class.ssd.metadata[0].name
}
}
}
}),
jsonencode(var.monitoring_helm_values),
]

set {
name = "timestamp"
value = timestamp()
}
}
22 changes: 22 additions & 0 deletions terraform/aptos-node/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,25 @@ variable "validator_instance_num" {
description = "Number of instances used for validator and fullnodes"
default = 2
}

variable "enable_logger" {
description = "Enable logger pod"
default = false
}

variable "logger_helm_values" {
description = "Map of values to pass to logger Helm"
type = any
default = {}
}

variable "enable_monitoring" {
description = "Enable logger pod"
default = false
}

variable "monitoring_helm_values" {
description = "Map of values to pass to monitoring Helm"
type = any
default = {}
}

0 comments on commit 9ed4c83

Please sign in to comment.