Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #53 from cabify/add-k8s-namespace
Browse files Browse the repository at this point in the history
Add support to kubernetes namespace
  • Loading branch information
wsilva authored Mar 20, 2019
2 parents b446957 + 09ef472 commit 4943ca0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/prometheus/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ output "trickster_service_name" {

output "trickster_service_port" {
value = "${var.trickster_port}"
}
}
14 changes: 7 additions & 7 deletions apps/prometheus/replication-controller.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ resource "kubernetes_replication_controller" "prometheus" {
}

volume {
name = "trickster-boltdb-cache"
empty_dir {}
name = "trickster-boltdb-cache"
empty_dir = {}
}

container {
Expand Down Expand Up @@ -171,14 +171,16 @@ resource "kubernetes_replication_controller" "prometheus" {
period_seconds = "${var.livenessprobe_period_seconds}"
timeout_seconds = "${var.livenessprobe_timeout_seconds}"
}

readiness_probe {
http_get {
path = "/-/ready"
port = "${var.prometheus-port}"
}
period_seconds = "${var.readinessprobe_period_seconds}"
timeout_seconds = "${var.readinessprobe_timeout_seconds}"
}

period_seconds = "${var.readinessprobe_period_seconds}"
timeout_seconds = "${var.readinessprobe_timeout_seconds}"
}
}

container {
Expand All @@ -205,7 +207,6 @@ resource "kubernetes_replication_controller" "prometheus" {
container_port = "${var.trickster_metrics_port}"
}


args = [
"--config=/etc/trickster/trickster.conf",
"--proxy-port=9092",
Expand All @@ -220,7 +221,6 @@ resource "kubernetes_replication_controller" "prometheus" {
name = "trickster-boltdb-cache"
mount_path = "/tmp/trickster/"
}

}
}
}
Expand Down
4 changes: 4 additions & 0 deletions google-cloud/kubernetes/prometheus-mysql-scraper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module "cabify_prometheus_mysql_scraper" {
user_password = "${var.user_password}"
instance_region = "${var.instance_region}"
project = "${var.project}"
namespace = "${var.namespace}"
}
```
**NOTE:** We start a [cloudsql proxy](https://github.com/GoogleCloudPlatform/cloudsql-proxy) as part of the deployment and connect the scraper to it. This proxy needs its own service account so it has `connect` privileges to the db. It connects via a string such as: `cabify-staging:us-central1:corporate-master`. This translates to to following with the variables:
Expand All @@ -37,3 +38,6 @@ module "cabify_prometheus_mysql_scraper" {
### project
**Description:** "Name of the gcp project"

### namespace
**Description:** "Name of the kubernetes namespace"

6 changes: 6 additions & 0 deletions google-cloud/sql/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,9 @@ variable "project" {
description = "Name of gcp project"
type = "string"
}

variable "namespace" {
description = "Name of kubernetes namespace"
type = "string"
default = "prometheus"
}
1 change: 1 addition & 0 deletions google-cloud/sql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,5 @@ module "cabify_prometheus_mysql_scraper" {
user_password = "${var.user_password}"
instance_region = "${var.instance_region}"
project = "${var.project}"
namespace = "${var.namespace}"
}

0 comments on commit 4943ca0

Please sign in to comment.