Skip to content

Commit

Permalink
Use Availability Set for masters and workers
Browse files Browse the repository at this point in the history
Instances in a Scale Set are not supported by the kubernetes
cloud-provider integration.

This closes coreos#93
  • Loading branch information
discordianfish committed Jun 9, 2017
1 parent d8249aa commit cc65325
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 53 deletions.
57 changes: 31 additions & 26 deletions modules/azure/master/master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,53 @@ resource "azurerm_storage_container" "tectonic_master" {
container_access_type = "private"
}

resource "azurerm_virtual_machine_scale_set" "tectonic_masters" {
resource "azurerm_availability_set" "tectonic_masters" {
name = "${var.cluster_name}-masters"
location = "${var.location}"
resource_group_name = "${var.resource_group_name}"
upgrade_policy_mode = "Manual"

sku {
name = "${var.vm_size}"
tier = "${element(split("_", var.vm_size),0)}"
capacity = "${var.master_count}"
}
}

network_profile {
name = "${var.cluster_name}-MasterNetworkProfile"
primary = true
resource "azurerm_network_interface" "tectonic_master" {
count = "${var.master_count}"
name = "${var.cluster_name}-master${count.index}"
location = "${var.location}"
resource_group_name = "${var.resource_group_name}"

ip_configuration {
name = "${var.cluster_name}-MasterIPConfiguration"
subnet_id = "${var.subnet}"
load_balancer_backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.api-lb.id}"]
}
ip_configuration {
private_ip_address_allocation = "dynamic"
name = "${var.cluster_name}-MasterIPConfiguration"
subnet_id = "${var.subnet}"
load_balancer_backend_address_pools_ids = ["${azurerm_lb_backend_address_pool.api-lb.id}"]
}
}

resource "azurerm_virtual_machine" "tectonic_master" {
count = "${var.master_count}"
name = "${var.cluster_name}-master${count.index}"
location = "${var.location}"
resource_group_name = "${var.resource_group_name}"
network_interface_ids = ["${element(azurerm_network_interface.tectonic_master.*.id, count.index)}"]
vm_size = "${var.vm_size}"

storage_profile_image_reference {
storage_image_reference {
publisher = "CoreOS"
offer = "CoreOS"
sku = "Stable"
version = "latest"
}

storage_profile_os_disk {
name = "master-osdisk"
caching = "ReadWrite"
create_option = "FromImage"
os_type = "linux"
vhd_containers = ["${azurerm_storage_account.tectonic_master.primary_blob_endpoint}${azurerm_storage_container.tectonic_master.name}"]
storage_os_disk {
name = "master-osdisk"
caching = "ReadWrite"
create_option = "FromImage"
os_type = "linux"
vhd_uri = "${azurerm_storage_account.tectonic_master.primary_blob_endpoint}${azurerm_storage_container.tectonic_master.name}/${var.cluster_name}-master${count.index}.vhd"
}

os_profile {
computer_name_prefix = "tectonic-master-"
admin_username = "core"
admin_password = ""
computer_name = "${var.cluster_name}-master${count.index}"
admin_username = "core"
admin_password = ""

custom_data = "${base64encode("${data.ignition_config.master.*.rendered[count.index]}")}"
}
Expand Down
59 changes: 32 additions & 27 deletions modules/azure/worker/workers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,50 +30,55 @@ resource "azurerm_storage_container" "tectonic_worker" {
# loadbalancer_id = "${azurerm_lb.tectonic_lb.id}"
# }

resource "azurerm_virtual_machine_scale_set" "tectonic_workers" {
resource "azurerm_availability_set" "tectonic_workers" {
name = "${var.cluster_name}-workers"
location = "${var.location}"
resource_group_name = "${var.resource_group_name}"
upgrade_policy_mode = "Manual"

sku {
name = "${var.vm_size}"
tier = "${element(split("_", var.vm_size),0)}"
capacity = "${var.worker_count}"
}
}

network_profile {
name = "${var.cluster_name}-WorkerNetworkProfile"
primary = true
resource "azurerm_network_interface" "tectonic_worker" {
count = "${var.worker_count}"
name = "${var.cluster_name}-worker${count.index}"
location = "${var.location}"
resource_group_name = "${var.resource_group_name}"

ip_configuration {
name = "${var.cluster_name}-WorkerIPConfiguration"
subnet_id = "${var.subnet}"
ip_configuration {
private_ip_address_allocation = "dynamic"
name = "${var.cluster_name}-WorkerIPConfiguration"
subnet_id = "${var.subnet}"

# load_balancer_backend_address_pool_ids = ["azurerm_lb_backend_address_pool.workers.id"]
}
# load_balancer_backend_address_pools_ids = ["${azurerm_lb_backend_address_pool.workers.id}"]
}
}

resource "azurerm_virtual_machine" "tectonic_worker" {
count = "${var.worker_count}"
name = "${var.cluster_name}-worker${count.index}"
location = "${var.location}"
resource_group_name = "${var.resource_group_name}"
network_interface_ids = ["${element(azurerm_network_interface.tectonic_worker.*.id, count.index)}"]
vm_size = "${var.vm_size}"

storage_profile_image_reference {
storage_image_reference {
publisher = "CoreOS"
offer = "CoreOS"
sku = "Stable"
version = "latest"
}

storage_profile_os_disk {
name = "worker-osdisk"
caching = "ReadWrite"
create_option = "FromImage"
os_type = "linux"
vhd_containers = ["${azurerm_storage_account.tectonic_worker.primary_blob_endpoint}${azurerm_storage_container.tectonic_worker.name}"]
storage_os_disk {
name = "worker-osdisk"
caching = "ReadWrite"
create_option = "FromImage"
os_type = "linux"
vhd_uri = "${azurerm_storage_account.tectonic_worker.primary_blob_endpoint}${azurerm_storage_container.tectonic_worker.name}/${var.cluster_name}-worker${count.index}.vhd"
}

os_profile {
computer_name_prefix = "tectonic-worker-"
admin_username = "core"
admin_password = ""
custom_data = "${base64encode("${data.ignition_config.worker.rendered}")}"
computer_name = "${var.cluster_name}-worker${count.index}"
admin_username = "core"
admin_password = ""
custom_data = "${base64encode("${data.ignition_config.worker.rendered}")}"
}

os_profile_linux_config {
Expand Down

0 comments on commit cc65325

Please sign in to comment.