Skip to content

Commit

Permalink
Adding custom subnet, removing k8s FW rule
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszgebala-dsai committed Sep 27, 2024
1 parent 3fe1470 commit 261b992
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ locals {
%{~ for index, instance in crusoe_compute_instance.rke_headnode ~}
server rke_node${index} ${instance.network_interfaces[0].private_ipv4.address}:6443 check
%{~ endfor ~}
backend rke_mgmt_nodes
mode tcp
balance roundrobin
Expand All @@ -65,6 +65,11 @@ resource "crusoe_compute_instance" "rke_lb" {
location = var.deploy_location
image = var.headnode_image
startup_script = file("${path.module}/rkehaproxy-install.sh")
network_interfaces = [
{
subnet = var.subnet
}
]

provisioner "file" {
content = local.haproxy_config
Expand Down Expand Up @@ -92,6 +97,11 @@ resource "crusoe_compute_instance" "rke_headnode" {
}
)
host_channel_adapters = local.headnode_has_ib ? [{ ib_partition_id = var.ib_partition_id }] : null
network_interfaces = [
{
subnet = var.subnet
}
]


provisioner "file" {
Expand Down Expand Up @@ -142,6 +152,11 @@ resource "crusoe_compute_instance" "workers" {
image = var.worker_image
startup_script = file("${path.module}/rkeinstall-worker.sh")
host_channel_adapters = local.worker_has_ib ? [{ ib_partition_id = var.ib_partition_id }] : null
network_interfaces = [
{
subnet = var.subnet
}
]
provisioner "file" {
content = jsonencode(crusoe_compute_instance.rke_headnode[0])
destination = "/root/rke-0-main.json"
Expand All @@ -164,15 +179,3 @@ resource "crusoe_compute_instance" "workers" {
}
}
}

resource "crusoe_vpc_firewall_rule" "rke_rule" {
network = local.ingress_interface.network
name = "rke-pub-access"
action = "allow"
direction = "ingress"
protocols = "tcp"
source = "0.0.0.0/0"
source_ports = "1-65535"
destination = "${local.ingress_interface.private_ipv4.address}/32"
destination_ports = "6443"
}

0 comments on commit 261b992

Please sign in to comment.