From fb453d5c1ffa384c003e0ee464d447683e6e5e56 Mon Sep 17 00:00:00 2001 From: Navfarm Date: Sat, 29 Mar 2025 18:39:27 +0800 Subject: [PATCH] [PFMENG-2991] - Enable Option to Customize FluentBit Livess Probe and Readiness Probe --- modules/essentials/fluent_bit.tf | 4 ++- modules/essentials/templates/fluent_bit.yaml | 23 +++--------- modules/essentials/variables.tf | 37 ++++++++++++++++++++ 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/modules/essentials/fluent_bit.tf b/modules/essentials/fluent_bit.tf index 51baafaf..3ad252a6 100644 --- a/modules/essentials/fluent_bit.tf +++ b/modules/essentials/fluent_bit.tf @@ -15,13 +15,15 @@ locals { service_account_name = local.service_account_name, image_repository = var.fluent_bit_image_repository, image_tag = var.fluent_bit_image_tag, + liveness_probe = jsonencode(var.fluent_bit_liveness_probe), + readiness_probe = jsonencode(var.fluent_bit_readiness_probe), + resources = jsonencode(var.fluent_bit_resources), }) fluent_bit_helm_config = merge( local.default_helm_config, var.fluent_bit_helm_config ) - } #tfsec:ignore:aws-cloudwatch-log-group-customer-key Not using CMK to save cost diff --git a/modules/essentials/templates/fluent_bit.yaml b/modules/essentials/templates/fluent_bit.yaml index 57792fd2..07aedb99 100644 --- a/modules/essentials/templates/fluent_bit.yaml +++ b/modules/essentials/templates/fluent_bit.yaml @@ -32,23 +32,11 @@ service: # prometheus.io/port: "2020" # prometheus.io/scrape: "true" -livenessProbe: - httpGet: - path: / - port: http - -readinessProbe: - httpGet: - path: /api/v1/health - port: http - -resources: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi +livenessProbe: ${liveness_probe} + +readinessProbe: ${readiness_probe} + +resources: ${resources} flush: 1 @@ -71,7 +59,6 @@ config: Time_Key time Time_Format %d/%b/%Y:%H:%M:%S %z - ## https://docs.fluentbit.io/manual/pipeline/inputs inputs: | [INPUT] diff --git a/modules/essentials/variables.tf b/modules/essentials/variables.tf index cb477f5a..c6b82477 100644 --- a/modules/essentials/variables.tf +++ b/modules/essentials/variables.tf @@ -1505,6 +1505,43 @@ variable "fluent_bit_overwrite_helm_values" { default = "" } +variable "fluent_bit_liveness_probe" { + description = "Liveness probe for fluent-bit" + type = map(any) + default = { + httpGet = { + path = "/" + port = "2020" + } + } +} + +variable "fluent_bit_readiness_probe" { + description = "Readiness probe for fluent-bit" + type = map(any) + default = { + httpGet = { + path = "/api/v1/health" + port = "2020" + } + } +} + +variable "fluent_bit_resources" { + description = "Resources for fluent-bit" + type = map(any) + default = { + requests = { + cpu = "100m" + memory = "128Mi" + } + limits = { + cpu = "100m" + memory = "128Mi" + } + } +} + variable "ip_dual_stack_enabled" { description = "Enable essentials to support EKS dual stack cluster" type = bool