commit
3b82ccf510
|
@ -1,6 +1,6 @@
|
|||
# Load testing an application running on an autopilot cluster
|
||||
|
||||
This blueprint creates an Autopilot cluster with Google-managed Prometheus enabled and install an application that scales as the traffic that is hitting the load balancer exposing it grows. It also installs the tooling required to distributed load test with [locust](https://locust.io) on that application and the monitoring tooling required to observe how things evolve in the cluster during the load test. Ansible is used to install the application and all the tooling on a management VM.
|
||||
This blueprint creates an Autopilot cluster with Google-managed Prometheus enabled and installs an application that scales as the traffic that is hitting the load balancer exposing it grows. It also installs the tooling required to distributed load test with [locust](https://locust.io) on that application and the monitoring tooling required to observe how things evolve in the cluster during the load test. Ansible is used to install the application and all the tooling on a management VM.
|
||||
|
||||
The diagram below depicts the architecture.
|
||||
|
||||
|
@ -64,13 +64,14 @@ Alternatively you can also check all the above using the dashboards available in
|
|||
|
||||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [project_id](variables.tf#L75) | Project ID. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L68) | Project ID. | <code>string</code> | ✓ | |
|
||||
| [cluster_network_config](variables.tf#L17) | Cluster network configuration. | <code title="object({ nodes_cidr_block = string pods_cidr_block = string services_cidr_block = string master_authorized_cidr_blocks = map(string) master_cidr_block = string })">object({…})</code> | | <code title="{ nodes_cidr_block = "10.0.1.0/24" pods_cidr_block = "172.16.0.0/20" services_cidr_block = "192.168.0.0/24" master_authorized_cidr_blocks = { internal = "10.0.0.0/8" } master_cidr_block = "10.0.0.0/28" }">{…}</code> |
|
||||
| [mgmt_server_config](variables.tf#L37) | Management server configuration. | <code title="object({ disk_size = number disk_type = string image = string instance_type = string })">object({…})</code> | | <code title="{ disk_size = 50 disk_type = "pd-ssd" image = "projects/ubuntu-os-cloud/global/images/family/ubuntu-2204-lts" instance_type = "n1-standard-2" }">{…}</code> |
|
||||
| [mgmt_subnet_cidr_block](variables.tf#L53) | Management subnet IP CIDR range. | <code>string</code> | | <code>"10.0.2.0/24"</code> |
|
||||
| [network](variables.tf#L59) | VPC name. | <code>string</code> | | <code>"vpc"</code> |
|
||||
| [project_create](variables.tf#L66) | Parameters for the creation of the new project. | <code title="object({ billing_account_id = string parent = string })">object({…})</code> | | <code>null</code> |
|
||||
| [region](variables.tf#L80) | Region. | <code>string</code> | | <code>"europe-west1"</code> |
|
||||
| [project_create](variables.tf#L59) | Parameters for the creation of the new project. | <code title="object({ billing_account_id = string parent = string })">object({…})</code> | | <code>null</code> |
|
||||
| [region](variables.tf#L73) | Region. | <code>string</code> | | <code>"europe-west1"</code> |
|
||||
| [vpc_create](variables.tf#L79) | Flag indicating whether the VPC should be created or not. | <code>bool</code> | | <code>true</code> |
|
||||
| [vpc_name](variables.tf#L85) | VPC name. | <code>string</code> | | <code>"vpc"</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
@ -90,5 +91,5 @@ module "test" {
|
|||
}
|
||||
project_id = "my-project"
|
||||
}
|
||||
# tftest modules=10 resources=30
|
||||
# tftest modules=11 resources=34
|
||||
```
|
|
@ -70,6 +70,7 @@ spec:
|
|||
initialDelaySeconds: 2
|
||||
periodSeconds: 2
|
||||
failureThreshold: 1
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 10Mi
|
||||
|
@ -83,6 +84,7 @@ spec:
|
|||
env:
|
||||
- name: SCRAPE_URI
|
||||
value: http://localhost:8080/stub_status
|
||||
resources:
|
||||
requests:
|
||||
cpu: 5m
|
||||
memory: 5Mi
|
||||
|
|
|
@ -44,6 +44,7 @@ spec:
|
|||
value: worker
|
||||
- name: LOCUST_MASTER
|
||||
value: locust-master
|
||||
resources:
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 50Mi
|
||||
|
|
|
@ -29,7 +29,8 @@ module "project" {
|
|||
services = [
|
||||
"artifactregistry.googleapis.com",
|
||||
"cloudbuild.googleapis.com",
|
||||
"container.googleapis.com"
|
||||
"container.googleapis.com",
|
||||
"compute.googleapis.com"
|
||||
]
|
||||
iam = {
|
||||
"roles/monitoring.viewer" = [module.monitoring_sa.iam_email]
|
||||
|
|
|
@ -36,4 +36,5 @@ module "mgmt_server" {
|
|||
type = var.mgmt_server_config.disk_type
|
||||
size = var.mgmt_server_config.disk_size
|
||||
}
|
||||
tags = ["ssh"]
|
||||
}
|
|
@ -56,13 +56,6 @@ variable "mgmt_subnet_cidr_block" {
|
|||
default = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
variable "network" {
|
||||
description = "VPC name."
|
||||
type = string
|
||||
default = "vpc"
|
||||
nullable = false
|
||||
}
|
||||
|
||||
variable "project_create" {
|
||||
description = "Parameters for the creation of the new project."
|
||||
type = object({
|
||||
|
@ -82,3 +75,16 @@ variable "region" {
|
|||
type = string
|
||||
default = "europe-west1"
|
||||
}
|
||||
|
||||
variable "vpc_create" {
|
||||
description = "Flag indicating whether the VPC should be created or not."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "vpc_name" {
|
||||
description = "VPC name."
|
||||
type = string
|
||||
nullable = false
|
||||
default = "vpc"
|
||||
}
|
|
@ -17,8 +17,8 @@
|
|||
module "vpc" {
|
||||
source = "../../../modules/net-vpc"
|
||||
project_id = module.project.project_id
|
||||
name = var.network
|
||||
vpc_create = (var.project_create != null)
|
||||
name = var.vpc_name
|
||||
vpc_create = var.vpc_create
|
||||
subnets = [
|
||||
{
|
||||
ip_cidr_range = var.mgmt_subnet_cidr_block
|
||||
|
@ -37,6 +37,12 @@ module "vpc" {
|
|||
]
|
||||
}
|
||||
|
||||
module "firewall" {
|
||||
source = "../../../modules/net-vpc-firewall"
|
||||
project_id = module.project.project_id
|
||||
network = module.vpc.name
|
||||
}
|
||||
|
||||
module "nat" {
|
||||
source = "../../../modules/net-cloudnat"
|
||||
project_id = module.project.project_id
|
||||
|
|
Loading…
Reference in New Issue