Skip to content

Commit

Permalink
create windows configmaps only if windows nodes exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jdongo-aneo committed Dec 30, 2024
1 parent f1b80dd commit 59b6969
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
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.34.0 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | >= 2.21.1 |

## Modules

Expand All @@ -30,8 +30,8 @@ No modules.
| [kubernetes_config_map.fluent_bit_envvars_config](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) | resource |
| [kubernetes_config_map.fluent_bit_envvars_config_windows](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) | resource |
| [kubernetes_daemonset.fluent_bit](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/daemonset) | resource |
| [kubernetes_secret.aws_auth_config](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret) | resource |
| [kubernetes_daemonset.fluent_bit_windows](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/daemonset) | resource |
| [kubernetes_secret.aws_auth_config](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret) | resource |
| [kubernetes_service_account.fluent_bit](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service_account) | resource |
| [kubernetes_service_account.fluent_bit_windows](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service_account) | resource |

Expand Down
1 change: 1 addition & 0 deletions monitoring/onpremise/fluent-bit/entrypoint-configmap.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
resource "kubernetes_config_map" "fluent_bit_entrypoint" {
count = (length(var.node_selector_windows) > 0 ? 1 : 0)
metadata {
name = "fluent-bit-entrypoint"
namespace = var.namespace
Expand Down
3 changes: 2 additions & 1 deletion monitoring/onpremise/fluent-bit/envvars-configmap-windows.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configmap with all the variables
resource "kubernetes_config_map" "fluent_bit_envvars_config_windows" {
count = (length(var.node_selector_windows) > 0 ? 1 : 0)
metadata {
name = "fluent-bit-envvars-config-windows"
namespace = var.namespace
Expand All @@ -17,7 +18,7 @@ resource "kubernetes_config_map" "fluent_bit_envvars_config_windows" {
APPLICATION_CLOUDWATCH_AUTO_CREATE_LOG_GROUP = (local.cloudwatch_name == "" && local.cloudwatch_enabled)
AWS_S3_NAME = local.s3_name
AWS_REGION_S3 = local.s3_region
PREFIX = local.s3_prefix
S3_KEY_FORMAT = local.s3_key_format
PARSER = local.fluent_bit_windows_parser
KUBE_CA_FILE = local.fluent_bit_kube_ca_file_windows
KUBE_TOKEN_FILE = local.fluent_bit_kube_token_file_windows
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# configmap with all the variables
resource "kubernetes_config_map" "fluent_bit_config_windows" {
count = (length(var.node_selector_windows) > 0 ? 1 : 0)
metadata {
name = "fluent-bit-configmap-windows"
namespace = var.namespace
Expand Down
6 changes: 3 additions & 3 deletions monitoring/onpremise/fluent-bit/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ resource "kubernetes_daemonset" "fluent_bit_windows" {
}
env_from {
config_map_ref {
name = kubernetes_config_map.fluent_bit_envvars_config_windows.metadata[0].name
name = kubernetes_config_map.fluent_bit_envvars_config_windows[0].metadata[0].name
}
}
volume_mount {
Expand Down Expand Up @@ -260,13 +260,13 @@ resource "kubernetes_daemonset" "fluent_bit_windows" {
volume {
name = "fluent-bit-config"
config_map {
name = kubernetes_config_map.fluent_bit_config_windows.metadata[0].name
name = kubernetes_config_map.fluent_bit_config_windows[0].metadata[0].name
}
}
volume {
name = "entrypoint-script"
config_map {
name = kubernetes_config_map.fluent_bit_entrypoint.metadata[0].name
name = kubernetes_config_map.fluent_bit_entrypoint[0].metadata[0].name
}
}
host_network = false
Expand Down
6 changes: 3 additions & 3 deletions monitoring/onpremise/fluent-bit/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ output "windows_is_daemonset" {
output "windows_configmaps" {
description = "Configmaps of Fluent-bit"
value = {
envvars = kubernetes_config_map.fluent_bit_envvars_config_windows.metadata[0].name
config = kubernetes_config_map.fluent_bit_config_windows.metadata[0].name
entry = kubernetes_config_map.fluent_bit_entrypoint.metadata[0].name
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
}
}

0 comments on commit 59b6969

Please sign in to comment.