From b8ea606636d30b590dcd1052e5f242650c82d279 Mon Sep 17 00:00:00 2001 From: Andreas Andersson Date: Mon, 31 Jan 2022 07:21:58 +0100 Subject: [PATCH] Stat breaking down this module. --- aws/rds/exporter_deployment.tf | 201 --------------------------------- 1 file changed, 201 deletions(-) delete mode 100644 aws/rds/exporter_deployment.tf diff --git a/aws/rds/exporter_deployment.tf b/aws/rds/exporter_deployment.tf deleted file mode 100644 index 21db461..0000000 --- a/aws/rds/exporter_deployment.tf +++ /dev/null @@ -1,201 +0,0 @@ -resource "kubernetes_deployment" "rds" { - wait_for_rollout = true - metadata { - name = "${var.instance_name}-${replace(var.aws_account, "cabify-", "")}-mysql-scraper" - - labels = { - app = format("%.60s", md5("${var.instance_name}${var.aws_account}")) - } - - namespace = var.namespace - } - - spec { - - selector { - match_labels = { - app = format("%.60s", md5("${var.instance_name}${var.aws_account}")) - } - } - - template { - metadata { - name = "${var.instance_name}-${replace(var.aws_account, "cabify-", "")}-mysql-rds-exporter" - - labels = { - app = format("%.60s", md5("${var.instance_name}${var.aws_account}")) - } - } - spec { - restart_policy = "Always" - automount_service_account_token = false - enable_service_links = true - - container { - resources { - limits = { - cpu = "250m" - memory = "50Mi" - } - - requests = { - cpu = "100m" - memory = "25Mi" - } - } - - image = "us.gcr.io/cabify-controlpanel/infrastructure/persistence/dockerfiles/mysqld-exporter-rds-ssl/mysqld-exporter-rds-ssl" - name = "exporter" - - port { - container_port = 9104 - } - - env { - name = "EXPORTER_USERNAME" - - value_from { - secret_key_ref { - name = kubernetes_secret.rds.metadata[0].name - key = "exporter_username" - } - } - } - - env { - name = "EXPORTER_PASSWORD" - - value_from { - secret_key_ref { - name = kubernetes_secret.rds.metadata[0].name - key = "exporter_password" - } - } - } - - env { - name = "EXPORTER_HOSTNAME" - value = aws_db_instance.primary.address - } - - args = concat(var.exporter_collector_flags, aws_db_instance.primary.performance_insights_enabled ? var.exporter_collector_perf_flags : []) - - liveness_probe { - http_get { - path = "/" - port = 9104 - } - - initial_delay_seconds = 5 - period_seconds = 3 - } - } - } - } - } -} - -resource "kubernetes_deployment" "rds-read-only" { - count = var.read_only_replicas - wait_for_rollout = true - - metadata { - name = "${var.instance_name}-read-replica-${count.index + 1}-${replace(var.aws_account, "cabify-", "")}-mysql-rds-exporter" - - labels = { - app = format( - "%.60s", - md5( - "${var.instance_name}-read-replica-${count.index + 1}-${var.aws_account}", - ), - ) - } - - namespace = var.namespace - } - - spec { - selector { - match_labels = { - app = format("%.60s", md5("${var.instance_name}-read-replica-${count.index + 1}-${var.aws_account}")) - } - } - - template { - metadata { - name = "${var.instance_name}-read-replica-${count.index + 1}-${replace(var.aws_account, "cabify-", "")}-mysql-rds-scraper" - - labels = { - app = format("%.60s", md5("${var.instance_name}-read-replica-${count.index + 1}-${var.aws_account}")) - } - } - - spec { - restart_policy = "Always" - automount_service_account_token = false - enable_service_links = true - - container { - resources { - limits = { - cpu = "250m" - memory = "50Mi" - } - - requests = { - cpu = "100m" - memory = "25Mi" - } - } - - image = "us.gcr.io/cabify-controlpanel/infrastructure/persistence/dockerfiles/mysqld-exporter-rds-ssl/mysqld-exporter-rds-ssl" - name = "exporter" - - port { - container_port = 9104 - } - - env { - name = "EXPORTER_USERNAME" - - value_from { - secret_key_ref { - name = kubernetes_secret.rds.metadata[0].name - key = "exporter_username" - } - } - } - - env { - name = "EXPORTER_PASSWORD" - - value_from { - secret_key_ref { - name = kubernetes_secret.rds.metadata[0].name - key = "exporter_password" - } - } - } - - env { - name = "EXPORTER_HOSTNAME" - value = aws_db_instance.read-replica[count.index].address - - } - - args = concat(var.exporter_collector_flags, aws_db_instance.primary.performance_insights_enabled ? var.exporter_collector_perf_flags : []) - - liveness_probe { - http_get { - path = "/" - port = 9104 - } - - initial_delay_seconds = 5 - period_seconds = 3 - } - } - } - } - } -}