Skip to content

Commit

Permalink
feat: variabilize fluentbit hostpath (#1221)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngruelaneo authored Oct 11, 2023
2 parents ad8d2f5 + 98bc3e3 commit 5338da3
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 119 deletions.
23 changes: 13 additions & 10 deletions infrastructure/quick-deploy/aws/all-in-one/monitoring.tf
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,19 @@ module "fluent_bit" {
namespace = local.namespace
node_selector = var.fluent_bit.node_selector
fluent_bit = {
container_name = "fluent-bit"
image = local.ecr_images["${var.fluent_bit.image_name}:${try(coalesce(var.fluent_bit.image_tag), "")}"].image
tag = local.ecr_images["${var.fluent_bit.image_name}:${try(coalesce(var.fluent_bit.image_tag), "")}"].tag
parser = var.fluent_bit.parser
image_pull_secrets = var.fluent_bit.pull_secrets
is_daemonset = var.fluent_bit.is_daemonset
http_server = (var.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.fluent_bit.http_port == 0 ? "" : tostring(var.fluent_bit.http_port))
read_from_head = (var.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.fluent_bit.read_from_head ? "Off" : "On")
container_name = "fluent-bit"
image = local.ecr_images["${var.fluent_bit.image_name}:${try(coalesce(var.fluent_bit.image_tag), "")}"].image
tag = local.ecr_images["${var.fluent_bit.image_name}:${try(coalesce(var.fluent_bit.image_tag), "")}"].tag
parser = var.fluent_bit.parser
image_pull_secrets = var.fluent_bit.pull_secrets
is_daemonset = var.fluent_bit.is_daemonset
http_server = (var.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.fluent_bit.http_port == 0 ? "" : tostring(var.fluent_bit.http_port))
read_from_head = (var.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.fluent_bit.read_from_head ? "Off" : "On")
fluentbitstate_hostpath = var.fluent_bit.fluentbitstate_hostpath
varlibdockercontainers_hostpath = var.fluent_bit.varlibdockercontainers_hostpath
runlogjournal_hostpath = var.fluent_bit.runlogjournal_hostpath
}
seq = length(module.seq) != 0 ? {
host = module.seq[0].host
Expand Down
19 changes: 11 additions & 8 deletions infrastructure/quick-deploy/aws/all-in-one/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,17 @@ variable "partition_metrics_exporter" {
variable "fluent_bit" {
description = "Fluent bit configuration"
type = object({
image_name = optional(string, "fluent/fluent-bit")
image_tag = optional(string)
pull_secrets = optional(string, "")
is_daemonset = optional(bool, true)
http_port = optional(number, 2020)
read_from_head = optional(bool, true)
node_selector = optional(any, {})
parser = optional(string, "cri")
image_name = optional(string, "fluent/fluent-bit")
image_tag = optional(string)
pull_secrets = optional(string, "")
is_daemonset = optional(bool, true)
http_port = optional(number, 2020)
read_from_head = optional(bool, true)
node_selector = optional(any, {})
parser = optional(string, "cri")
fluentbitstate_hostpath = optional(string, "/var/fluent-bit/state")
varlibdockercontainers_hostpath = optional(string, "/var/lib/docker/containers")
runlogjournal_hostpath = optional(string, "/run/log/journal")
})
default = {}
}
Expand Down
25 changes: 14 additions & 11 deletions infrastructure/quick-deploy/aws/multi-stages/monitoring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,19 @@ module "fluent_bit" {
namespace = var.namespace
node_selector = local.fluent_bit_node_selector
fluent_bit = {
container_name = "fluent-bit"
image = local.fluent_bit_image
tag = local.fluent_bit_tag
image_pull_secrets = local.fluent_bit_image_pull_secrets
is_daemonset = local.fluent_bit_is_daemonset
parser = local.fluent_bit_parser
http_server = (local.fluent_bit_http_port == 0 ? "Off" : "On")
http_port = (local.fluent_bit_http_port == 0 ? "" : tostring(local.fluent_bit_http_port))
read_from_head = (local.fluent_bit_read_from_head ? "On" : "Off")
read_from_tail = (local.fluent_bit_read_from_head ? "Off" : "On")
container_name = "fluent-bit"
image = local.fluent_bit_image
tag = local.fluent_bit_tag
image_pull_secrets = local.fluent_bit_image_pull_secrets
is_daemonset = local.fluent_bit_is_daemonset
parser = local.fluent_bit_parser
http_server = (local.fluent_bit_http_port == 0 ? "Off" : "On")
http_port = (local.fluent_bit_http_port == 0 ? "" : tostring(local.fluent_bit_http_port))
read_from_head = (local.fluent_bit_read_from_head ? "On" : "Off")
read_from_tail = (local.fluent_bit_read_from_head ? "Off" : "On")
fluentbitstate_hostpath = var.monitoring.fluent_bit.fluentbitstate_hostpath
varlibdockercontainers_hostpath = var.monitoring.fluent_bit.varlibdockercontainers_hostpath
runlogjournal_hostpath = var.monitoring.fluent_bit.runlogjournal_hostpath
}
seq = (local.seq_enabled ? {
host = module.seq.0.host
Expand All @@ -150,7 +153,7 @@ module "fluent_bit" {
s3 = (local.s3_enabled ? {
name = local.s3_name
region = local.s3_region
prefix = local.s3_prefix
prefix = local.suffix
enabled = true
} : {})
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,21 @@ monitoring = {
enabled = true
name = "armonik-logs"
region = "eu-west-3"
prefix = local.suffix
prefix = "main"
arn = "arn:aws:s3:::armonik-logs"
}
fluent_bit = {
image = "fluent-bit"
tag = "2.1.7"
image_pull_secrets = ""
is_daemonset = true
http_port = 2020 # 0 or 2020
read_from_head = true
node_selector = {}
parser = "cri"
image = "fluent-bit"
tag = "2.1.7"
image_pull_secrets = ""
is_daemonset = true
http_port = 2020 # 0 or 2020
read_from_head = true
node_selector = {}
parser = "cri"
fluentbitstate_hostpath = "/var/fluent-bit/state"
varlibdockercontainers_hostpath = "/var/lib/docker/containers"
runlogjournal_hostpath = "/run/log/journal"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,17 @@ variable "monitoring" {
prefix = string
})
fluent_bit = object({
image = string
tag = string
image_pull_secrets = string
is_daemonset = bool
http_port = number
read_from_head = string
node_selector = any
parser = string
image = string
tag = string
image_pull_secrets = string
is_daemonset = bool
http_port = number
read_from_head = string
node_selector = any
parser = string
fluentbitstate_hostpath = string
varlibdockercontainers_hostpath = string
runlogjournal_hostpath = string
})
})
}
Expand Down
23 changes: 13 additions & 10 deletions infrastructure/quick-deploy/gcp/all-in-one/monitoring.tf
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,19 @@ module "fluent_bit" {
namespace = local.namespace
node_selector = var.fluent_bit.node_selector
fluent_bit = {
container_name = "fluent-bit"
image = local.docker_images["${var.fluent_bit.image_name}:${try(coalesce(var.fluent_bit.image_tag), "")}"].image
tag = local.docker_images["${var.fluent_bit.image_name}:${try(coalesce(var.fluent_bit.image_tag), "")}"].tag
parser = var.fluent_bit.parser
image_pull_secrets = var.fluent_bit.pull_secrets
is_daemonset = var.fluent_bit.is_daemonset
http_server = (var.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.fluent_bit.http_port == 0 ? "" : tostring(var.fluent_bit.http_port))
read_from_head = (var.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.fluent_bit.read_from_head ? "Off" : "On")
container_name = "fluent-bit"
image = local.docker_images["${var.fluent_bit.image_name}:${try(coalesce(var.fluent_bit.image_tag), "")}"].image
tag = local.docker_images["${var.fluent_bit.image_name}:${try(coalesce(var.fluent_bit.image_tag), "")}"].tag
parser = var.fluent_bit.parser
image_pull_secrets = var.fluent_bit.pull_secrets
is_daemonset = var.fluent_bit.is_daemonset
http_server = (var.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.fluent_bit.http_port == 0 ? "" : tostring(var.fluent_bit.http_port))
read_from_head = (var.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.fluent_bit.read_from_head ? "Off" : "On")
fluentbitstate_hostpath = var.fluent_bit.fluentbitstate_hostpath
varlibdockercontainers_hostpath = var.fluent_bit.varlibdockercontainers_hostpath
runlogjournal_hostpath = var.fluent_bit.runlogjournal_hostpath
}
seq = length(module.seq) != 0 ? {
host = module.seq[0].host
Expand Down
19 changes: 11 additions & 8 deletions infrastructure/quick-deploy/gcp/all-in-one/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,17 @@ variable "partition_metrics_exporter" {
variable "fluent_bit" {
description = "Fluent bit configuration"
type = object({
image_name = optional(string, "fluent/fluent-bit")
image_tag = optional(string)
pull_secrets = optional(string, "")
is_daemonset = optional(bool, true)
http_port = optional(number, 2020)
read_from_head = optional(bool, true)
node_selector = optional(any, {})
parser = optional(string, "cri")
image_name = optional(string, "fluent/fluent-bit")
image_tag = optional(string)
pull_secrets = optional(string, "")
is_daemonset = optional(bool, true)
http_port = optional(number, 2020)
read_from_head = optional(bool, true)
node_selector = optional(any, {})
parser = optional(string, "cri")
fluentbitstate_hostpath = optional(string, "/var/log/fluent-bit/state")
varlibdockercontainers_hostpath = optional(string, "/var/log/lib/docker/containers")
runlogjournal_hostpath = optional(string, "/var/log/run/log/journal")
})
default = {}
}
Expand Down
23 changes: 13 additions & 10 deletions infrastructure/quick-deploy/gcp/multi-stages/monitoring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,19 @@ module "fluent_bit" {
namespace = var.namespace
node_selector = var.fluent_bit.node_selector
fluent_bit = {
container_name = "fluent-bit"
image = var.gar.repositories[local.fluent_bit_image_key]
tag = var.fluent_bit.image_tag
parser = var.fluent_bit.parser
image_pull_secrets = var.fluent_bit.pull_secrets
is_daemonset = var.fluent_bit.is_daemonset
http_server = (var.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.fluent_bit.http_port == 0 ? "" : tostring(var.fluent_bit.http_port))
read_from_head = (var.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.fluent_bit.read_from_head ? "Off" : "On")
container_name = "fluent-bit"
image = var.gar.repositories[local.fluent_bit_image_key]
tag = var.fluent_bit.image_tag
parser = var.fluent_bit.parser
image_pull_secrets = var.fluent_bit.pull_secrets
is_daemonset = var.fluent_bit.is_daemonset
http_server = (var.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.fluent_bit.http_port == 0 ? "" : tostring(var.fluent_bit.http_port))
read_from_head = (var.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.fluent_bit.read_from_head ? "Off" : "On")
fluentbitstate_hostpath = var.fluent_bit.fluentbitstate_hostpath
varlibdockercontainers_hostpath = var.fluent_bit.varlibdockercontainers_hostpath
runlogjournal_hostpath = var.fluent_bit.runlogjournal_hostpath
}
seq = length(module.seq) != 0 ? {
host = module.seq[0].host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,17 @@ variable "grafana" {
variable "fluent_bit" {
description = "Fluent bit configuration"
type = object({
image_name = optional(string, "fluent/fluent-bit")
image_tag = optional(string, "2.1.7")
pull_secrets = optional(string, "")
is_daemonset = optional(bool, true)
http_port = optional(number, 2020)
read_from_head = optional(bool, true)
node_selector = optional(any, {})
parser = optional(string, "cri")
image_name = optional(string, "fluent/fluent-bit")
image_tag = optional(string, "2.1.7")
pull_secrets = optional(string, "")
is_daemonset = optional(bool, true)
http_port = optional(number, 2020)
read_from_head = optional(bool, true)
node_selector = optional(any, {})
parser = optional(string, "cri")
fluentbitstate_hostpath = optional(string, "/var/log/fluent-bit/state")
varlibdockercontainers_hostpath = optional(string, "/var/log/lib/docker/containers")
runlogjournal_hostpath = optional(string, "/var/log/run/log/journal")
})
default = {}
}
24 changes: 14 additions & 10 deletions infrastructure/quick-deploy/localhost/all-in-one/monitoring.tf
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,20 @@ module "fluent_bit" {
namespace = local.namespace
node_selector = var.fluent_bit.node_selector
fluent_bit = {
container_name = "fluent-bit"
image = var.fluent_bit.image_name
tag = try(coalesce(var.fluent_bit.image_tag), local.default_tags[var.fluent_bit.image_name])
parser = var.fluent_bit.parser
image_pull_secrets = var.fluent_bit.pull_secrets
is_daemonset = var.fluent_bit.is_daemonset
http_server = (var.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.fluent_bit.http_port == 0 ? "" : tostring(var.fluent_bit.http_port))
read_from_head = (var.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.fluent_bit.read_from_head ? "Off" : "On")
container_name = "fluent-bit"
image = var.fluent_bit.image_name
tag = try(coalesce(var.fluent_bit.image_tag), local.default_tags[var.fluent_bit.image_name])
parser = var.fluent_bit.parser
image_pull_secrets = var.fluent_bit.pull_secrets
is_daemonset = var.fluent_bit.is_daemonset
http_server = (var.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.fluent_bit.http_port == 0 ? "" : tostring(var.fluent_bit.http_port))
read_from_head = (var.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.fluent_bit.read_from_head ? "Off" : "On")
fluentbitstate_hostpath = var.fluent_bit.fluentbitstate_hostpath
varlibdockercontainers_hostpath = var.fluent_bit.varlibdockercontainers_hostpath
runlogjournal_hostpath = var.fluent_bit.runlogjournal_hostpath

}
seq = length(module.seq) != 0 ? {
host = module.seq[0].host
Expand Down
19 changes: 11 additions & 8 deletions infrastructure/quick-deploy/localhost/all-in-one/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,17 @@ variable "partition_metrics_exporter" {
variable "fluent_bit" {
description = "Fluent bit configuration"
type = object({
image_name = optional(string, "fluent/fluent-bit")
image_tag = optional(string)
pull_secrets = optional(string, "")
is_daemonset = optional(bool, true)
http_port = optional(number, 2020)
read_from_head = optional(bool, true)
node_selector = optional(any, {})
parser = optional(string, "docker")
image_name = optional(string, "fluent/fluent-bit")
image_tag = optional(string)
pull_secrets = optional(string, "")
is_daemonset = optional(bool, true)
http_port = optional(number, 2020)
read_from_head = optional(bool, true)
node_selector = optional(any, {})
parser = optional(string, "docker")
fluentbitstate_hostpath = optional(string, "/var/fluent-bit/state")
varlibdockercontainers_hostpath = optional(string, "/var/lib/docker/containers")
runlogjournal_hostpath = optional(string, "/run/log/journal")
})
default = {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,18 @@ module "fluent_bit" {
enabled = true
} : {})
fluent_bit = {
container_name = "fluent-bit"
image = var.monitoring.fluent_bit.image_name
tag = try(var.image_tags[var.monitoring.fluent_bit.image_name], var.monitoring.fluent_bit.image_tag)
image_pull_secrets = var.monitoring.fluent_bit.image_pull_secrets
is_daemonset = var.monitoring.fluent_bit.is_daemonset
parser = var.monitoring.fluent_bit.parser
http_server = (var.monitoring.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.monitoring.fluent_bit.http_port == 0 ? "" : tostring(var.monitoring.fluent_bit.http_port))
read_from_head = (var.monitoring.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.monitoring.fluent_bit.read_from_head ? "Off" : "On")
container_name = "fluent-bit"
image = var.monitoring.fluent_bit.image_name
tag = try(var.image_tags[var.monitoring.fluent_bit.image_name], var.monitoring.fluent_bit.image_tag)
image_pull_secrets = var.monitoring.fluent_bit.image_pull_secrets
is_daemonset = var.monitoring.fluent_bit.is_daemonset
parser = var.monitoring.fluent_bit.parser
http_server = (var.monitoring.fluent_bit.http_port == 0 ? "Off" : "On")
http_port = (var.monitoring.fluent_bit.http_port == 0 ? "" : tostring(var.monitoring.fluent_bit.http_port))
read_from_head = (var.monitoring.fluent_bit.read_from_head ? "On" : "Off")
read_from_tail = (var.monitoring.fluent_bit.read_from_head ? "Off" : "On")
fluentbitstate_hostpath = var.monitoring.fluent_bit.fluentbitstate_hostpath
varlibdockercontainers_hostpath = var.monitoring.fluent_bit.varlibdockercontainers_hostpath
runlogjournal_hostpath = var.monitoring.fluent_bit.runlogjournal_hostpath
}
}
Loading

0 comments on commit 5338da3

Please sign in to comment.