Skip to content

Commit

Permalink
Merge pull request #1347 from WebSpider/1344
Browse files Browse the repository at this point in the history
Keep OS disk size
  • Loading branch information
mysticaltech authored May 23, 2024
2 parents 169c254 + 1c7d697 commit 3245fb3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions agents.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module "agents" {
cloudinit_runcmd_common = local.cloudinit_runcmd_common
swap_size = each.value.swap_size
zram_size = each.value.zram_size
keep_disk_size = var.keep_disk_agents

private_ipv4 = cidrhost(hcloud_network_subnet.agent[[for i, v in var.agent_nodepools : i if v.name == each.value.nodepool_name][0]].ip_range, each.value.index + 101)

Expand Down
1 change: 1 addition & 0 deletions control_planes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module "control_planes" {
cloudinit_runcmd_common = local.cloudinit_runcmd_common
swap_size = each.value.swap_size
zram_size = each.value.zram_size
keep_disk_size = var.keep_disk_cp

# We leave some room so 100 eventual Hetzner LBs that can be created perfectly safely
# It leaves the subnet with 254 x 254 - 100 = 64416 IPs to use, so probably enough.
Expand Down
2 changes: 2 additions & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@
| <a name="input_k3s_global_kubelet_args"></a> [k3s\_global\_kubelet\_args](#input\_k3s\_global\_kubelet\_args) | Global kubelet args for all nodes. | `list(string)` | `[]` | no |
| <a name="input_k3s_registries"></a> [k3s\_registries](#input\_k3s\_registries) | K3S registries.yml contents. It used to access private docker registries. | `string` | `" "` | no |
| <a name="input_k3s_token"></a> [k3s\_token](#input\_k3s\_token) | k3s master token (must match when restoring a cluster). | `string` | `null` | no |
| <a name="input_keep_disk_agents"></a> [keep\_disk\_agents](#input\_keep\_disk\_agents) | Whether to keep OS disks of nodes the same size when upgrading an agent node | `bool` | `false` | no |
| <a name="input_keep_disk_cp"></a> [keep\_disk\_cp](#input\_keep\_disk\_cp) | Whether to keep OS disks of nodes the same size when upgrading a control-plane node | `bool` | `false` | no |
| <a name="input_kured_options"></a> [kured\_options](#input\_kured\_options) | n/a | `map(string)` | `{}` | no |
| <a name="input_kured_version"></a> [kured\_version](#input\_kured\_version) | Version of Kured. | `string` | `null` | no |
| <a name="input_lb_hostname"></a> [lb\_hostname](#input\_lb\_hostname) | The Hetzner Load Balancer hostname, for either Traefik or Ingress-Nginx. | `string` | `""` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/host/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ resource "hcloud_server" "server" {
placement_group_id = var.placement_group_id
backups = var.backups
user_data = data.cloudinit_config.config.rendered
keep_disk = var.keep_disk_size

labels = var.labels

Expand Down
6 changes: 6 additions & 0 deletions modules/host/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,9 @@ variable "zram_size" {
error_message = "Invalid zram size. Examples: 512M, 1G"
}
}

variable "keep_disk_size" {
type = bool
default = false
description = "Whether to keep OS disks of nodes the same size when upgrading a node"
}
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1009,3 +1009,15 @@ variable "enable_delete_protection" {
}
description = "Enable or disable delete protection for resources in Hetzner Cloud."
}

variable "keep_disk_agents" {
type = bool
default = false
description = "Whether to keep OS disks of nodes the same size when upgrading an agent node"
}

variable "keep_disk_cp" {
type = bool
default = false
description = "Whether to keep OS disks of nodes the same size when upgrading a control-plane node"
}

0 comments on commit 3245fb3

Please sign in to comment.