Skip to content

Commit

Permalink
add optional for fluent_bit windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jdongo-aneo committed Dec 30, 2024
1 parent 59b6969 commit 4641028
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 36 deletions.
12 changes: 6 additions & 6 deletions armonik/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

| Name | Version |
|------|---------|
| <a name="provider_helm"></a> [helm](#provider\_helm) | >= 2.10.1 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | >= 2.21.1 |
| <a name="provider_local"></a> [local](#provider\_local) | >= 2.1.0 |
| <a name="provider_pkcs12"></a> [pkcs12](#provider\_pkcs12) | >= 0.0.7 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.5.1 |
| <a name="provider_tls"></a> [tls](#provider\_tls) | >= 4.0.4 |
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.12.1 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.26.0 |
| <a name="provider_local"></a> [local](#provider\_local) | 2.4.1 |
| <a name="provider_pkcs12"></a> [pkcs12](#provider\_pkcs12) | 0.2.5 |
| <a name="provider_random"></a> [random](#provider\_random) | 3.6.0 |
| <a name="provider_tls"></a> [tls](#provider\_tls) | 4.0.5 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion armonik/compute-plane.tf
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ resource "kubernetes_deployment" "compute_plane" {
command = ["powershell", "-ExecutionPolicy", "Bypass", "-File", "C:/fluent-bit/entrypoint.ps1"]
env_from {
config_map_ref {
name = var.fluent_bit.windows_configmaps.envvars
name = try(var.fluent_bit.windows_configmaps.envvars, "")
}
}
# Please don't change below read-only permissions
Expand Down
2 changes: 1 addition & 1 deletion armonik/control-plane.tf
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ resource "kubernetes_deployment" "control_plane" {
command = ["powershell", "-ExecutionPolicy", "Bypass", "-File", "C:/fluent-bit/entrypoint.ps1"]
env_from {
config_map_ref {
name = var.fluent_bit.windows_configmaps.envvars
name = try(var.fluent_bit.windows_configmaps.envvars, "")
}
}
# Please don't change below read-only permissions
Expand Down
8 changes: 7 additions & 1 deletion armonik/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ locals {
# Fluent-bit volumes
# Please don't change below read-only permissions
fluent_bit_volumes = {
fluentbitstate = {
mount_path = "/var/fluent-bit/state"
read_only = false
type = "host_path"
}
varlog = {
mount_path = "/var/log"
read_only = true
Expand Down Expand Up @@ -86,7 +91,8 @@ locals {
}
}
# Fluent-bit volumes windows
fluent_bit_windows_volumes = {
fluent_bit_windows_volumes = !var.fluent_bit.windows_is_daemonset ? local.volumes_info : {}
volumes_info = {
windowsfluentbitstate = {
mount_path = "C:\\var\\fluent-bit\\state"
read_only = false
Expand Down
4 changes: 2 additions & 2 deletions monitoring/onpremise/fluent-bit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

| Name | Version |
|------|---------|
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | >= 2.21.1 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.34.0 |

## Modules

Expand Down Expand Up @@ -42,7 +42,7 @@ No modules.
| <a name="input_aws"></a> [aws](#input\_aws) | AWS user for logs, prefer to pass them through env('AWS\_*') in your parameters.tfvars | <pre>object({<br> aws_secret_access_key = optional(string, "")<br> aws_access_id = optional(string, "")<br> aws_session_token = optional(string, "")<br> })</pre> | `{}` | no |
| <a name="input_cloudwatch"></a> [cloudwatch](#input\_cloudwatch) | CloudWatch info | `any` | `{}` | no |
| <a name="input_fluent_bit"></a> [fluent\_bit](#input\_fluent\_bit) | Parameters of Fluent bit | <pre>object({<br> container_name = string<br> image = string<br> tag = string<br> is_daemonset = bool<br> http_server = string<br> http_port = string<br> read_from_head = string<br> read_from_tail = string<br> image_pull_secrets = string<br> parser = string<br> fluent_bit_state_hostpath = string # path = "/var/log/fluent-bit/state" for GCP Autopilot | path = "/var/fluent-bit/state" for localhost, AWS EKS, GCP GKE<br> var_lib_docker_containers_hostpath = string # path = "/var/log/lib/docker/containers" for GCP Autopilot | path = "/var/lib/docker/containers" for localhost, AWS EKS, GCP GKE<br> run_log_journal_hostpath = string # path = "/var/log/run/log/journal" -for GCP Autopilot | path = "/run/log/journal" for localhost, AWS EKS, GCP GKE<br> })</pre> | n/a | yes |
| <a name="input_fluent_bit_windows"></a> [fluent\_bit\_windows](#input\_fluent\_bit\_windows) | Parameters of Fluent bit for windows | <pre>object({<br> container_name = string<br> image = string<br> tag = string<br> is_daemonset = bool<br> http_server = string<br> http_port = string<br> read_from_head = string<br> read_from_tail = string<br> image_pull_secrets = string<br> parser = string<br> fluent_bit_state_hostpath = string<br> var_lib_docker_containers_hostpath = string<br> run_log_journal_hostpath = string<br> })</pre> | n/a | yes |
| <a name="input_fluent_bit_windows"></a> [fluent\_bit\_windows](#input\_fluent\_bit\_windows) | Parameters of Fluent bit for windows | <pre>object({<br> container_name = optional(string)<br> image = optional(string)<br> tag = optional(string)<br> is_daemonset = optional(bool)<br> http_server = optional(string)<br> http_port = optional(string)<br> read_from_head = optional(string)<br> read_from_tail = optional(string)<br> image_pull_secrets = optional(string)<br> parser = optional(string)<br> fluent_bit_state_hostpath = optional(string)<br> var_lib_docker_containers_hostpath = optional(string)<br> run_log_journal_hostpath = optional(string)<br> })</pre> | `null` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace of ArmoniK monitoring | `string` | n/a | yes |
| <a name="input_node_selector"></a> [node\_selector](#input\_node\_selector) | Node selector for fluent-bit on linux | `any` | `{}` | no |
| <a name="input_node_selector_windows"></a> [node\_selector\_windows](#input\_node\_selector\_windows) | Node selector for fluent-bit on windows | `any` | `{}` | no |
Expand Down
2 changes: 1 addition & 1 deletion monitoring/onpremise/fluent-bit/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ locals {
fluent_bit_windows_image = try(var.fluent_bit_windows.image, "fluent/fluent-bit")
fluent_bit_windows_tag = try(var.fluent_bit_windows.tag, "windows-2022-3.2.0")
fluent_bit_windows_is_daemonset = tobool(try(var.fluent_bit_windows.is_daemonset, false))
fluent_bit_windows_parser = try(var.fluent_bit_windows.parser)
fluent_bit_windows_parser = try(var.fluent_bit_windows.parser, "")
fluent_bit_windows_http_server = try(var.fluent_bit_windows.http_server, "Off")
fluent_bit_windows_http_port = try(var.fluent_bit_windows.http_port, "")
fluent_bit_windows_read_from_head = try(var.fluent_bit_windows.read_from_head, "On")
Expand Down
14 changes: 7 additions & 7 deletions monitoring/onpremise/fluent-bit/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,29 @@ output "configmaps" {

output "windows_container_name" {
description = "Container name of Fluent-bit"
value = var.fluent_bit_windows.container_name
value = var.fluent_bit_windows != null ? var.fluent_bit_windows.container_name : ""
}

output "windows_image" {
description = "image of Fluent-bit"
value = var.fluent_bit_windows.image
value = var.fluent_bit_windows != null ? var.fluent_bit_windows.image : ""
}

output "windows_tag" {
description = "tag of Fluent-bit"
value = var.fluent_bit_windows.tag
value = var.fluent_bit_windows != null ? var.fluent_bit_windows.tag : ""
}

output "windows_is_daemonset" {
description = "Is Fluent-bit a daemonset"
value = var.fluent_bit_windows.is_daemonset
value = var.fluent_bit_windows != null ? var.fluent_bit_windows.is_daemonset : true
}

output "windows_configmaps" {
description = "Configmaps of Fluent-bit"
value = {
envvars = kubernetes_config_map.fluent_bit_envvars_config_windows[0].metadata[0].name
config = kubernetes_config_map.fluent_bit_config_windows[0].metadata[0].name
entry = kubernetes_config_map.fluent_bit_entrypoint[0].metadata[0].name
envvars = var.fluent_bit_windows != null ? kubernetes_config_map.fluent_bit_envvars_config_windows[0].metadata[0].name : ""
config = var.fluent_bit_windows != null ? kubernetes_config_map.fluent_bit_config_windows[0].metadata[0].name : ""
entry = var.fluent_bit_windows != null ? kubernetes_config_map.fluent_bit_entrypoint[0].metadata[0].name : ""
}
}
31 changes: 14 additions & 17 deletions monitoring/onpremise/fluent-bit/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,19 @@ variable "fluent_bit" {
variable "fluent_bit_windows" {
description = "Parameters of Fluent bit for windows"
type = object({
container_name = string
image = string
tag = string
is_daemonset = bool
http_server = string
http_port = string
read_from_head = string
read_from_tail = string
image_pull_secrets = string
parser = string
fluent_bit_state_hostpath = string
var_lib_docker_containers_hostpath = string
run_log_journal_hostpath = string
container_name = optional(string)
image = optional(string)
tag = optional(string)
is_daemonset = optional(bool)
http_server = optional(string)
http_port = optional(string)
read_from_head = optional(string)
read_from_tail = optional(string)
image_pull_secrets = optional(string)
parser = optional(string)
fluent_bit_state_hostpath = optional(string)
var_lib_docker_containers_hostpath = optional(string)
run_log_journal_hostpath = optional(string)
})
validation {
condition = contains(["apache", "apache2", "apache_error", "nginx", "json", "docker", "cri", "syslog"], var.fluent_bit_windows.parser)
error_message = "Valid values for Fluent-bit parsers are: \"apache\" | \"apache2\" | \"apache_error\" | \"nginx\" | \"json\" | \"docker\" | \"cri\" | \"syslog\"."
}
default = null
}

0 comments on commit 4641028

Please sign in to comment.