From 708e9761aebd1212c8937173241531caac27218a Mon Sep 17 00:00:00 2001 From: Luke Amdor Date: Mon, 23 Oct 2017 16:22:37 -0500 Subject: [PATCH 1/4] azure: make root_volume_size configurable for aws parity --- Documentation/variables/azure.md | 3 +++ modules/azure/etcd/etcd.tf | 1 + modules/azure/etcd/variables.tf | 4 ++++ modules/azure/master-as/master.tf | 1 + modules/azure/master-as/variables.tf | 4 ++++ modules/azure/worker-as/variables.tf | 4 ++++ modules/azure/worker-as/workers.tf | 1 + platforms/azure/variables.tf | 18 ++++++++++++++++++ 8 files changed, 36 insertions(+) diff --git a/Documentation/variables/azure.md b/Documentation/variables/azure.md index 1df572d717..cdb9fb2df5 100644 --- a/Documentation/variables/azure.md +++ b/Documentation/variables/azure.md @@ -9,6 +9,7 @@ This document gives an overview of variables used in the Azure platform of the T | tectonic_azure_client_secret | (internal) The client secret to use. | string | - | | tectonic_azure_cloud_environment | (optional) Azure cloud environment to use. See https://github.com/Azure/go-autorest/blob/ec5f4903f77ed9927ac95b19ab8e44ada64c1356/autorest/azure/environments.go#L13 for available environments. | string | `AZUREPUBLICCLOUD` | | tectonic_azure_config_version | (internal) This declares the version of the Azure configuration variables. It has no impact on generated assets but declares the version contract of the configuration. | string | `1.1` | +| tectonic_azure_etcd_root_volume_size | The size of the volume in gigabytes for the root block device of etcd nodes. | string | `32` | | tectonic_azure_etcd_storage_type | (optional) Storage account type for the etcd node(s). Example: Premium_LRS. Using Premium storage is constrained by the of instance specified in 'tectonic_azure_etcd_vm_size'. See https://docs.microsoft.com/en-us/azure/storage/storage-premium-storage#supported-vms | string | `Premium_LRS` | | tectonic_azure_etcd_vm_size | (optional) Instance size for the etcd node(s). Example: Standard_DS2_v2. | string | `Standard_DS2_v2` | | tectonic_azure_external_dns_zone_id | (optional) The ID of the external Azure DNS zone used for nodes & endpoints FQDNs. Required when 'tectonic_base_domain' is set. This must be a pre-existing, properly configured Azure DNS zone that the Azure service principal running the Tectonic installer has permission to perform operations on.

Note this is the complete ID as returned in the "id" field by the Azure client, not just the name of the resource.

Example: "/subscriptions/b520eabf-d6c0-4757-8a5e-0fa7d2fe12b5/resourceGroups/my-k8s-cluster/providers/Microsoft.Network/dnszones/my-k8s-dns | string | `` | @@ -21,6 +22,7 @@ This document gives an overview of variables used in the Azure platform of the T | tectonic_azure_extra_tags | (optional) A map of extra Azure tags to be applied to created resources. NOTE: Tags MUST NOT contain reserved characters '<,>,%,&,\,?,/' or control characters. | map | `` | | tectonic_azure_location | (internal) An Azure location where the cluster will be built. Use the location name as returned in the *Name* column by `az account list-locations` CLI command. Lowercase string with no spaces between words. Example: southcentralus | string | - | | tectonic_azure_location_fault_domains | (internal) This mapping is for internal use only. It should not be overriden by users. It holds the correspondent number of fault domains for each location, because Azure doesn't provide an API call to query this data per location. The latest version of this data is always available at this location: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/manage-availability | map | `` | +| tectonic_azure_master_root_volume_size | The size of the volume in gigabytes for the root block device of master nodes. | string | `32` | | tectonic_azure_master_storage_type | (optional) Storage account type for the master node(s). Example: Premium_LRS. Using Premium storage is constrained by the of instance specified in 'tectonic_azure_master_vm_size'. See https://docs.microsoft.com/en-us/azure/storage/storage-premium-storage#supported-vms | string | `Premium_LRS` | | tectonic_azure_master_vm_size | (optional) Instance size for the master node(s). Example: Standard_DS2_v2. | string | `Standard_DS2_v2` | | tectonic_azure_private_cluster | (optional) Setting this to true will result in NO public facing endpoints being created. All traffic is contained within the VNET. A VNET with an already configured and active VPN connection is required and needs to be supplied via 'tectonic_azure_external_vnet_id'. DNS is currently required, either the Azure managed one or configured via the generic DNS module. | string | `false` | @@ -28,6 +30,7 @@ This document gives an overview of variables used in the Azure platform of the T | tectonic_azure_ssh_network_external | (optional) Network (external) to allow SSH access from. Maps to `source_address_prefix` in Azure. Defaults to `*`. Can be external to Azure environment. Allowed values: [network CIDR (i.e., 10.0.0.0/16) \| `VirtualNetwork` \| `Internet` \| `*` ] | string | `*` | | tectonic_azure_ssh_network_internal | (optional) Network (internal) to allow SSH access from. Maps to `source_address_prefix` in Azure. Defaults to `VirtualNetwork`. Should be internal to Azure environment. Allowed values: [network CIDR (i.e., 10.0.0.0/16) \| `VirtualNetwork` \| `Internet` \| `*` ] | string | `VirtualNetwork` | | tectonic_azure_vnet_cidr_block | (optional) Range of IP addresses assigned to the Virtual Network in which the cluster nodes run. This should not overlap with any other networks, such as the Kubernetes cluster (pod) range, service range or a private datacenter connected via ExpressRoute." | string | `10.0.0.0/16` | +| tectonic_azure_worker_root_volume_size | The size of the volume in gigabytes for the root block device of worker nodes. | string | `32` | | tectonic_azure_worker_storage_type | (optional) Storage account type for the worker node(s). Example: Premium_LRS. Using Premium storage is constrained by the of instance specified in 'tectonic_azure_worker_vm_size'. See https://docs.microsoft.com/en-us/azure/storage/storage-premium-storage#supported-vms | string | `Premium_LRS` | | tectonic_azure_worker_vm_size | (optional) Instance size for the worker node(s). Example: Standard_DS2_v2. | string | `Standard_DS2_v2` | diff --git a/modules/azure/etcd/etcd.tf b/modules/azure/etcd/etcd.tf index 1edb1cab98..eb3e9bbb88 100644 --- a/modules/azure/etcd/etcd.tf +++ b/modules/azure/etcd/etcd.tf @@ -36,6 +36,7 @@ resource "azurerm_virtual_machine" "etcd_node" { create_option = "FromImage" caching = "ReadWrite" os_type = "linux" + disk_size_gb = "${var.root_volume_size}" } os_profile { diff --git a/modules/azure/etcd/variables.tf b/modules/azure/etcd/variables.tf index ad063419d3..902543e8aa 100644 --- a/modules/azure/etcd/variables.tf +++ b/modules/azure/etcd/variables.tf @@ -25,6 +25,10 @@ variable "storage_id" { type = "string" } +variable "root_volume_size" { + type = "string" +} + // Count of etcd nodes to be created. variable "etcd_count" { type = "string" diff --git a/modules/azure/master-as/master.tf b/modules/azure/master-as/master.tf index 1f61308ee9..b80a6fb067 100644 --- a/modules/azure/master-as/master.tf +++ b/modules/azure/master-as/master.tf @@ -35,6 +35,7 @@ resource "azurerm_virtual_machine" "tectonic_master" { create_option = "FromImage" caching = "ReadWrite" os_type = "linux" + disk_size_gb = "${var.root_volume_size}" } os_profile { diff --git a/modules/azure/master-as/variables.tf b/modules/azure/master-as/variables.tf index f221f985a5..f01dab839e 100644 --- a/modules/azure/master-as/variables.tf +++ b/modules/azure/master-as/variables.tf @@ -67,6 +67,10 @@ variable "storage_type" { description = "Storage account type" } +variable "root_volume_size" { + type = "string" +} + variable "vm_size" { type = "string" description = "VM Size name" diff --git a/modules/azure/worker-as/variables.tf b/modules/azure/worker-as/variables.tf index 9fa821ca24..02c18955cc 100644 --- a/modules/azure/worker-as/variables.tf +++ b/modules/azure/worker-as/variables.tf @@ -69,6 +69,10 @@ variable "storage_type" { description = "Storage account type" } +variable "root_volume_size" { + type = "string" +} + variable "tectonic_kube_dns_service_ip" { type = "string" } diff --git a/modules/azure/worker-as/workers.tf b/modules/azure/worker-as/workers.tf index cbafb1a03e..789ff54bf3 100644 --- a/modules/azure/worker-as/workers.tf +++ b/modules/azure/worker-as/workers.tf @@ -35,6 +35,7 @@ resource "azurerm_virtual_machine" "tectonic_worker" { create_option = "FromImage" caching = "ReadWrite" os_type = "linux" + disk_size_gb = "${var.root_volume_size}" } os_profile { diff --git a/platforms/azure/variables.tf b/platforms/azure/variables.tf index 80c5f76292..cbde73c98a 100644 --- a/platforms/azure/variables.tf +++ b/platforms/azure/variables.tf @@ -76,6 +76,12 @@ EOF default = "Premium_LRS" } +variable "tectonic_azure_master_root_volume_size" { + type = "string" + default = "32" + description = "The size of the volume in gigabytes for the root block device of master nodes." +} + variable "tectonic_azure_worker_storage_type" { type = "string" @@ -88,6 +94,12 @@ EOF default = "Premium_LRS" } +variable "tectonic_azure_worker_root_volume_size" { + type = "string" + default = "32" + description = "The size of the volume in gigabytes for the root block device of worker nodes." +} + variable "tectonic_azure_etcd_storage_type" { type = "string" @@ -100,6 +112,12 @@ EOF default = "Premium_LRS" } +variable "tectonic_azure_etcd_root_volume_size" { + type = "string" + default = "32" + description = "The size of the volume in gigabytes for the root block device of etcd nodes." +} + variable "tectonic_azure_vnet_cidr_block" { type = "string" default = "10.0.0.0/16" From 7fae7ce437ae17369b4e2c503d49ac263a48201a Mon Sep 17 00:00:00 2001 From: Luke Amdor Date: Fri, 2 Feb 2018 14:34:03 -0600 Subject: [PATCH 2/4] update azure examples --- examples/terraform.tfvars.azure | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/terraform.tfvars.azure b/examples/terraform.tfvars.azure index e83a4937ee..3375f83499 100644 --- a/examples/terraform.tfvars.azure +++ b/examples/terraform.tfvars.azure @@ -4,6 +4,9 @@ // for available environments. // tectonic_azure_cloud_environment = "AZUREPUBLICCLOUD" +// The size of the volume in gigabytes for the root block device of etcd nodes. +tectonic_azure_etcd_root_volume_size = "32" + // (optional) Storage account type for the etcd node(s). Example: Premium_LRS. // Using Premium storage is constrained by the of instance specified in 'tectonic_azure_etcd_vm_size'. // See https://docs.microsoft.com/en-us/azure/storage/storage-premium-storage#supported-vms @@ -69,6 +72,9 @@ // NOTE: Tags MUST NOT contain reserved characters '<,>,%,&,\,?,/' or control characters. // tectonic_azure_extra_tags = "" +// The size of the volume in gigabytes for the root block device of master nodes. +tectonic_azure_master_root_volume_size = "32" + // (optional) Storage account type for the master node(s). Example: Premium_LRS. // Using Premium storage is constrained by the of instance specified in 'tectonic_azure_master_vm_size'. // See https://docs.microsoft.com/en-us/azure/storage/storage-premium-storage#supported-vms @@ -100,6 +106,9 @@ tectonic_azure_ssh_key = "" // service range or a private datacenter connected via ExpressRoute." // tectonic_azure_vnet_cidr_block = "10.0.0.0/16" +// The size of the volume in gigabytes for the root block device of worker nodes. +tectonic_azure_worker_root_volume_size = "32" + // (optional) Storage account type for the worker node(s). Example: Premium_LRS. // Using Premium storage is constrained by the of instance specified in 'tectonic_azure_worker_vm_size'. // See https://docs.microsoft.com/en-us/azure/storage/storage-premium-storage#supported-vms From 4406c41689d35441ff98acecc07724a98259688e Mon Sep 17 00:00:00 2001 From: Stephen Augustus Date: Wed, 14 Feb 2018 05:26:47 -0500 Subject: [PATCH 3/4] azure: Set `root_volume_size` in {etcd,master,worker} modules --- platforms/azure/main.tf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platforms/azure/main.tf b/platforms/azure/main.tf index 05889f09f0..6b293ae921 100644 --- a/platforms/azure/main.tf +++ b/platforms/azure/main.tf @@ -73,6 +73,7 @@ module "etcd" { network_interface_ids = "${module.vnet.etcd_network_interface_ids}" public_ssh_key = "${var.tectonic_azure_ssh_key}" resource_group_name = "${module.resource_group.name}" + root_volume_size = "${var.tectonic_azure_etcd_root_volume_size}" storage_id = "${module.resource_group.storage_id}" storage_type = "${var.tectonic_azure_etcd_storage_type}" versions = "${var.tectonic_versions}" @@ -168,6 +169,7 @@ module "masters" { network_interface_ids = "${module.vnet.master_network_interface_ids}" public_ssh_key = "${var.tectonic_azure_ssh_key}" resource_group_name = "${module.resource_group.name}" + root_volume_size = "${var.tectonic_azure_master_root_volume_size}" storage_id = "${module.resource_group.storage_id}" storage_type = "${var.tectonic_azure_master_storage_type}" vm_size = "${var.tectonic_azure_master_vm_size}" @@ -224,6 +226,7 @@ module "workers" { network_interface_ids = "${module.vnet.worker_network_interface_ids}" public_ssh_key = "${var.tectonic_azure_ssh_key}" resource_group_name = "${module.resource_group.name}" + root_volume_size = "${var.tectonic_azure_worker_root_volume_size}" storage_id = "${module.resource_group.storage_id}" storage_type = "${var.tectonic_azure_worker_storage_type}" tectonic_kube_dns_service_ip = "${module.bootkube.kube_dns_service_ip}" From 6f8311c402b8410bd31add9dd1e6dd1b362f7104 Mon Sep 17 00:00:00 2001 From: Stephen Augustus Date: Wed, 14 Feb 2018 05:52:49 -0500 Subject: [PATCH 4/4] azure: Add lifecycle blocks to ignore changes on disk size vars --- modules/azure/etcd/etcd.tf | 7 +++++++ modules/azure/master-as/master.tf | 7 +++++++ modules/azure/worker-as/workers.tf | 5 ++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/azure/etcd/etcd.tf b/modules/azure/etcd/etcd.tf index eb3e9bbb88..0a769d7332 100644 --- a/modules/azure/etcd/etcd.tf +++ b/modules/azure/etcd/etcd.tf @@ -59,4 +59,11 @@ resource "azurerm_virtual_machine" "etcd_node" { "Name", "${var.cluster_name}-etcd-${count.index}", "tectonicClusterID", "${var.cluster_id}"), var.extra_tags)}" + + lifecycle { + ignore_changes = [ + "storage_os_disk", + "storage_data_disk", + ] + } } diff --git a/modules/azure/master-as/master.tf b/modules/azure/master-as/master.tf index b80a6fb067..068632e45d 100644 --- a/modules/azure/master-as/master.tf +++ b/modules/azure/master-as/master.tf @@ -58,4 +58,11 @@ resource "azurerm_virtual_machine" "tectonic_master" { "Name", "${var.cluster_name}-master-${count.index}", "tectonicClusterID", "${var.cluster_id}"), var.extra_tags)}" + + lifecycle { + ignore_changes = [ + "storage_os_disk", + "storage_data_disk", + ] + } } diff --git a/modules/azure/worker-as/workers.tf b/modules/azure/worker-as/workers.tf index 789ff54bf3..a0ed9f7866 100644 --- a/modules/azure/worker-as/workers.tf +++ b/modules/azure/worker-as/workers.tf @@ -60,6 +60,9 @@ resource "azurerm_virtual_machine" "tectonic_worker" { var.extra_tags)}" lifecycle { - ignore_changes = ["storage_data_disk"] + ignore_changes = [ + "storage_os_disk", + "storage_data_disk", + ] } }