Skip to content

Commit 658ab5f

Browse files
authored
use separate subnet for soaking/perf (#178)
1 parent 9d9b29c commit 658ab5f

File tree

8 files changed

+17
-3
lines changed

8 files changed

+17
-3
lines changed

terraform/ec2/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ locals {
6565

6666
# get ecr login domain
6767
ecr_login_domain = split("/", data.aws_ecr_repository.sample_app.repository_url)[0]
68+
69+
# get instance subnet, use separate subnet for soaking and performance test as it takes more instances and some times eat up all the available ip address in the subnet
70+
instance_subnet = var.testing_type == "e2e" ? tolist(module.basic_components.aoc_public_subnet_ids)[1] : tolist(module.basic_components.aoc_public_subnet_ids)[0]
6871
}
6972

7073

@@ -73,7 +76,7 @@ locals {
7376
resource "aws_instance" "sidecar" {
7477
ami = data.aws_ami.suse.id
7578
instance_type = "m5.2xlarge"
76-
subnet_id = tolist(module.basic_components.aoc_public_subnet_ids)[0]
79+
subnet_id = local.instance_subnet
7780
vpc_security_group_ids = [module.basic_components.aoc_security_group_id]
7881
associate_public_ip_address = true
7982
iam_instance_profile = module.common.aoc_iam_role_name
@@ -88,7 +91,7 @@ resource "aws_instance" "sidecar" {
8891
resource "aws_instance" "aoc" {
8992
ami = local.ami_id
9093
instance_type = local.instance_type
91-
subnet_id = tolist(module.basic_components.aoc_public_subnet_ids)[0]
94+
subnet_id = local.instance_subnet
9295
vpc_security_group_ids = [module.basic_components.aoc_security_group_id]
9396
associate_public_ip_address = true
9497
iam_instance_profile = module.common.aoc_iam_role_name

terraform/ec2/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ variable "install_package_local_path" {
9191
}
9292

9393
variable "testing_type" {
94-
default = ""
94+
default = "e2e"
9595
}
9696

9797
# flag used by canary test to run EC2 tests in canary mode

terraform/ec2_setup/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,6 @@ module "ec2_setup" {
7070
soaking_metric_namespace = var.soaking_metric_namespace
7171

7272
debug = var.debug
73+
74+
testing_type = var.testing_type
7375
}

terraform/ec2_setup/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@ variable "install_package_source" {
6767
variable "install_package_local_path" {
6868
default = "../../../aws-otel-collector/build/packages/linux/amd64/aws-otel-collector.rpm"
6969
}
70+
71+
variable "testing_type" {
72+
default = "e2e"
73+
}

terraform/performance/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ module "ec2_setup" {
4343
soaking_metric_namespace = var.performance_metric_namespace
4444

4545
debug = var.debug
46+
47+
testing_type = "perf"
4648
}
4749

4850
locals{

terraform/soaking/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module "ec2_setup" {
4444
debug = var.debug
4545
negative_soaking = var.negative_soaking
4646

47+
testing_type = "soaking"
4748
}
4849

4950
locals {

terraform/templates/defaults/soaking_docker_compose.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
limits:
1111
memory: 4G
1212
ot-metric-emitter:
13+
privileged: true
1314
image: ${sample_app_image}
1415
command: ["${data_mode}", "-r=${rate}", "-u=${grpc_endpoint}", "-d=${data_type}"]
1516
environment:

terraform/templates/defaults/soaking_docker_compose_pull_mode.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
limits:
1111
memory: 1G
1212
ot-metric-emitter:
13+
privileged: true
1314
image: ${sample_app_image}
1415
command: []
1516
ports:

0 commit comments

Comments
 (0)