|
| 1 | +# Set up the providers needed to run this soak and other terraform related |
| 2 | +# business. Here we only require 'kubernetes' to interact with the soak |
| 3 | +# minikube. |
| 4 | +terraform { |
| 5 | + required_providers { |
| 6 | + kubernetes = { |
| 7 | + version = "~> 2.5.0" |
| 8 | + source = "hashicorp/kubernetes" |
| 9 | + } |
| 10 | + } |
| 11 | +} |
| 12 | + |
| 13 | +# Rig the kubernetes provider to communicate with minikube. The details of |
| 14 | +# adjusting `~/.kube/config` are addressed by the soak control scripts. |
| 15 | +provider "kubernetes" { |
| 16 | + config_path = "~/.kube/config" |
| 17 | +} |
| 18 | + |
| 19 | +# Setup background monitoring details. These are needed by the soak control to |
| 20 | +# understand what vector et al's running behavior is. |
| 21 | +module "monitoring" { |
| 22 | + source = "../../../common/terraform/modules/monitoring" |
| 23 | + type = var.type |
| 24 | + vector_image = var.vector_image |
| 25 | +} |
| 26 | + |
| 27 | +# Setup the soak pieces |
| 28 | +# |
| 29 | +# This soak config sets up a vector soak with lading/http-gen feeding into vector, |
| 30 | +# lading/http-blackhole receiving. |
| 31 | +resource "kubernetes_namespace" "soak" { |
| 32 | + metadata { |
| 33 | + name = "soak" |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +module "vector" { |
| 38 | + source = "../../../common/terraform/modules/vector" |
| 39 | + type = var.type |
| 40 | + vector_image = var.vector_image |
| 41 | + vector-toml = file("${path.module}/vector.toml") |
| 42 | + namespace = kubernetes_namespace.soak.metadata[0].name |
| 43 | + vector_cpus = var.vector_cpus |
| 44 | + depends_on = [module.monitoring] |
| 45 | +} |
| 46 | +module "http-gen" { |
| 47 | + source = "../../../common/terraform/modules/lading_http_gen" |
| 48 | + type = var.type |
| 49 | + http-gen-yaml = file("${path.module}/http_gen.yaml") |
| 50 | + # This is a hack. Ultimately this creates a configmap in the minikube, where |
| 51 | + # we would _prefer_ to simply mount a directory into the kube. This is not |
| 52 | + # possible, pending introductoin of |
| 53 | + # https://github.com/kubernetes/minikube/issues/12301 into a release. Keep in |
| 54 | + # mind that the bootstrap _must_ be below 1MB in size, which severely limits |
| 55 | + # the entropy of our experiment. |
| 56 | + http-gen-static-bootstrap = file("${path.module}/data/http_gen_bootstrap.log") |
| 57 | + namespace = kubernetes_namespace.soak.metadata[0].name |
| 58 | + lading_image = var.lading_image |
| 59 | + depends_on = [module.monitoring, module.vector] |
| 60 | +} |
0 commit comments