Skip to content

Commit

Permalink
Merge pull request #15 from sailthru/native-prometheus
Browse files Browse the repository at this point in the history
Native prometheus
  • Loading branch information
moskyb authored Jul 24, 2020
2 parents 0b63579 + 67276c7 commit 889f46e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 154 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | `<list>` | no |
Expand Down
57 changes: 3 additions & 54 deletions daemonset.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -33,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}"
Expand Down
72 changes: 3 additions & 69 deletions deployment.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -37,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}"
Expand Down Expand Up @@ -117,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"

Expand Down
30 changes: 0 additions & 30 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 = ""
Expand Down

0 comments on commit 889f46e

Please sign in to comment.