Skip to content

feat: start remote writing prometheus data #16235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use community chart
  • Loading branch information
f0ssel committed Jan 23, 2025
commit c43d65f7803602e566333fd0546dc13830727417
44 changes: 5 additions & 39 deletions scaletest/terraform/action/prometheus.tf
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
locals {
prometheus_helm_repo = "oci://registry-1.docker.io/bitnamicharts"
prometheus_helm_chart = "kube-prometheus"
prometheus_helm_repo = "https://prometheus-community.github.io/helm-charts"
prometheus_helm_chart = "kube-prometheus-stack"
prometheus_release_name = "prometheus"
prometheus_namespace = "prometheus"
prometheus_remote_write_send_interval = "15s"
prometheus_remote_write_metrics_regex = ".*"
}

resource "kubernetes_namespace" "prometheus_namespace_primary" {
provider = kubernetes.primary

metadata {
name = local.prometheus_namespace
}
lifecycle {
ignore_changes = [timeouts, wait_for_default_service_account]
}
}

resource "helm_release" "prometheus_chart_primary" {
provider = helm.primary

repository = local.prometheus_helm_repo
chart = local.prometheus_helm_chart
name = local.prometheus_release_name
namespace = kubernetes_namespace.prometheus_namespace_primary.metadata.0.name
namespace = kubernetes_namespace.coder_primary.metadata.0.name
values = [templatefile("${path.module}/prometheus_helm_values.tftpl", {
nodepool = google_container_node_pool.node_pool["primary_misc"].name,
cluster = "primary",
Expand Down Expand Up @@ -55,24 +43,13 @@ YAML
depends_on = [helm_release.prometheus_chart_primary]
}

resource "kubernetes_namespace" "prometheus_namespace_europe" {
provider = kubernetes.europe

metadata {
name = local.prometheus_namespace
}
lifecycle {
ignore_changes = [timeouts, wait_for_default_service_account]
}
}

resource "helm_release" "prometheus_chart_europe" {
provider = helm.europe

repository = local.prometheus_helm_repo
chart = local.prometheus_helm_chart
name = local.prometheus_release_name
namespace = kubernetes_namespace.prometheus_namespace_europe.metadata.0.name
namespace = kubernetes_namespace.coder_europe.metadata.0.name
values = [templatefile("${path.module}/prometheus_helm_values.tftpl", {
nodepool = google_container_node_pool.node_pool["europe_misc"].name,
cluster = "europe",
Expand Down Expand Up @@ -103,24 +80,13 @@ YAML
depends_on = [helm_release.prometheus_chart_europe]
}

resource "kubernetes_namespace" "prometheus_namespace_asia" {
provider = kubernetes.asia

metadata {
name = local.prometheus_namespace
}
lifecycle {
ignore_changes = [timeouts, wait_for_default_service_account]
}
}

resource "helm_release" "prometheus_chart_asia" {
provider = helm.asia

repository = local.prometheus_helm_repo
chart = local.prometheus_helm_chart
name = local.prometheus_release_name
namespace = kubernetes_namespace.prometheus_namespace_asia.metadata.0.name
namespace = kubernetes_namespace.coder_asia.metadata.0.name
values = [templatefile("${path.module}/prometheus_helm_values.tftpl", {
nodepool = google_container_node_pool.node_pool["asia_misc"].name,
cluster = "asia",
Expand Down
42 changes: 17 additions & 25 deletions scaletest/terraform/action/prometheus_helm_values.tftpl
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
alertmanager:
enabled: false
blackboxExporter:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "cloud.google.com/gke-nodepool"
operator: "In"
values: ["${nodepool}"]
operator:
grafana:
enabled: false
prometheusOperator:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -27,18 +20,17 @@ prometheus:
- key: "cloud.google.com/gke-nodepool"
operator: "In"
values: ["${nodepool}"]
externalLabels:
cluster: "${cluster}"
persistence:
enabled: true
storageClass: standard
remoteWrite:
- url: "${prometheus_remote_write_url}"
tlsConfig:
insecureSkipVerify: true
writeRelabelConfigs:
- sourceLabels: [__name__]
regex: "${prometheus_remote_write_metrics_regex}"
action: keep
metadataConfig:
sendInterval: "${prometheus_remote_write_send_interval}"
prometheusSpec:
externalLabels:
cluster: "${cluster}"
podMonitorSelectorNilUsesHelmValues: false
remoteWrite:
- url: "${prometheus_remote_write_url}"
tlsConfig:
insecureSkipVerify: true
writeRelabelConfigs:
- sourceLabels: [__name__]
regex: "${prometheus_remote_write_metrics_regex}"
action: keep
metadataConfig:
sendInterval: "${prometheus_remote_write_send_interval}"
Loading