From cff0f6a9a14c8a3424d9715b1b274035cc16a7fc Mon Sep 17 00:00:00 2001 From: supahcraig Date: Tue, 20 May 2025 15:03:19 -0500 Subject: [PATCH 1/2] Added networking terraform to GCP, unified ssh & tfvars across AWS/GCP, and ammended the README to give better cloud-specific instructions. --- driver-redpanda/README.md | 67 +++++- driver-redpanda/deploy/ansible.cfg | 1 - .../deploy/aws/provision-redpanda-aws.tf | 8 +- .../deploy/aws/terraform.tfvars.example | 3 +- driver-redpanda/deploy/deploy.yaml | 2 +- .../deploy/gcp/provision-redpanda-gcp.tf | 225 ++++++++++++------ .../deploy/gcp/terraform.tfvars.example | 22 ++ driver-redpanda/deploy/hosts_ini.tpl | 1 + 8 files changed, 244 insertions(+), 85 deletions(-) create mode 100644 driver-redpanda/deploy/gcp/terraform.tfvars.example diff --git a/driver-redpanda/README.md b/driver-redpanda/README.md index 41e0c54d..42a21fbb 100644 --- a/driver-redpanda/README.md +++ b/driver-redpanda/README.md @@ -14,29 +14,61 @@ - The [terraform inventory plugin](https://github.com/adammck/terraform-inventory) - aws-cli +- gcloud ## Setup -1. In the top level directory run `mvn clean package`. This will build the benchmark client needed during deployment. +1. In the top level directory run `mvn clean package`. This will build the benchmark client needed during deployment. -2. Create an ssh key for the benchmark using the following: `ssh-keygen -f ~/.ssh/redpanda_aws`. Set the password to blank. +2. Create an environment variable for the cloud provider you're going to deploy on: -3. In the `driver-redpanda/deploy` directory set an environment variable for your cloud provider and then run the terraform apply. +```bash + export REDPANDA_CLOUD_PROVIDER= +```` +3. Create an ssh key for the benchmark by running the following: + + ```bash + ssh-keygen -f ~/.ssh/redpanda_${REDPANDA_CLOUD_PROVIDER} ``` - export REDPANDA_CLOUD_PROVIDER=aws -``` +Set the password to blank when prompted. + +4. Copy & edit `terraform.tfvars` for your specific needs around instance types & quantities: +```bash + cp ${REDPANDA_CLOUD_PROVIDER}/terraform.tfvars.example ${REDPANDA_CLOUD_PROVIDER}/terraform.tfvars ``` - cp ${REDPANDA_CLOUD_PROVIDER}/terraform.tfvars.example ${REDPANDA_CLOUD_PROVIDER}/terraform.tfvars + +Hint: if you're planning to benchmark against an existing Redpanda cluster, set the `num_instances` of `redpanda` to 0 in `terraform.tfvars` + + +5. In the `driver-redpanda/deploy` directory run terraform apply. + +### AWS + +```bash terraform -chdir=${REDPANDA_CLOUD_PROVIDER} init + terraform -chdir=${REDPANDA_CLOUD_PROVIDER} plan aws sts get-caller-identity || aws sso login terraform -chdir=${REDPANDA_CLOUD_PROVIDER} apply --auto-approve ``` -4. To setup the deployed nodes. Run the ansible playbook. If running locally include `--ask-become-pass` and supply your admin password when prompted. If running on a cloud VM run the command as `sudo` instead. +### GCP +```bash + terraform -chdir=${REDPANDA_CLOUD_PROVIDER} init + terraform -chdir=${REDPANDA_CLOUD_PROVIDER} plan + gcloud auth print-access-token || gcloud auth login + terraform -chdir=${REDPANDA_CLOUD_PROVIDER} apply --auto-approve ``` + +### Azure + +_coming soon_ + +6. To setup the deployed nodes, run the ansible playbook. If running locally include `--ask-become-pass` and supply your admin password when prompted. If running on a cloud VM run the command as `sudo` instead. + +```bash if [ "$(uname)" = "Darwin" ]; then export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES; fi if [ "$(uname)" = "Darwin" ]; then brew install gnu-tar; fi # https://github.com/prometheus-community/ansible/issues/186 ansible-galaxy install -r requirements.yaml @@ -44,9 +76,20 @@ ansible-playbook --inventory ${REDPANDA_CLOUD_PROVIDER}/hosts.ini --ask-become-pass deploy.yaml ``` -To instead use an existing BYOC cluster, run the ansible playbook as follows. +To instead use an existing Redpanda BYOC/Dedicated cluster, you'll need to add several things to the command: +An extra variable to enable TLS (required by Redpanda cloud clusters), and then a SASL username & password for a user already created on your cluster. +```bash + -e "tls_enabled=true sasl_enabled=true sasl_username= sasl_password=" \ ``` + +An extra variable to identify the bootstrap server address (e.g. `http://seed-abc123.redpanda.com:9092`) +```bash + -e bootstrapServers="" \ +``` + +So the complete ansible-playbook command would look like this: +```bash ansible-playbook --inventory ${REDPANDA_CLOUD_PROVIDER}/hosts.ini \ --ask-become-pass \ -e "tls_enabled=true sasl_enabled=true sasl_username= sasl_password=" \ @@ -56,6 +99,7 @@ To instead use an existing BYOC cluster, run the ansible playbook as follows. --- + ## Running the benchmark 1. SSH to the client machine. @@ -68,9 +112,14 @@ To instead use an existing BYOC cluster, run the ansible playbook as follows. 3. Run a benchmark using a specific driver and workload, for example: - sudo bin/benchmark -d driver-redpanda/redpanda-ack-all-group-linger-10ms.yaml \ + bin/benchmark -d driver-redpanda/redpanda-ack-all-group-linger-10ms.yaml \ driver-redpanda/deploy/workloads/1-topic-100-partitions-1kb-4-producers-500k-rate.yaml +While the benchmark is running, you can observe the cluster performance in Grafana, by navigating to: +`http:// Date: Tue, 20 May 2025 20:15:45 -0500 Subject: [PATCH 2/2] Added firewall rule for ingress on port 8080 --- driver-redpanda/deploy/gcp/provision-redpanda-gcp.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver-redpanda/deploy/gcp/provision-redpanda-gcp.tf b/driver-redpanda/deploy/gcp/provision-redpanda-gcp.tf index fb93cc7f..3b4af2ba 100644 --- a/driver-redpanda/deploy/gcp/provision-redpanda-gcp.tf +++ b/driver-redpanda/deploy/gcp/provision-redpanda-gcp.tf @@ -117,7 +117,7 @@ resource "google_compute_firewall" "allow_redpanda" { allow { protocol = "tcp" - ports = ["9092", "9644", "8081", "8082", "33145", "3000", "9090"] # Kafka API + Admin API + Prometheus/Grafana + ports = ["9092", "9644", "8080", "8081", "8082", "33145", "3000", "9090"] # Kafka API + Admin API + Prometheus/Grafana } source_ranges = [var.subnet_cidr_range]