diff --git a/config.tfvars b/config.tfvars index dfb3a5fa..09dd12d3 100644 --- a/config.tfvars +++ b/config.tfvars @@ -144,6 +144,31 @@ max_cluster_capacity = 5 # are passed to Helm chart. Variables from config.tfvars take precedence over those defined in a custom values.yaml. # monitoring_custom_values_file = "/path/to/values.yaml" +################################################################################ +# DCAPT JMeter and Selenium Deployment Settings +################################################################################ + +# Create deployment with a docker-in-docker privileged container. Defaults to false +# start_test_deployment = false + +# Initial CPU request for docker-in-docker container +# test_deployment_cpu_request = "1" + +# Initial memory request for docker-in-docker container +# test_deployment_mem_request = "4Gi" + +# Initial CPU limit for docker-in-docker container +# test_deployment_cpu_limit = "4" + +# Initial memory limit for docker-in-docker container +# test_deployment_mem_limit = "6Gi" + +# Image repository of the docker-in-docker container +# test_deployment_image_repo = "docker" + +# Image tag of the docker-in-docker container +# test_deployment_image_tag = "24.0.7-dind" + ################################################################################ # Jira Settings ################################################################################ @@ -629,4 +654,4 @@ crowd_db_name = "crowd" # Crowd license # To avoid storing license in a plain text file, we recommend storing it in an environment variable prefixed with `TF_VAR_` (i.e. `TF_VAR_crowd_license`) and keep the below line commented out # If storing license as plain-text is not a concern for this environment, feel free to uncomment the following line and supply the license here -#crowd_license = "" \ No newline at end of file +#crowd_license = "" diff --git a/dc-infrastructure.tf b/dc-infrastructure.tf index 571cb571..4991307d 100644 --- a/dc-infrastructure.tf +++ b/dc-infrastructure.tf @@ -36,6 +36,14 @@ module "base-infrastructure" { grafana_pvc_disk_size = var.grafana_pvc_disk_size monitoring_custom_values_file = var.monitoring_custom_values_file monitoring_grafana_expose_lb = var.monitoring_grafana_expose_lb + + test_deployment_cpu_request = var.test_deployment_cpu_request + test_deployment_mem_request = var.test_deployment_mem_request + test_deployment_cpu_limit = var.test_deployment_cpu_limit + test_deployment_mem_limit = var.test_deployment_mem_limit + test_deployment_image_repo = var.test_deployment_image_repo + test_deployment_image_tag = var.test_deployment_image_tag + start_test_deployment = var.start_test_deployment } module "bamboo" { diff --git a/docs/docs/userguide/configuration/DCAPT_CONFIGURATION.md b/docs/docs/userguide/configuration/DCAPT_CONFIGURATION.md new file mode 100644 index 00000000..018d8246 --- /dev/null +++ b/docs/docs/userguide/configuration/DCAPT_CONFIGURATION.md @@ -0,0 +1,43 @@ +# DCAPT Configuration + +Besides deploying Atlassian DC products, it is possible to spin up a testing environment to run [Data Center App Performance Toolkit tests](https://github.com/atlassian/dc-app-performance-toolkit/tree/master). + +## Create DCAPT Test Deployment + +Create an additional deployment for DCAPT Jmeter and Selenium test environment: + +```shell +start_test_deployment = true +``` + +## Configure DCAPT Test Deployment + +The default values works well with a typical DCAPT test, however, if you need to allocate more resources to the test container, +use the following variables to override the defaults: + +### Configure CPU +```shell +test_deployment_cpu_request = "1" + +test_deployment_cpu_limit = "4" +``` + +### Configure Memory + +```shell +test_deployment_mem_request = "4Gi" + +test_deployment_mem_limit = "6Gi" + +``` + +### Configure Image and Tag + +The container starts in a privileged mode to be able to run docker-in-docker. If you need to change the image repository +or tag, use the following variables: + +```shell +test_deployment_image_repo = "docker" + +test_deployment_image_tag = "24.0.7-dind" +``` \ No newline at end of file diff --git a/modules/common/main.tf b/modules/common/main.tf index a28b0a39..de9b56b7 100644 --- a/modules/common/main.tf +++ b/modules/common/main.tf @@ -61,3 +61,64 @@ resource "kubernetes_namespace" "products" { name = var.namespace } } + +resource "kubernetes_deployment" "dcapt_exec" { + count = var.start_test_deployment ? 1 : 0 + depends_on = [kubernetes_namespace.products] + metadata { + name = "dcapt" + namespace = var.namespace + labels = { + exec = "true" + } + } + spec { + replicas = 1 + selector { + match_labels = { + exec = "true" + } + } + template { + metadata { + labels = { + exec = "true" + } + } + spec { + container { + name = "dcapt" + image = "${var.test_deployment_image_repo}:${var.test_deployment_image_tag}" + security_context { privileged = true } + volume_mount { + mount_path = "/data" + name = "data" + } + resources { + requests = { + cpu = var.test_deployment_cpu_request + memory = var.test_deployment_mem_request + } + limits = { + cpu = var.test_deployment_cpu_limit + memory = var.test_deployment_mem_limit + } + } + lifecycle { + post_start { + exec { + command = ["/bin/sh", "-c", "apk add --update vim bash git"] + } + } + } + } + volume { + name = "data" + empty_dir {} + } + termination_grace_period_seconds = 0 + } + } + } +} + diff --git a/modules/common/variables.tf b/modules/common/variables.tf index 08b7efcc..ac27a87d 100644 --- a/modules/common/variables.tf +++ b/modules/common/variables.tf @@ -175,3 +175,45 @@ variable "monitoring_custom_values_file" { type = string default = "" } + +variable "start_test_deployment" { + description = "Deploy necessary resources to start DCAPT testing" + type = bool + default = false +} + +variable "test_deployment_cpu_request" { + description = "Number of CPUs for DCAPT Jmeter and Selenium deployment" + type = string + default = "1" +} + +variable "test_deployment_mem_request" { + description = "Amount of memory for DCAPT Jmeter and Selenium deployment" + type = string + default = "4Gi" +} + +variable "test_deployment_cpu_limit" { + description = "CPU limit for DCAPT Jmeter and Selenium deployment" + type = string + default = "4" +} + +variable "test_deployment_mem_limit" { + description = "Memory limit for DCAPT Jmeter and Selenium deployment" + type = string + default = "6Gi" +} + +variable "test_deployment_image_repo" { + description = "Image repository of DCAPT Jmeter and Selenium deployment" + type = string + default = "docker" +} + +variable "test_deployment_image_tag" { + description = "Image tag of DCAPT Jmeter and Selenium deployment" + type = string + default = "24.0.7-dind" +} diff --git a/variables.tf b/variables.tf index d6385c0d..fec8e464 100644 --- a/variables.tf +++ b/variables.tf @@ -1367,3 +1367,47 @@ variable "confluence_s3_attachments_storage" { type = bool default = false } + +# test deployment configuration + +variable "start_test_deployment" { + description = "Deploy necessary resources to start DCAPT testing" + type = bool + default = false +} + +variable "test_deployment_cpu_request" { + description = "Number of CPUs for DCAPT Jmeter and Selenium deployment" + type = string + default = "1" +} + +variable "test_deployment_mem_request" { + description = "Amount of memory for DCAPT Jmeter and Selenium deployment" + type = string + default = "4Gi" +} + +variable "test_deployment_cpu_limit" { + description = "CPU limit for DCAPT Jmeter and Selenium deployment" + type = string + default = "4" +} + +variable "test_deployment_mem_limit" { + description = "Memory limit for DCAPT Jmeter and Selenium deployment" + type = string + default = "6Gi" +} + +variable "test_deployment_image_repo" { + description = "Image repository of DCAPT Jmeter and Selenium deployment" + type = string + default = "docker" +} + +variable "test_deployment_image_tag" { + description = "Image tag of DCAPT Jmeter and Selenium deployment" + type = string + default = "24.0.7-dind" +}