From e0687402b93315090b9aad9c619fe81a9711529f Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Thu, 17 Nov 2022 14:25:59 +0530 Subject: [PATCH] chore: remove kubemonkey from services (#105) * chore: remove kubemonkey from services * chore: run make fmt --- examples/gcp/services/main.tf | 14 ++--- modules/services/kubemonkey-values.yml.tmpl | 16 ------ modules/services/kubemonkey.tf | 22 -------- modules/services/variables.tf | 61 ++++++++------------- 4 files changed, 28 insertions(+), 85 deletions(-) delete mode 100644 modules/services/kubemonkey-values.yml.tmpl delete mode 100644 modules/services/kubemonkey.tf diff --git a/examples/gcp/services/main.tf b/examples/gcp/services/main.tf index 8336f869..0a4bd46f 100644 --- a/examples/gcp/services/main.tf +++ b/examples/gcp/services/main.tf @@ -31,12 +31,10 @@ module "services" { source = "git::https://github.com/GaloyMoney/galoy-infra.git//modules/services?ref=5aed769" # source = "../../../modules/services" - name_prefix = var.name_prefix - letsencrypt_issuer_email = var.letsencrypt_issuer_email - cluster_endpoint = var.cluster_endpoint - cluster_ca_cert = var.cluster_ca_cert - small_footprint = true - kubemonkey_enabled = true - honeycomb_api_key = "dummy" - kubemonkey_notification_url = "dummy" + name_prefix = var.name_prefix + letsencrypt_issuer_email = var.letsencrypt_issuer_email + cluster_endpoint = var.cluster_endpoint + cluster_ca_cert = var.cluster_ca_cert + small_footprint = true + honeycomb_api_key = "dummy" } diff --git a/modules/services/kubemonkey-values.yml.tmpl b/modules/services/kubemonkey-values.yml.tmpl deleted file mode 100644 index f055934d..00000000 --- a/modules/services/kubemonkey-values.yml.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -config: - dryRun: false - runHour: 0 - startHour: 3 - endHour: 5 - timeZone: ${timeZone} - whitelistedNamespaces: -%{ for ns in whitelistedNamespaces ~} - - ${ns} -%{ endfor ~} - notifications: - enabled: true - attacks: | - endpoint = "${notificationUrl}" - message = '{"text":"Attacked `{$name}` of `{$namespace}` on {$date} at {$time}. {$error}"}' - headers = ["Content-Type:application/json"] diff --git a/modules/services/kubemonkey.tf b/modules/services/kubemonkey.tf deleted file mode 100644 index 00609603..00000000 --- a/modules/services/kubemonkey.tf +++ /dev/null @@ -1,22 +0,0 @@ -resource "kubernetes_namespace" "kubemonkey" { - count = local.kubemonkey_enabled ? 1 : 0 - metadata { - name = local.kubemonkey_namespace - } -} - -resource "helm_release" "kubemonkey" { - count = local.kubemonkey_enabled ? 1 : 0 - name = "kubemonkey" - chart = "kube-monkey" - repository = "https://asobti.github.io/kube-monkey/charts/repo" - namespace = kubernetes_namespace.kubemonkey[0].metadata[0].name - - values = [ - templatefile("${path.module}/kubemonkey-values.yml.tmpl", { - timeZone : local.kubemonkey_time_zone - whitelistedNamespaces : local.kubemonkey_whitelisted_namespaces - notificationUrl : local.kubemonkey_notification_url - }) - ] -} diff --git a/modules/services/variables.tf b/modules/services/variables.tf index 682c0372..dc857ba6 100644 --- a/modules/services/variables.tf +++ b/modules/services/variables.tf @@ -14,11 +14,6 @@ variable "trace_sample_pct" { default = 100 } -variable "kubemonkey_notification_url" { - default = "" - sensitive = true -} - variable "ingress_nginx_version" { default = "4.0.18" } @@ -28,43 +23,31 @@ variable "cert_manager_version" { variable "letsencrypt_issuer_email" {} variable "local_deploy" { default = false } variable "small_footprint" { default = false } -variable "kubemonkey_enabled" { default = false } -variable "kubemonkey_time_zone" { default = "Etc/UTC" } variable "smoketest_cronjob" { default = false } locals { - local_deploy = var.local_deploy - name_prefix = var.name_prefix - smoketest_namespace = "${local.name_prefix}-smoketest" - otel_namespace = "${local.name_prefix}-otel" - kubemonkey_namespace = "${local.name_prefix}-kubemonkey" - galoy_namespace = "${local.name_prefix}-galoy" - bitcoin_namespace = "${var.name_prefix}-bitcoin" - monitoring_namespace = "${var.name_prefix}-monitoring" - addons_namespace = "${var.name_prefix}-addons" - smoketest_cronjob = var.smoketest_cronjob - smoketest_name = "smoketest" - smoketest_cronjob_name = "${local.smoketest_name}-cronjob" - cluster_endpoint = var.cluster_endpoint - cluster_ca_cert = var.cluster_ca_cert - ingress_namespace = "${local.name_prefix}-ingress" - ingress_nginx_version = var.ingress_nginx_version - cert_manager_version = var.cert_manager_version - letsencrypt_issuer_email = var.letsencrypt_issuer_email - jaeger_host = "opentelemetry-collector.${local.otel_namespace}.svc.cluster.local" - trace_sample_pct = var.trace_sample_pct - ingress_service_name = "${var.name_prefix}-ingress" - small_footprint = var.small_footprint - honeycomb_api_key = var.honeycomb_api_key != "" ? var.honeycomb_api_key : jsondecode(var.secrets).honeycomb_api_key - kubemonkey_enabled = var.kubemonkey_enabled - kubemonkey_time_zone = var.kubemonkey_time_zone - kubemonkey_notification_url = var.kubemonkey_notification_url != "" ? var.kubemonkey_notification_url : jsondecode(var.secrets).kubemonkey_notification_url - kubemonkey_whitelisted_namespaces = [ - local.galoy_namespace, - local.bitcoin_namespace, - local.monitoring_namespace, - local.addons_namespace, - ] + local_deploy = var.local_deploy + name_prefix = var.name_prefix + smoketest_namespace = "${local.name_prefix}-smoketest" + otel_namespace = "${local.name_prefix}-otel" + galoy_namespace = "${local.name_prefix}-galoy" + bitcoin_namespace = "${var.name_prefix}-bitcoin" + monitoring_namespace = "${var.name_prefix}-monitoring" + addons_namespace = "${var.name_prefix}-addons" + smoketest_cronjob = var.smoketest_cronjob + smoketest_name = "smoketest" + smoketest_cronjob_name = "${local.smoketest_name}-cronjob" + cluster_endpoint = var.cluster_endpoint + cluster_ca_cert = var.cluster_ca_cert + ingress_namespace = "${local.name_prefix}-ingress" + ingress_nginx_version = var.ingress_nginx_version + cert_manager_version = var.cert_manager_version + letsencrypt_issuer_email = var.letsencrypt_issuer_email + jaeger_host = "opentelemetry-collector.${local.otel_namespace}.svc.cluster.local" + trace_sample_pct = var.trace_sample_pct + ingress_service_name = "${var.name_prefix}-ingress" + small_footprint = var.small_footprint + honeycomb_api_key = var.honeycomb_api_key != "" ? var.honeycomb_api_key : jsondecode(var.secrets).honeycomb_api_key } output "smoketest_kubeconfig" {