Skip to content

Commit

Permalink
[creodias] update nodes from eo2.xlarge (16GB/4vcpu) x6 to hm.xlarge …
Browse files Browse the repository at this point in the history
…(64GB/8vcpu) x3
  • Loading branch information
rconway committed Oct 5, 2023
1 parent 780b8fc commit 810d8da
Show file tree
Hide file tree
Showing 13 changed files with 295 additions and 546 deletions.
1 change: 1 addition & 0 deletions creodias/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debug-*.log
2 changes: 1 addition & 1 deletion creodias/.terraform/modules/modules.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Modules":[{"Key":"compute","Source":"./modules/compute","Dir":"modules/compute"},{"Key":"ips","Source":"./modules/ips","Dir":"modules/ips"},{"Key":"loadbalancer","Source":"./modules/loadbalancer","Dir":"modules/loadbalancer"},{"Key":"network","Source":"./modules/network","Dir":"modules/network"},{"Key":"","Source":"","Dir":"."}]}
{"Modules":[{"Key":"network","Source":"./modules/network","Dir":"modules/network"},{"Key":"","Source":"","Dir":"."},{"Key":"compute","Source":"./modules/compute","Dir":"modules/compute"},{"Key":"ips","Source":"./modules/ips","Dir":"modules/ips"},{"Key":"loadbalancer","Source":"./modules/loadbalancer","Dir":"modules/loadbalancer"}]}
5 changes: 5 additions & 0 deletions creodias/deployCREODIAS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ then
fi

# terraform
export TF_LOG=DEBUG
terraform init
#
# keypair first
export TF_LOG_PATH="$PWD/debug-keypair.log"
rm "${TF_LOG_PATH}"
terraform ${ACTION} ${AUTO_APPROVE} -var-file=eoepca.tfvars -target=module.compute.openstack_compute_keypair_v2.k8s
if test "$ACTION" = "apply"
then
Expand All @@ -42,5 +45,7 @@ then
fi
#
# after keypair - everything else
export TF_LOG_PATH="$PWD/debug-deployment.log"
rm "${TF_LOG_PATH}"
echo "Proceeding with deployment..."
terraform ${ACTION} ${AUTO_APPROVE} -var-file=eoepca.tfvars
6 changes: 6 additions & 0 deletions creodias/eoepca.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module "compute" {
number_of_k8s_nodes = "${var.number_of_k8s_nodes}"
number_of_bastions = "${var.number_of_bastions}"
number_of_k8s_nodes_no_floating_ip = "${var.number_of_k8s_nodes_no_floating_ip}"
number_of_k8s_nodes_hm = "${var.number_of_k8s_nodes_hm}"
number_of_gfs_nodes_no_floating_ip = "${var.number_of_gfs_nodes_no_floating_ip}"
bastion_root_volume_size_in_gb = "${var.bastion_root_volume_size_in_gb}"
etcd_root_volume_size_in_gb = "${var.etcd_root_volume_size_in_gb}"
Expand Down Expand Up @@ -83,6 +84,7 @@ module "loadbalancer" {
cluster_name = "${var.cluster_name}"
network_id = "${module.network.network_id}"
k8s_node_ips = "${module.compute.k8s_node_ips}"
k8s_node_hm_ips = "${module.compute.k8s_node_hm_ips}"
floatingip_pool = "${var.floatingip_pool}"
k8s_secgroup_id = "${module.compute.k8s_secgroup_id}"
use_neutron = "${var.use_neutron}"
Expand Down Expand Up @@ -128,6 +130,10 @@ output "k8s_node_ips" {
value = "${module.compute.k8s_node_ips}"
}

output "k8s_node_hm_ips" {
value = "${module.compute.k8s_node_hm_ips}"
}

output "nfs_ip_address" {
value = "${module.compute.nfs_ip_address}"
}
3 changes: 2 additions & 1 deletion creodias/eoepca.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ number_of_k8s_masters_no_floating_ip_no_etcd = 0

# nodes
number_of_k8s_nodes = 0
number_of_k8s_nodes_no_floating_ip = 6
number_of_k8s_nodes_no_floating_ip = 0
number_of_k8s_nodes_hm = 3

#-------------------------------------------------------------------------------
# Compute
Expand Down
59 changes: 59 additions & 0 deletions creodias/modules/compute/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,65 @@ resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip" {
}
}

resource "openstack_compute_instance_v2" "k8s_node_high_memory" {
name = "${var.cluster_name}-k8s-node-hm-${count.index + 1}"
count = "${var.node_root_volume_size_in_gb == 0 ? var.number_of_k8s_nodes_hm : 0}"
availability_zone = "${element(var.az_list, count.index)}"
image_name = "${var.image}"
flavor_id = "25"
key_pair = "${openstack_compute_keypair_v2.k8s.name}"

lifecycle {
ignore_changes = [image_name]
}

network {
name = "${var.network_name}"
}

network {
name = "${var.eodata_network_name}"
}

security_groups = ["${openstack_networking_secgroup_v2.k8s.name}",
"${openstack_networking_secgroup_v2.worker.name}",
]

dynamic "scheduler_hints" {
for_each = var.use_server_groups ? [openstack_compute_servergroup_v2.k8s_node[0]] : []
content {
group = "${openstack_compute_servergroup_v2.k8s_node[0].id}"
}
}

metadata = {
ssh_user = "${var.ssh_user}"
kubespray_groups = "kube-node,k8s-cluster,no-floating,${var.supplementary_node_groups}"
depends_on = "${var.network_id}"
use_access_ip = "${var.use_access_ip}"
}

connection {
type = "ssh"
user = "${var.ssh_user}"
private_key = "${chomp(file(trimsuffix(var.public_key_path, ".pub")))}"
host = "${self.access_ip_v4}"
bastion_host = var.bastion_fips[0]
}

provisioner "file" {
source = "${path.module}/rke-node-setup.sh"
destination = "/tmp/rke-node-setup.sh"
}

provisioner "remote-exec" {
inline = [
"sudo chmod +x /tmp/rke-node-setup.sh",
"sudo /tmp/rke-node-setup.sh ${var.ssh_user}",
]
}
}

resource "openstack_compute_instance_v2" "k8s_node_no_floating_ip_custom_volume_size" {
name = "${var.cluster_name}-k8s-node-nf-${count.index + 1}"
count = "${var.node_root_volume_size_in_gb > 0 ? var.number_of_k8s_nodes_no_floating_ip : 0}"
Expand Down
4 changes: 4 additions & 0 deletions creodias/modules/compute/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ output "k8s_node_ips" {
value = "${openstack_compute_instance_v2.k8s_node_no_floating_ip.*.access_ip_v4}"
}

output "k8s_node_hm_ips" {
value = "${openstack_compute_instance_v2.k8s_node_high_memory.*.access_ip_v4}"
}

output "k8s_secgroup_id" {
value = "${openstack_networking_secgroup_v2.k8s.id}"
}
2 changes: 2 additions & 0 deletions creodias/modules/compute/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ variable "number_of_k8s_nodes" {}

variable "number_of_k8s_nodes_no_floating_ip" {}

variable "number_of_k8s_nodes_hm" {}

variable "number_of_bastions" {}

variable "number_of_gfs_nodes_no_floating_ip" {}
Expand Down
16 changes: 16 additions & 0 deletions creodias/modules/loadbalancer/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ resource "openstack_lb_members_v2" "https" {
protocol_port = 31443
}
}

dynamic "member" {
for_each = var.k8s_node_hm_ips
content {
address = member.value
protocol_port = 31443
}
}
}

resource "openstack_lb_members_v2" "http" {
Expand All @@ -116,6 +124,14 @@ resource "openstack_lb_members_v2" "http" {
protocol_port = 31080
}
}

dynamic "member" {
for_each = var.k8s_node_hm_ips
content {
address = member.value
protocol_port = 31080
}
}
}

# resource "openstack_lb_monitor_v2" "https_ping" {
Expand Down
4 changes: 4 additions & 0 deletions creodias/modules/loadbalancer/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ variable "k8s_node_ips" {
type = list
}

variable "k8s_node_hm_ips" {
type = list
}

variable "network_id" {}

variable "floatingip_pool" {}
Expand Down
Loading

0 comments on commit 810d8da

Please sign in to comment.