Browse Source

Support multi node with volume claim

master
RouxAntoine 5 months ago
parent
commit
f714d83eb9
Signed by: antoine <antoinroux@hotmail.fr> GPG Key ID: 098FB66FC0475E70
2 changed files with 20 additions and 5 deletions
  1. +19
    -4
      manifests/common.tf
  2. +1
    -1
      pkg/check/df.go

+ 19
- 4
manifests/common.tf View File

@@ -16,7 +16,7 @@ dest_channel_id = "${var.dest_channel_id}"
webhook_id = "${var.webhook_id}"

df {
fs_name = "/dev/mapper/vg1-data--kube"
fs_name = "10.32.0.152:/export/pvc-"
critical = "85"
}
EOF
@@ -28,6 +28,22 @@ locals {
checked_filesystem = "host-checked-filesystem"
}

resource "kubernetes_persistent_volume_claim" "var_lib_kubernetes_volume_claim" {
metadata {
namespace = kubernetes_namespace.monitoring_namespace.id
name = "monitoring-slack-bot-pvc"
}
spec {
storage_class_name = "dx30-nfs"
access_modes = ["ReadWriteMany"]
resources {
requests = {
storage = "2Gi"
}
}
}
}

resource "kubernetes_cron_job" "slack_bot_checker" {
metadata {
name = "system-cron-bot-job"
@@ -57,9 +73,8 @@ resource "kubernetes_cron_job" "slack_bot_checker" {
spec {
volume {
name = local.checked_filesystem
host_path {
path = "/var/lib/kubernetes/volumes"
type = "Directory"
persistent_volume_claim {
claim_name = kubernetes_persistent_volume_claim.var_lib_kubernetes_volume_claim.metadata.0.name
}
}
volume {


+ 1
- 1
pkg/check/df.go View File

@@ -86,7 +86,7 @@ func (dc *DfChecker) FileSystemUsedCheck(dfOut DfStdout, param DfParameter) noti
}
found := false
for _, line := range dfOut {
if line.Filesystem == param.FileSystemName {
if strings.Contains(line.Filesystem, param.FileSystemName) {
if line.PourcentUsed > param.CriticalPourcent {
text := fmt.Sprintf("%s : fs '%s' critial %d%%, used %d%% \n", dc.alertingMessage, line.Filesystem, param.CriticalPourcent, line.PourcentUsed)
message = notify.Message{


Loading…
Cancel
Save