Skip to content

Commit

Permalink
use bitnami helm chart to test prometheus-node-exporter (#1593)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hall <[email protected]>
  • Loading branch information
imjasonh authored Oct 11, 2023
1 parent f3ff122 commit 090b12d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 45 deletions.
49 changes: 17 additions & 32 deletions images/prometheus-node-exporter/tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,46 +25,31 @@ resource "random_integer" "port" {
max = 60000
}

resource "helm_release" "kube-prometheus-stack" {
name = "prometheus-${random_id.hex.hex}"
repository = "https://prometheus-community.github.io/helm-charts"
chart = "kube-prometheus-stack"
resource "helm_release" "bitnami" {
name = "prometheus-node-bitnami-${random_id.hex.hex}"
repository = "oci://registry-1.docker.io/bitnamicharts"
chart = "node-exporter"

namespace = "prometheus-${random_id.hex.hex}"
namespace = "prometheus-node-bitnami-${random_id.hex.hex}"
create_namespace = true

values = [
jsonencode({
prometheus-node-exporter = {
service = {
port = random_integer.port.result
nodePort = random_integer.port.result
targetPort = random_integer.port.result
}
image = {
registry = data.oci_string.ref.registry
repository = data.oci_string.ref.repo
digest = data.oci_string.ref.digest
service = {
ports = {
metrics = random_integer.port.result
}
}
image = {
registry = data.oci_string.ref.registry
repository = data.oci_string.ref.repo
digest = data.oci_string.ref.digest
}
})]
}

data "oci_exec_test" "node-runs" {
depends_on = [helm_release.kube-prometheus-stack]

digest = var.digest
script = "./node-runs.sh ${random_id.hex.hex}"
working_dir = path.module
env = [{
name = "PROM_PORT"
value = random_integer.port.result
}]
}

module "helm_cleanup" {
depends_on = [data.oci_exec_test.node-runs]
source = "../../../tflib/helm-cleanup"
name = helm_release.kube-prometheus-stack.id
namespace = helm_release.kube-prometheus-stack.namespace
module "helm_cleanup_bitnami" {
source = "../../../tflib/helm-cleanup"
name = helm_release.bitnami.id
namespace = helm_release.bitnami.namespace
}
13 changes: 0 additions & 13 deletions images/prometheus-node-exporter/tests/node-runs.sh

This file was deleted.

0 comments on commit 090b12d

Please sign in to comment.