From 93e28126aabc9c329a46ebb675d934fe46098d82 Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Wed, 27 Nov 2019 20:30:56 +0200 Subject: [PATCH] randomize the secrets --- tests/perf/agents/main.tf | 2 +- tests/perf/agents/variables.tf | 5 +++++ tests/perf/scripts/config | 3 ++- tests/perf/scripts/perf | 10 ++++++++++ tests/perf/server/variables.tf | 5 +---- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/perf/agents/main.tf b/tests/perf/agents/main.tf index 106b7e8dcb..ece3c1a8e9 100644 --- a/tests/perf/agents/main.tf +++ b/tests/perf/agents/main.tf @@ -6,7 +6,7 @@ terraform { locals { name = var.name - k3s_cluster_secret = "pvc-6476dcaf-73a0-11e9-b8e5-06943b744282" + k3s_cluster_secret = var.k3s_cluster_secret } provider "aws" { diff --git a/tests/perf/agents/variables.tf b/tests/perf/agents/variables.tf index f0924930fe..8cf3b28a9f 100644 --- a/tests/perf/agents/variables.tf +++ b/tests/perf/agents/variables.tf @@ -26,3 +26,8 @@ variable "name" { type = string description = "Name to identify this cluster" } + +variable "k3s_cluster_secret" { + type = string + description = "Cluster secret for k3s cluster registration" +} \ No newline at end of file diff --git a/tests/perf/scripts/config b/tests/perf/scripts/config index d85bf41426..5467439d05 100755 --- a/tests/perf/scripts/config +++ b/tests/perf/scripts/config @@ -1,6 +1,7 @@ ## MAIN VARIABLES ## #################### CLUSTER_NAME="loadtest-k3s" +CLUSTER_SECRET="" DOMAIN_NAME="loadtest.eng.rancher.space" ZONE_ID="" K3S_VERSION="v1.0.0" @@ -14,7 +15,7 @@ DB_ENGINE="dqlite" DB_INSTANCE_TYPE="db.m4.4xlarge" DB_NAME="k3s" DB_USERNAME="k3suser" -DB_PASSWORD="024d9442b3add64b7ef90655bc302cd8" +DB_PASSWORD="" DB_VERSION=5.7 ## K3S SERVER VARIABLES ## diff --git a/tests/perf/scripts/perf b/tests/perf/scripts/perf index 9dbae96166..e5e2f4f6a1 100755 --- a/tests/perf/scripts/perf +++ b/tests/perf/scripts/perf @@ -51,8 +51,17 @@ config() { pushd ./server eval PRIVATE_KEY_PATH=$PRIVATE_KEY_PATH EXPANDED_PRIV_KEY_PATH=`readlink -f $PRIVATE_KEY_PATH` + if [ -z "$DB_PASSWORD" ]; then + # randomize database password + DB_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + fi + if [ -z "$CLUSTER_SECRET" ]; then + # randomize cluster secret + CLUSTER_SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + fi cat <
variables.tfvars name = "${CLUSTER_NAME}" +k3s_cluster_secret = "${CLUSTER_SECRET}" db_instance_type = "${DB_INSTANCE_TYPE}" db_name = "${DB_NAME}" db_username = "${DB_USERNAME}" @@ -80,6 +89,7 @@ extra_ssh_keys = ["${EXTRA_SSH_KEYS}"] k3s_version = "${K3S_VERSION}" agent_node_count = ${AGENT_NODE_COUNT} agent_instance_type = "${AGENT_INSTANCE_TYPE}" +k3s_cluster_secret = "${CLUSTER_SECRET}" MAIN popd } diff --git a/tests/perf/server/variables.tf b/tests/perf/server/variables.tf index cbe680d24a..3ae6f96fea 100644 --- a/tests/perf/server/variables.tf +++ b/tests/perf/server/variables.tf @@ -19,7 +19,6 @@ variable "prom_worker_node_count" { } variable "k3s_cluster_secret" { - default = "pvc-6476dcaf-73a0-11e9-b8e5-06943b744282" type = string description = "Cluster secret for k3s cluster registration" } @@ -66,9 +65,7 @@ variable "db_username" { default = "postgres" } -variable "db_password" { - default = "b58bf234c4bd0133fc7a92b782e498a6" -} +variable "db_password" {} variable "db_version" {}