Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
TF_VAR_BUILD_ID: ${{ github.run_id }}
TF_VAR_ENVIRONMENT: ci
TF_VAR_REPO: ${{ github.repository }}
TF_VAR_ec_target: qa
GOBENCH_TAGS: branch=${{ github.head_ref || github.ref }},commit=${{ github.sha }},target_branch=${{ github.base_ref }},enable_tail_sampling=${{ inputs.enableTailSampling }}
GOBENCH_PASSWORD: ${{ secrets.GOBENCH_PASSWORD }}
GOBENCH_USERNAME: ${{ secrets.GOBENCH_USERNAME }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/smoke-tests-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
TF_VAR_BRANCH: ${{ github.ref_name }}
TF_VAR_REPO: ${{ github.repository }}
TF_VAR_CREATED_DATE: ${{ needs.prepare.outputs.date }}
TF_VAR_ec_target: qa
# Required for QA usage: gcp-us-central1 is a valid QA region.
TF_VAR_region: gcp-us-central1
permissions:
contents: read
id-token: write
Expand Down
2 changes: 2 additions & 0 deletions testing/benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ In order for the `ec_deployment` provider to work against ESS, it is necessary t
an API Key by exporting the environment variable `EC_API_KEY`. To generate a new API
key in ESS, you can navigate to [Features > API Keys > Generate API Key](https://cloud.elastic.co/deployment-features/keys).

To target QA Elastic Cloud environment, set `TF_VAR_ec_target=qa` (default is `pro`).

## Usage

The `make` command is meant to be the main entrypoint to this environment, providing a light
Expand Down
12 changes: 10 additions & 2 deletions testing/benchmark/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ locals {
build = var.BUILD_ID
created_date = coalesce(var.CREATED_DATE, time_static.created_date.unix)
}
project = "apm-server-benchmarks"
project = "apm-server-benchmarks"
ec_target = lower(var.ec_target)
api_endpoints = {
qa = "https://public-api.qa.cld.elstc.co"
pro = "https://api.elastic-cloud.com"
}
}

module "tags" {
Expand All @@ -36,7 +41,9 @@ module "tags" {
project = startswith(var.user_name, "benchci") ? local.project : "${local.project}-${var.user_name}"
}

provider "ec" {}
provider "ec" {
endpoint = local.api_endpoints[local.ec_target]
}

provider "aws" {
region = var.worker_region
Expand Down Expand Up @@ -92,6 +99,7 @@ module "ec_deployment" {
count = var.run_standalone ? 0 : 1
source = "../infra/terraform/modules/ec_deployment"

ec_target = var.ec_target
region = var.ess_region
stack_version = var.stack_version

Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/16GB_ARM-x2zone.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6g.2xlarge"

worker_region = "eu-west-1"
# Elastic Cloud
ess_region = "us-west-2"
ess_region = "aws-eu-west-1"
deployment_template = "aws-cpu-optimized-faster-warm"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/16GBx2zone-aws.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6i.2xlarge"

worker_region = "eu-west-1"
# Elastic Cloud
ess_region = "us-west-2"
ess_region = "aws-eu-west-1"
deployment_template = "aws-cpu-optimized-faster-warm"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/16GBx2zone-azure.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6i.2xlarge"

worker_region = "us-east-2"
# Elastic Cloud
ess_region = "azure-westus2"
ess_region = "azure-eastus2"
deployment_template = "azure-cpu-optimized"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/16GBx2zone-gcp.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6i.2xlarge"

worker_region = "us-east-2"
# Elastic Cloud
ess_region = "gcp-us-west2"
ess_region = "gcp-us-central1"
deployment_template = "gcp-cpu-optimized"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/32GB_ARM-x2zone.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6g.4xlarge"

worker_region = "eu-west-1"
# Elastic Cloud
ess_region = "us-west-2"
ess_region = "aws-eu-west-1"
deployment_template = "aws-cpu-optimized-faster-warm"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/32GBx2zone-aws.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6i.4xlarge"

worker_region = "eu-west-1"
# Elastic Cloud
ess_region = "us-west-2"
ess_region = "aws-eu-west-1"
deployment_template = "aws-cpu-optimized-faster-warm"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/32GBx2zone-azure.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6i.4xlarge"

worker_region = "us-east-2"
# Elastic Cloud
ess_region = "azure-westus2"
ess_region = "azure-eastus2"
deployment_template = "azure-cpu-optimized"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/32GBx2zone-gcp.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6i.4xlarge"

worker_region = "us-east-2"
# Elastic Cloud
ess_region = "gcp-us-west2"
ess_region = "gcp-us-central1"
deployment_template = "gcp-cpu-optimized"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/8GB_ARM-x1zone.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6g.2xlarge"

worker_region = "us-east-2"
# Elastic Cloud
ess_region = "gcp-us-west2"
ess_region = "gcp-us-central1"
deployment_template = "gcp-cpu-optimized"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/8GBx1zone-aws.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6i.2xlarge"

worker_region = "eu-west-1"
# Elastic Cloud
ess_region = "us-west-2"
ess_region = "aws-eu-west-1"
deployment_template = "aws-cpu-optimized-faster-warm"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/8GBx1zone-azure.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6i.2xlarge"

worker_region = "us-east-2"
# Elastic Cloud
ess_region = "azure-westus2"
ess_region = "azure-eastus2"
deployment_template = "azure-cpu-optimized"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
3 changes: 2 additions & 1 deletion testing/benchmark/system-profiles/8GBx1zone-gcp.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ user_name = "USER"

worker_instance_type = "c6i.2xlarge"

worker_region = "us-east-2"
# Elastic Cloud
ess_region = "gcp-us-west2"
ess_region = "gcp-us-central1"
deployment_template = "gcp-cpu-optimized"
# The number of AZs the APM Server should span.
apm_server_zone_count = 1
Expand Down
12 changes: 12 additions & 0 deletions testing/benchmark/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ variable "stack_version" {
type = string
}

variable "ec_target" {
# We use 'pro' for production as that is the key used to retrieve EC_API_KEY from secret storage.
default = "pro"
description = "Elastic Cloud environment target. Supported values: qa, pro"
type = string

validation {
condition = contains(["qa", "pro"], lower(var.ec_target))
error_message = "ec_target must be one of: qa, pro"
}
}

variable "apm_server_size" {
default = "1g"
type = string
Expand Down
3 changes: 2 additions & 1 deletion testing/infra/terraform/modules/ec_deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ used to configure the module, please refer to the [EC Provider docs](https://reg
| <a name="input_docker_image"></a> [docker\_image](#input\_docker\_image) | Optional docker image overrides. The full map needs to be specified | `map(string)` | <pre>{<br/> "apm": "docker.elastic.co/cloud-release/elastic-agent-cloud",<br/> "elasticsearch": "docker.elastic.co/cloud-release/elasticsearch-cloud-ess",<br/> "kibana": "docker.elastic.co/cloud-release/kibana-cloud"<br/>}</pre> | no |
| <a name="input_docker_image_tag_override"></a> [docker\_image\_tag\_override](#input\_docker\_image\_tag\_override) | Optional docker image tag overrides, The full map needs to be specified | `map(string)` | <pre>{<br/> "apm": "",<br/> "elasticsearch": "",<br/> "kibana": ""<br/>}</pre> | no |
| <a name="input_drop_pipeline"></a> [drop\_pipeline](#input\_drop\_pipeline) | Whether or not to install an Elasticsearch ingest pipeline to drop all incoming APM documents. Defaults to false | `bool` | `false` | no |
| <a name="input_ec_target"></a> [ec\_target](#input\_ec\_target) | Elastic Cloud environment selector (`qa` for QA Elastic Cloud, `pro` for production Elastic Cloud) | `string` | `"pro"` | no |
| <a name="input_elasticsearch_autoscale"></a> [elasticsearch\_autoscale](#input\_elasticsearch\_autoscale) | Optional autoscale the Elasticsearch cluster | `bool` | `false` | no |
| <a name="input_elasticsearch_dedicated_masters"></a> [elasticsearch\_dedicated\_masters](#input\_elasticsearch\_dedicated\_masters) | Optionally use dedicated masters for the Elasticsearch cluster | `bool` | `false` | no |
| <a name="input_elasticsearch_size"></a> [elasticsearch\_size](#input\_elasticsearch\_size) | Optional Elasticsearch instance size | `string` | `"8g"` | no |
Expand All @@ -80,4 +81,4 @@ used to configure the module, please refer to the [EC Provider docs](https://reg
| <a name="output_elasticsearch_username"></a> [elasticsearch\_username](#output\_elasticsearch\_username) | The Elasticsearch username |
| <a name="output_kibana_url"></a> [kibana\_url](#output\_kibana\_url) | The secure Kibana URL |
| <a name="output_stack_version"></a> [stack\_version](#output\_stack\_version) | The matching stack pack version from the provided stack\_version |
<!-- END_TF_DOCS -->
<!-- END_TF_DOCS -->
14 changes: 13 additions & 1 deletion testing/infra/terraform/modules/ec_deployment/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
locals {
admin_console_urls = {
qa = "https://admin.qa.cld.elstc.co"
pro = "https://admin.found.no"
}
}

output "deployment_id" {
value = ec_deployment.deployment.id
description = "The deployment ID for the created cluster"
}

output "kibana_url" {
value = ec_deployment.deployment.kibana.0.https_endpoint
description = "The secure Kibana URL"
Expand Down Expand Up @@ -41,5 +53,5 @@ output "stack_version" {
}

output "admin_console_url" {
value = "https://admin.found.no/deployments/${ec_deployment.deployment.id}/integrations_server"
value = "${local.admin_console_urls[lower(var.ec_target)]}/deployments/${ec_deployment.deployment.id}/integrations_server"
}
10 changes: 10 additions & 0 deletions testing/infra/terraform/modules/ec_deployment/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ variable "deployment_template" {
type = string
}

variable "ec_target" {
default = "pro"
description = "Elastic Cloud environment selector (`qa` for QA Elastic Cloud, `pro` for production Elastic Cloud)"
type = string
validation {
condition = contains(["qa", "pro"], lower(var.ec_target))
error_message = "ec_target must be one of: qa, pro"
}
}

variable "stack_version" {
default = "latest"
description = "Optional stack version"
Expand Down
21 changes: 19 additions & 2 deletions testing/smoke/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
export TF_IN_AUTOMATION=1
export TF_CLI_ARGS=-no-color

ec_api_base_url() {
local effective_target="${TF_VAR_ec_target:-pro}"
effective_target="${effective_target,,}"
case "${effective_target}" in
qa)
echo "https://public-api.qa.cld.elstc.co"
;;
pro)
echo "https://api.elastic-cloud.com"
;;
*)
echo "-> Unsupported EC target: ${effective_target}. Valid values are: qa, pro." >&2
return 1
;;
esac
}

get_versions() {
if [[ -z ${EC_API_KEY} ]]; then
echo "-> ESS API Key not set, please set the EC_API_KEY environment variable."
Expand All @@ -12,7 +29,7 @@ get_versions() {
terraform_init

local REGION=$(echo var.region | terraform console | tr -d '"')
local EC_VERSION_ENDPOINT="https://cloud.elastic.co/api/v1/regions/${REGION}/stack/versions?show_deleted=false&show_unusable=false"
local EC_VERSION_ENDPOINT="$(ec_api_base_url)/api/v1/regions/${REGION}/stack/versions?show_deleted=false&show_unusable=false"
local RES
local RC=0
RES=$(curl_fail -H "Authorization: ApiKey ${EC_API_KEY}" ${EC_VERSION_ENDPOINT}) || RC=$?
Expand All @@ -34,7 +51,7 @@ get_latest_snapshot() {
terraform_init

local REGION=$(echo var.region | terraform console | tr -d '"')
local EC_VERSION_ENDPOINT="https://cloud.elastic.co/api/v1/regions/${REGION}/stack/versions?show_deleted=false&show_unusable=true"
local EC_VERSION_ENDPOINT="$(ec_api_base_url)/api/v1/regions/${REGION}/stack/versions?show_deleted=false&show_unusable=true"
local RES
local RC=0
RES=$(curl_fail -H "Authorization: ApiKey ${EC_API_KEY}" ${EC_VERSION_ENDPOINT}) || RC=$?
Expand Down
27 changes: 24 additions & 3 deletions testing/smoke/supported-os/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ terraform {
}
}

provider "ec" {}
locals {
ec_target = lower(var.ec_target)
api_endpoints = {
qa = "https://public-api.qa.cld.elstc.co"
pro = "https://api.elastic-cloud.com"
}
}

provider "ec" {
endpoint = local.api_endpoints[local.ec_target]
}

module "tags" {
source = "../../infra/terraform/modules/tags"
Expand All @@ -36,8 +46,9 @@ data "aws_vpc" "default" {
}

module "ec_deployment" {
source = "../../infra/terraform/modules/ec_deployment"
region = var.region
source = "../../infra/terraform/modules/ec_deployment"
ec_target = var.ec_target
region = var.region

deployment_template = "gcp-vector-search-optimized"
deployment_name_prefix = "supported-os-standalone"
Expand Down Expand Up @@ -85,6 +96,16 @@ variable "stack_version" {
type = string
}

variable "ec_target" {
default = "pro"
description = "Elastic Cloud environment target"
type = string
validation {
condition = contains(["qa", "pro"], lower(var.ec_target))
error_message = "ec_target must be one of: qa, pro"
}
}

variable "region" {
default = "gcp-us-west2"
description = "Optional ESS region where to run the smoke tests"
Expand Down
Loading