diff --git a/README.md b/README.md index d5d8943..18a6afb 100644 --- a/README.md +++ b/README.md @@ -83,21 +83,23 @@ loki_resources | Compute Resources required by loki container. CPU/RAM requests promtail_resources | Compute Resources required by promtail container. CPU/RAM requests | `map` |
{|
request_cpu = "20m"
request_memory = "50Mi"
}
{| no ### Loki variables -Name | Description | Type | Default | Example | Required ---- | --- | --- | --- |--- |--- -loki_name | Loki application name | `string` | `loki` | n/a | no -loki_docker_image | Image for Loki container | `string` | `grafana/loki:2.3.0` | n/a | no -loki_termination_grace_period_seconds | Grace period applies to the total time it takes for both the PreStop hook to execute and for the Container to stop normally | `integer` | `4800` | n/a | no -loki_port | Port mapping to kubernetes service |
request_cpu = "20m"
request_memory = "50Mi"
}
list(object({|
name = string
internal_port = integer
external_port = integer
}))
\[| n/a | no -loki_node_selector | Select node to deploy loki stack | `map` | `null` |
{
name = "http-metrics"
internal_port = 3100
external_port = 3100
}
]
{| no -loki_service_account_annotations | Add additional account annotations to Loki service account | `map` | `ReadWriteMany` | n/a | no +Name | Description | Type | Default | Example | Required +--- |-----------------------------------------------------------------------------------------------------------------------------| --- |--------------------------------------------------------------------------------------------------------------------------------|--- |--- +loki_name | Loki application name | `string` | `loki` | n/a | no +loki_docker_image | Image for Loki container | `string` | `grafana/loki:2.3.0` | n/a | no +loki_termination_grace_period_seconds | Grace period applies to the total time it takes for both the PreStop hook to execute and for the Container to stop normally | `integer` | `4800` | n/a | no +loki_port | Port mapping to kubernetes service |
(local.node_spot_label_key) = false
(local.node_multi_az_label_key) = true
}
list(object({|
name = string
internal_port = integer
external_port = integer
}))
\[| n/a | no +loki_node_selector | Select node to deploy loki stack | `map` | `null` |
{
name = "http-metrics"
internal_port = 3100
external_port = 3100
}
]
{| no +loki_toleration | Loki Pod node tolerations |
(local.node_spot_label_key) = false
(local.node_multi_az_label_key) = true
}
list(object({| `[]` |
effect = string // (Optional)
key = string // (Optional)
operator = string // (Optional)
toleration_seconds = number // (Optional)
value = string // (Optional)
}))
[| no | +loki_service_account_annotations | Add additional account annotations to Loki service account | `map` | `ReadWriteMany` | n/a | no ### Promtail -Name | Description | Type | Default | Example | Required ---- | --- | --- | --- |--- |--- -promtail_name | Promtail application name | `string` | `monitoring-alertmanager-pv` | n/a | no -promtail_docker_image | Image for Promtail container | `string` | `2Gi` | n/a | no -promtail_internal_port | Port mapping to daemon-set |
{
effect = "NoSchedule"
key = "gpu"
operator = "Equal"
value = "true"
}
]
list(object({|
name = string
internal_port = integer
}))
\[| n/a | no +Name | Description | Type | Default | Example | Required +--- |-------------------------------| --- | --- |--- |--- +promtail_name | Promtail application name | `string` | `monitoring-alertmanager-pv` | n/a | no +promtail_docker_image | Image for Promtail container | `string` | `2Gi` | n/a | no +promtail_internal_port | Port mapping to daemon-set |
{
name = "http-metrics"
internal_port = 3100
}
]
list(object({|
name = string
internal_port = integer
}))
\[| n/a | no +promtail_toleration | Promtail pod node tolerations |
{
name = "http-metrics"
internal_port = 3100
}
]
list(object({| `[]` |
effect = string // (Optional)
key = string // (Optional)
operator = string // (Optional)
toleration_seconds = number // (Optional)
value = string // (Optional)
}))
[| no | ### Storage variables Name | Description | Type | Default | Example | Required diff --git a/loki.tf b/loki.tf index 66db637..658116c 100644 --- a/loki.tf +++ b/loki.tf @@ -45,6 +45,7 @@ module "loki_stateful_set" { args = ["-config.file=/etc/loki/loki.yaml"] node_selector = var.loki_node_selector + toleration = var.loki_toleration internal_port = var.loki_port security_context = [ diff --git a/promtail.tf b/promtail.tf index ca242dc..fc44637 100644 --- a/promtail.tf +++ b/promtail.tf @@ -23,12 +23,15 @@ module "promtail_daemonset" { name = var.promtail_name namespace = var.create_namespace ? kubernetes_namespace.namespace[0].id : var.namespace - args = ["-config.file=/etc/promtail/promtail.yaml", "-client.url=http://${module.loki_service.name}:3100/loki/api/v1/push"] + args = [ + "-config.file=/etc/promtail/promtail.yaml", "-client.url=http://${module.loki_service.name}:3100/loki/api/v1/push" + ] service_account_name = kubernetes_service_account.promtail.metadata[0].name service_account_token = true - resources = var.promtail_resources + resources = var.promtail_resources + toleration = var.promtail_toleration env_field = { "HOSTNAME" = "spec.nodeName" @@ -50,7 +53,7 @@ module "promtail_daemonset" { period_seconds = 10 success_threshold = 1 timeout_seconds = 1 - http_get = { + http_get = { path = "/ready" port = var.promtail_internal_port.0.name scheme = "HTTP" diff --git a/variables.tf b/variables.tf index 955bca9..e6a1d07 100644 --- a/variables.tf +++ b/variables.tf @@ -67,6 +67,9 @@ variable "loki_port" { variable "loki_node_selector" { default = null } +variable "loki_toleration" { + default = [] +} variable "loki_service_account_annotations" { default = {} } @@ -90,6 +93,10 @@ variable "promtail_internal_port" { ] } +variable "promtail_toleration" { + default = [] +} + variable "provider_type" { description = "Choose what type of provider you want (aws, azure, gcp and local)" // SUPPORTS ONLY: aws, azure, gcp and local
{
effect = "NoSchedule"
key = "gpu"
operator = "Equal"
value = "true"
}
]