Skip to content

Commit

Permalink
remove local and add variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jdongo-aneo committed Nov 4, 2024
1 parent 4add7f1 commit 8e64d20
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
2 changes: 2 additions & 0 deletions monitoring/onpremise/exporters/windows-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_docker_image"></a> [docker\_image](#input\_docker\_image) | Docker image for windows exporter | <pre>object({<br> image = string<br> tag = string<br> image_pull_secrets = string<br> })</pre> | n/a | yes |
| <a name="input_init_docker_image"></a> [init\_docker\_image](#input\_init\_docker\_image) | Docker image for windows exporter | <pre>object({<br> image = string<br> tag = string<br> image_pull_secrets = string<br> })</pre> | <pre>{<br> "image": "mcr.microsoft.com/windows/nanoserver",<br> "image_pull_secrets": "",<br> "tag": "ltsc2022"<br>}</pre> | no |
| <a name="input_name"></a> [name](#input\_name) | Name for the resource | `string` | `"windows-exporter"` | 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 windows exporter | `any` | `{}` | no |

Expand Down
14 changes: 0 additions & 14 deletions monitoring/onpremise/exporters/windows-exporter/locals.tf

This file was deleted.

17 changes: 12 additions & 5 deletions monitoring/onpremise/exporters/windows-exporter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "kubectl_manifest" "windows_exporter" {
apiVersion = "apps/v1"
kind = "DaemonSet"
metadata = {
name = "windows-exporter"
name = var.name
namespace = var.namespace
labels = {
app = "armonik"
Expand Down Expand Up @@ -47,7 +47,7 @@ resource "kubectl_manifest" "windows_exporter" {
initContainers = [
{
name = "configure-firewall"
image = "mcr.microsoft.com/windows/nanoserver:ltsc2022"
image = "${var.init_docker_image.image}:${var.init_docker_image.tag}"
command = ["powershell"]
args = ["New-NetFirewallRule", "-DisplayName", "'windows-exporter'", "-Direction", "inbound", "-Profile", "Any", "-Action", "Allow", "-LocalPort", "9182", "-Protocol", "TCP"]
}
Expand Down Expand Up @@ -78,7 +78,7 @@ resource "kubectl_manifest" "windows_exporter" {
"kubernetes.io/os" = "windows"
"kubernetes.io/arch" = "amd64"
},
local.node_selector
var.node_selector
)
tolerations = concat(
[
Expand All @@ -95,7 +95,14 @@ resource "kubectl_manifest" "windows_exporter" {
effect = "NoSchedule"
}
],
local.tolerations
[
for key, value in var.node_selector : {
key = key
operator = "Equal"
value = value
effect = "NoSchedule"
}
]
)
volumes = [
{
Expand Down Expand Up @@ -126,7 +133,7 @@ resource "kubernetes_config_map" "windows_exporter_config" {
data = {
"config.yml" = yamlencode({
collectors = {
enabled = "cpu_info,container,logical_disk,memory,net,os"
enabled = "cpu_info,container,logical_disk,memory,net,os"
}
collector = {
service = {
Expand Down
22 changes: 22 additions & 0 deletions monitoring/onpremise/exporters/windows-exporter/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ variable "namespace" {
type = string
}

variable "name" {
description = "Name for the resource"
type = string
default = "windows-exporter"
}

# Docker image
variable "docker_image" {
description = "Docker image for windows exporter"
Expand All @@ -14,6 +20,22 @@ variable "docker_image" {
})
}

# Docker image
variable "init_docker_image" {
description = "Docker image for windows exporter"
type = object({
image = string
tag = string
image_pull_secrets = string
})
default = {
image = "mcr.microsoft.com/windows/nanoserver"
tag = "ltsc2022"
image_pull_secrets = ""
}
}


# Node selector
variable "node_selector" {
description = "Node selector for windows exporter"
Expand Down

0 comments on commit 8e64d20

Please sign in to comment.