From 19cec4aea35000cf4521f037d0df2f429b40a3bc Mon Sep 17 00:00:00 2001 From: Ben Moskovitz Date: Fri, 24 Jul 2020 12:23:23 +1200 Subject: [PATCH 1/2] Add prometheus scrape annotations --- daemonset.tf | 5 +++-- deployment.tf | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/daemonset.tf b/daemonset.tf index 12b0e1f..19f203e 100644 --- a/daemonset.tf +++ b/daemonset.tf @@ -18,12 +18,13 @@ resource "kubernetes_daemonset" "this" { metadata { annotations = { "sidecar.istio.io/inject" = false - "prometheus.io/port" = "9102" + "prometheus.io/port" = 8877 "prometheus.io/scrape" = true + "prometheus.io/path" = "/metrics" } labels = { - terrafrom = "true" + terraform = "true", app = var.name } } diff --git a/deployment.tf b/deployment.tf index 83897fe..224b3d5 100644 --- a/deployment.tf +++ b/deployment.tf @@ -22,12 +22,13 @@ resource "kubernetes_deployment" "this" { metadata { annotations = { "sidecar.istio.io/inject" = false - "prometheus.io/port" = "9102" + "prometheus.io/port" = 8877 "prometheus.io/scrape" = true + "prometheus.io/path" = "/metrics" } labels = { - terrafrom = "true", + terraform = "true", app = var.name } } From 67276c744df87047076fd608ee6cebaa49308341 Mon Sep 17 00:00:00 2001 From: Ben Moskovitz Date: Fri, 24 Jul 2020 12:23:44 +1200 Subject: [PATCH 2/2] Remove statsd exporter --- README.md | 1 - daemonset.tf | 52 --------------------------------------- deployment.tf | 67 --------------------------------------------------- variables.tf | 30 ----------------------- 4 files changed, 150 deletions(-) diff --git a/README.md b/README.md index fc114d4..edb1e3c 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,6 @@ module "ambassador" { | cluster_role_name | Set cluster rolne name, defaults to name | string | `` | no | | daemon_set | If true Create a daemonSet. By default Deployment controller will be created | string | `false` | no | | exporter_configuration | Prometheus exporter configuration in YALM format | string | `` | no | -| exporter_image | Prometheus exporter image | string | `prom/statsd-exporter` | no | | exporter_image_tag | Prometheus exporter image tag | string | `v0.6.0` | no | | image_pull_policy | Image pull policy | string | `IfNotPresent` | no | | image_pull_secrets | Image pull secrets | list | `` | no | diff --git a/daemonset.tf b/daemonset.tf index 19f203e..ac8e913 100644 --- a/daemonset.tf +++ b/daemonset.tf @@ -34,58 +34,6 @@ resource "kubernetes_daemonset" "this" { automount_service_account_token = true restart_policy = "Always" - volume { - name = "stats-exporter-mapping-config" - - config_map { - name = "${var.name}-config" - - items { - key = "exporterConfiguration" - path = "mapping-config.yaml" - } - } - } - - container { - name = "${var.name}-statsd-sink" - image = "${var.exporter_image}:${var.exporter_image_tag}" - image_pull_policy = var.image_pull_policy - - args = [ - "-statsd.listen-address=:8125", - "-statsd.mapping-config=/statsd-exporter/mapping-config.yaml", - ] - - resources { - requests { - memory = var.resources_statsd_requests_memory - cpu = var.resources_statsd_requests_cpu - } - - limits { - memory = var.resources_statsd_limits_memory - cpu = var.resources_statsd_limits_cpu - } - } - - port { - container_port = 9102 - name = "metrics" - protocol = "TCP" - } - port { - container_port = 8125 - name = "listener" - protocol = "TCP" - } - - volume_mount { - mount_path = "/statsd-exporter/" - name = "stats-exporter-mapping-config" - read_only = true - } - } container { name = var.name image = "${var.ambassador_image}:${var.ambassador_image_tag}" diff --git a/deployment.tf b/deployment.tf index 224b3d5..e06a5a7 100644 --- a/deployment.tf +++ b/deployment.tf @@ -38,58 +38,6 @@ resource "kubernetes_deployment" "this" { automount_service_account_token = true restart_policy = "Always" - volume { - name = "stats-exporter-mapping-config" - - config_map { - name = "${var.name}-config" - - items { - key = "exporterConfiguration" - path = "mapping-config.yaml" - } - } - } - - container { - name = "${var.name}-statsd-sink" - image = "${var.exporter_image}:${var.exporter_image_tag}" - image_pull_policy = var.image_pull_policy - - args = [ - "-statsd.listen-address=:8125", - "-statsd.mapping-config=/statsd-exporter/mapping-config.yaml", - ] - - resources { - requests { - memory = var.resources_statsd_requests_memory - cpu = var.resources_statsd_requests_cpu - } - - limits { - memory = var.resources_statsd_limits_memory - cpu = var.resources_statsd_limits_cpu - } - } - - port { - container_port = 9102 - name = "metrics" - protocol = "TCP" - } - port { - container_port = 8125 - name = "listener" - protocol = "TCP" - } - - volume_mount { - mount_path = "/statsd-exporter/" - name = "stats-exporter-mapping-config" - read_only = true - } - } container { name = var.name image = "${var.ambassador_image}:${var.ambassador_image_tag}" @@ -118,21 +66,6 @@ resource "kubernetes_deployment" "this" { value = var.ambassador_debug } - env { - name = "STATSD_ENABLED" - value = true - } - - env { - name = "STATSD_HOST" - value = "localhost" - } - - env { - name = "STATSD_PORT" - value = 8125 - } - env { name = "AMBASSADOR_NAMESPACE" diff --git a/variables.tf b/variables.tf index 27b6424..ac14196 100644 --- a/variables.tf +++ b/variables.tf @@ -76,26 +76,6 @@ variable "resources_limits_memory" { default = "1Gi" } -variable "resources_statsd_requests_cpu" { - description = "CPU requests for statsd sidecar container" - default = "50m" -} - -variable "resources_statsd_requests_memory" { - description = "memory requests for statsd sidecar container" - default = "100Mi" -} - -variable "resources_statsd_limits_cpu" { - description = "CPU limit for statsd sidecar container" - default = "50m" -} - -variable "resources_statsd_limits_memory" { - description = "memory limit for statsd sidecar container" - default = "100Mi" -} - variable "rbac_create" { default = true description = "If true, create and use RBAC resources" @@ -203,16 +183,6 @@ variable "exporter_configuration" { default = "" } -variable "exporter_image" { - description = " Prometheus exporter image" - default = "prom/statsd-exporter" -} - -variable "exporter_image_tag" { - description = " Prometheus exporter image tag" - default = "v0.6.0" -} - variable "timing_restart" { description = "The minimum number of seconds between Envoy restarts" default = ""