mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
randomize the secrets
This commit is contained in:
parent
9969dc9cff
commit
93e28126aa
@ -6,7 +6,7 @@ terraform {
|
|||||||
|
|
||||||
locals {
|
locals {
|
||||||
name = var.name
|
name = var.name
|
||||||
k3s_cluster_secret = "pvc-6476dcaf-73a0-11e9-b8e5-06943b744282"
|
k3s_cluster_secret = var.k3s_cluster_secret
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "aws" {
|
provider "aws" {
|
||||||
|
@ -26,3 +26,8 @@ variable "name" {
|
|||||||
type = string
|
type = string
|
||||||
description = "Name to identify this cluster"
|
description = "Name to identify this cluster"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "k3s_cluster_secret" {
|
||||||
|
type = string
|
||||||
|
description = "Cluster secret for k3s cluster registration"
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
## MAIN VARIABLES ##
|
## MAIN VARIABLES ##
|
||||||
####################
|
####################
|
||||||
CLUSTER_NAME="loadtest-k3s"
|
CLUSTER_NAME="loadtest-k3s"
|
||||||
|
CLUSTER_SECRET=""
|
||||||
DOMAIN_NAME="loadtest.eng.rancher.space"
|
DOMAIN_NAME="loadtest.eng.rancher.space"
|
||||||
ZONE_ID=""
|
ZONE_ID=""
|
||||||
K3S_VERSION="v1.0.0"
|
K3S_VERSION="v1.0.0"
|
||||||
@ -14,7 +15,7 @@ DB_ENGINE="dqlite"
|
|||||||
DB_INSTANCE_TYPE="db.m4.4xlarge"
|
DB_INSTANCE_TYPE="db.m4.4xlarge"
|
||||||
DB_NAME="k3s"
|
DB_NAME="k3s"
|
||||||
DB_USERNAME="k3suser"
|
DB_USERNAME="k3suser"
|
||||||
DB_PASSWORD="024d9442b3add64b7ef90655bc302cd8"
|
DB_PASSWORD=""
|
||||||
DB_VERSION=5.7
|
DB_VERSION=5.7
|
||||||
|
|
||||||
## K3S SERVER VARIABLES ##
|
## K3S SERVER VARIABLES ##
|
||||||
|
@ -51,8 +51,17 @@ config() {
|
|||||||
pushd ./server
|
pushd ./server
|
||||||
eval PRIVATE_KEY_PATH=$PRIVATE_KEY_PATH
|
eval PRIVATE_KEY_PATH=$PRIVATE_KEY_PATH
|
||||||
EXPANDED_PRIV_KEY_PATH=`readlink -f $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 <<MAIN > variables.tfvars
|
cat <<MAIN > variables.tfvars
|
||||||
name = "${CLUSTER_NAME}"
|
name = "${CLUSTER_NAME}"
|
||||||
|
k3s_cluster_secret = "${CLUSTER_SECRET}"
|
||||||
db_instance_type = "${DB_INSTANCE_TYPE}"
|
db_instance_type = "${DB_INSTANCE_TYPE}"
|
||||||
db_name = "${DB_NAME}"
|
db_name = "${DB_NAME}"
|
||||||
db_username = "${DB_USERNAME}"
|
db_username = "${DB_USERNAME}"
|
||||||
@ -80,6 +89,7 @@ extra_ssh_keys = ["${EXTRA_SSH_KEYS}"]
|
|||||||
k3s_version = "${K3S_VERSION}"
|
k3s_version = "${K3S_VERSION}"
|
||||||
agent_node_count = ${AGENT_NODE_COUNT}
|
agent_node_count = ${AGENT_NODE_COUNT}
|
||||||
agent_instance_type = "${AGENT_INSTANCE_TYPE}"
|
agent_instance_type = "${AGENT_INSTANCE_TYPE}"
|
||||||
|
k3s_cluster_secret = "${CLUSTER_SECRET}"
|
||||||
MAIN
|
MAIN
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ variable "prom_worker_node_count" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "k3s_cluster_secret" {
|
variable "k3s_cluster_secret" {
|
||||||
default = "pvc-6476dcaf-73a0-11e9-b8e5-06943b744282"
|
|
||||||
type = string
|
type = string
|
||||||
description = "Cluster secret for k3s cluster registration"
|
description = "Cluster secret for k3s cluster registration"
|
||||||
}
|
}
|
||||||
@ -66,9 +65,7 @@ variable "db_username" {
|
|||||||
default = "postgres"
|
default = "postgres"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "db_password" {
|
variable "db_password" {}
|
||||||
default = "b58bf234c4bd0133fc7a92b782e498a6"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "db_version" {}
|
variable "db_version" {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user