diff --git a/proxmox/terraform/production/cassandra.tf b/proxmox/terraform/production/cassandra.tf new file mode 100644 --- /dev/null +++ b/proxmox/terraform/production/cassandra.tf @@ -0,0 +1,156 @@ +# Provision the rancher cluster for the cassandra +# nodes in production +# +# Provision 3 vms in proxmox to manage the etcd cluster +# and the kubernetes control plane + +provider "rancher2" { + api_url = "https://rancher.euwest.azure.internal.softwareheritage.org/v3" + # insecure = true +} + +resource "rancher2_cluster" "production_cassandra" { + name = "production-cassandra" + description = "Production - Cassandra cluster" + rke_config { + network { + plugin = "canal" + } + } +} + +output "production_cassandra_cluster_summary" { + sensitive = true + value = rancher2_cluster.production_cassandra.kube_config +} + +output "production_cassandra_cluster_command" { + sensitive = true + value = rancher2_cluster.production_cassandra.cluster_registration_token[0].node_command +} + +module "rancher_node_cassandra1" { + hostname = "rancher-node-cassandra1" + + source = "../modules/node" + template = "debian-bullseye-11.3-zfs-2022-04-21" + config = local.config + description = "Kubernetes management node for cassandra cluster" + hypervisor = "beaubourg" + vmid = 159 + sockets = "1" + cores = "4" + onboot = true + memory = "8192" + balloon = "4096" + + networks = [{ + id = 0 + ip = "192.168.100.178" + gateway = local.config["gateway_ip"] + macaddr = "" + bridge = "vmbr0" + }] + + storages = [{ + storage = "proxmox" + size = "20G" + }, { + storage = "proxmox" + size = "50G" + } + ] + + post_provision_steps = [ + "systemctl restart docker", # workaround + "${rancher2_cluster.production_cassandra.cluster_registration_token[0].node_command} --etcd --controlplane" + ] +} + +output "rancher_node_cassandra1_summary" { + value = module.rancher_node_cassandra1.summary +} + +module "rancher_node_cassandra2" { + hostname = "rancher-node-cassandra2" + + source = "../modules/node" + template = "debian-bullseye-11.3-zfs-2022-04-21" + config = local.config + description = "Kubernetes management node for cassandra cluster" + hypervisor = "branly" + vmid = 160 + sockets = "1" + cores = "4" + onboot = true + memory = "8192" + balloon = "4096" + + networks = [{ + id = 0 + ip = "192.168.100.179" + gateway = local.config["gateway_ip"] + macaddr = "" + bridge = "vmbr0" + }] + + storages = [{ + storage = "proxmox" + size = "20G" + }, { + storage = "proxmox" + size = "50G" + } + ] + + post_provision_steps = [ + "systemctl restart docker", # workaround + "${rancher2_cluster.production_cassandra.cluster_registration_token[0].node_command} --etcd --controlplane" + ] +} + +output "rancher_node_cassandra2_summary" { + value = module.rancher_node_cassandra2.summary +} + +module "rancher_node_cassandra3" { + hostname = "rancher-node-cassandra3" + + source = "../modules/node" + template = "debian-bullseye-11.3-zfs-2022-04-21" + config = local.config + description = "Kubernetes management node for cassandra cluster" + hypervisor = "hypervisor3" + vmid = 161 + sockets = "1" + cores = "4" + onboot = true + memory = "8192" + balloon = "4096" + + networks = [{ + id = 0 + ip = "192.168.100.180" + gateway = local.config["gateway_ip"] + macaddr = "" + bridge = "vmbr0" + }] + + storages = [{ + storage = "proxmox" + size = "20G" + }, { + storage = "proxmox" + size = "50G" + } + ] + + post_provision_steps = [ + "systemctl restart docker", # workaround + "${rancher2_cluster.production_cassandra.cluster_registration_token[0].node_command} --etcd --controlplane" + ] +} + +output "rancher_node_cassandra3_summary" { + value = module.rancher_node_cassandra3.summary +}