2018-08-20 03:48:22 +02:00
|
|
|
variable "cluster_name" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2018-08-20 03:48:22 +02:00
|
|
|
description = "Unique cluster name (prepended to dns_zone)"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Azure
|
|
|
|
|
2024-07-09 06:20:46 +02:00
|
|
|
variable "location" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2024-07-09 06:20:46 +02:00
|
|
|
description = "Azure location (e.g. centralus , see `az account list-locations --output table`)"
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "dns_zone" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2018-08-20 03:48:22 +02:00
|
|
|
description = "Azure DNS Zone (e.g. azure.example.com)"
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "dns_zone_group" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2018-08-20 03:48:22 +02:00
|
|
|
description = "Resource group where the Azure DNS Zone resides (e.g. global)"
|
|
|
|
}
|
|
|
|
|
|
|
|
# instances
|
|
|
|
|
2024-07-09 16:53:41 +02:00
|
|
|
variable "os_image" {
|
|
|
|
type = string
|
|
|
|
description = "Channel for a Container Linux derivative (flatcar-stable, flatcar-beta, flatcar-alpha)"
|
|
|
|
default = "flatcar-stable"
|
|
|
|
|
|
|
|
validation {
|
|
|
|
condition = contains(["flatcar-stable", "flatcar-beta", "flatcar-alpha"], var.os_image)
|
|
|
|
error_message = "The os_image must be flatcar-stable, flatcar-beta, or flatcar-alpha."
|
|
|
|
}
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
2024-07-09 16:53:41 +02:00
|
|
|
variable "controller_count" {
|
2019-10-01 07:18:15 +02:00
|
|
|
type = number
|
2024-07-09 16:53:41 +02:00
|
|
|
description = "Number of controllers (i.e. masters)"
|
2019-10-01 07:18:15 +02:00
|
|
|
default = 1
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "controller_type" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2018-08-20 03:48:22 +02:00
|
|
|
description = "Machine type for controllers (see `az vm list-skus --location centralus`)"
|
2019-10-01 07:18:15 +02:00
|
|
|
default = "Standard_B2s"
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
2024-07-09 16:53:41 +02:00
|
|
|
variable "controller_disk_type" {
|
|
|
|
type = string
|
|
|
|
description = "Type of managed disk for controller node(s)"
|
|
|
|
default = "Premium_LRS"
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "controller_disk_size" {
|
|
|
|
type = number
|
|
|
|
description = "Size of the managed disk in GB for controller node(s)"
|
|
|
|
default = 30
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "worker_count" {
|
|
|
|
type = number
|
|
|
|
description = "Number of workers"
|
|
|
|
default = 1
|
|
|
|
}
|
|
|
|
|
2018-08-20 03:48:22 +02:00
|
|
|
variable "worker_type" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2018-08-20 03:48:22 +02:00
|
|
|
description = "Machine type for workers (see `az vm list-skus --location centralus`)"
|
2022-10-13 18:47:45 +02:00
|
|
|
default = "Standard_D2as_v5"
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
2024-07-09 16:53:41 +02:00
|
|
|
variable "worker_disk_type" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2024-07-09 16:53:41 +02:00
|
|
|
description = "Type of managed disk for worker nodes"
|
|
|
|
default = "Standard_LRS"
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
2024-07-09 16:53:41 +02:00
|
|
|
variable "worker_disk_size" {
|
2019-10-01 07:18:15 +02:00
|
|
|
type = number
|
2024-07-09 16:53:41 +02:00
|
|
|
description = "Size of the managed disk in GB for worker nodes"
|
2021-04-26 20:04:30 +02:00
|
|
|
default = 30
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
2024-07-09 16:53:41 +02:00
|
|
|
variable "worker_ephemeral_disk" {
|
|
|
|
type = bool
|
|
|
|
description = "Use ephemeral local disk instead of managed disk (requires vm_type with local storage)"
|
|
|
|
default = false
|
|
|
|
}
|
|
|
|
|
2018-08-20 03:48:22 +02:00
|
|
|
variable "worker_priority" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2020-04-13 00:49:48 +02:00
|
|
|
description = "Set worker priority to Spot to use reduced cost surplus capacity, with the tradeoff that instances can be deallocated at any time."
|
2019-10-01 07:18:15 +02:00
|
|
|
default = "Regular"
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
2020-03-29 20:46:22 +02:00
|
|
|
variable "controller_snippets" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = list(string)
|
2018-08-20 03:48:22 +02:00
|
|
|
description = "Controller Container Linux Config snippets"
|
|
|
|
default = []
|
|
|
|
}
|
|
|
|
|
2020-03-29 20:46:22 +02:00
|
|
|
variable "worker_snippets" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = list(string)
|
2018-08-20 03:48:22 +02:00
|
|
|
description = "Worker Container Linux Config snippets"
|
|
|
|
default = []
|
|
|
|
}
|
|
|
|
|
|
|
|
# configuration
|
|
|
|
|
|
|
|
variable "ssh_authorized_key" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2018-08-20 03:48:22 +02:00
|
|
|
description = "SSH public key for user 'core'"
|
|
|
|
}
|
|
|
|
|
2023-09-17 23:21:42 +02:00
|
|
|
variable "azure_authorized_key" {
|
|
|
|
type = string
|
|
|
|
description = "Optionally, pass a dummy RSA key to satisfy Azure validations (then use an ed25519 key set above)"
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
2019-05-06 09:38:23 +02:00
|
|
|
variable "networking" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2022-02-07 16:44:09 +01:00
|
|
|
description = "Choice of networking provider (flannel, calico, or cilium)"
|
|
|
|
default = "cilium"
|
2019-05-06 09:38:23 +02:00
|
|
|
}
|
|
|
|
|
2024-07-06 02:21:50 +02:00
|
|
|
variable "network_cidr" {
|
|
|
|
type = object({
|
|
|
|
ipv4 = list(string)
|
2024-07-14 22:48:55 +02:00
|
|
|
ipv6 = optional(list(string), [])
|
2024-07-06 02:21:50 +02:00
|
|
|
})
|
|
|
|
description = "Virtual network CIDR ranges"
|
|
|
|
default = {
|
|
|
|
ipv4 = ["10.0.0.0/16"]
|
|
|
|
}
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
variable "pod_cidr" {
|
2019-05-28 06:43:08 +02:00
|
|
|
type = string
|
2019-10-01 07:18:15 +02:00
|
|
|
description = "CIDR IPv4 range to assign Kubernetes pods"
|
2018-08-20 03:48:22 +02:00
|
|
|
default = "10.2.0.0/16"
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "service_cidr" {
|
2019-11-14 08:44:02 +01:00
|
|
|
type = string
|
2018-08-20 03:48:22 +02:00
|
|
|
description = <<EOD
|
|
|
|
CIDR IPv4 range to assign Kubernetes services.
|
|
|
|
The 1st IP will be reserved for kube_apiserver, the 10th IP will be reserved for coredns.
|
|
|
|
EOD
|
2019-11-14 08:44:02 +01:00
|
|
|
default = "10.3.0.0/16"
|
2018-08-20 03:48:22 +02:00
|
|
|
}
|
|
|
|
|
2019-09-28 23:59:24 +02:00
|
|
|
variable "worker_node_labels" {
|
2019-11-14 08:44:02 +01:00
|
|
|
type = list(string)
|
2019-09-29 00:01:14 +02:00
|
|
|
description = "List of initial worker node labels"
|
2019-11-14 08:44:02 +01:00
|
|
|
default = []
|
2019-09-28 23:59:24 +02:00
|
|
|
}
|
|
|
|
|
2024-08-01 00:05:57 +02:00
|
|
|
# advanced
|
|
|
|
|
|
|
|
variable "controller_arch" {
|
2022-10-14 05:49:01 +02:00
|
|
|
type = string
|
2024-08-01 00:05:57 +02:00
|
|
|
description = "Controller node(s) architecture (amd64 or arm64)"
|
2022-10-14 05:49:01 +02:00
|
|
|
default = "amd64"
|
2024-08-01 00:05:57 +02:00
|
|
|
validation {
|
|
|
|
condition = contains(["amd64", "arm64"], var.controller_arch)
|
|
|
|
error_message = "The controller_arch must be amd64 or arm64."
|
|
|
|
}
|
|
|
|
}
|
2022-10-14 05:49:01 +02:00
|
|
|
|
2024-08-01 00:05:57 +02:00
|
|
|
variable "worker_arch" {
|
|
|
|
type = string
|
|
|
|
description = "Worker node(s) architecture (amd64 or arm64)"
|
|
|
|
default = "amd64"
|
2022-10-14 05:49:01 +02:00
|
|
|
validation {
|
2024-08-01 00:05:57 +02:00
|
|
|
condition = contains(["amd64", "arm64"], var.worker_arch)
|
|
|
|
error_message = "The worker_arch must be amd64 or arm64."
|
2022-10-14 05:49:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-13 18:47:45 +02:00
|
|
|
variable "daemonset_tolerations" {
|
|
|
|
type = list(string)
|
|
|
|
description = "List of additional taint keys kube-system DaemonSets should tolerate (e.g. ['custom-role', 'gpu-role'])"
|
|
|
|
default = []
|
|
|
|
}
|
|
|
|
|
2024-05-13 06:03:40 +02:00
|
|
|
variable "components" {
|
|
|
|
description = "Configure pre-installed cluster components"
|
|
|
|
# Component configs are passed through to terraform-render-bootstrap,
|
|
|
|
# which handles type enforcement and defines defaults
|
|
|
|
# https://github.com/poseidon/terraform-render-bootstrap/blob/main/variables.tf#L95
|
|
|
|
type = object({
|
|
|
|
enable = optional(bool)
|
|
|
|
coredns = optional(map(any))
|
|
|
|
kube_proxy = optional(map(any))
|
Introduce the component system for managing pre-installed addons
* Previously: Typhoon provisions clusters with kube-system components
like CoreDNS, kube-proxy, and a chosen CNI provider (among flannel,
Calico, or Cilium) pre-installed. This is convenient since clusters
come with "batteries included". But it also means upgrading these
components is generally done in lock-step, by upgrading to a new
Typhoon / Kubernetes release
* It can be valuable to manage these components with a separate
plan/apply process or through automations and deploy systems. For
example, this allows managing CoreDNS separately from the cluster's
lifecycle.
* These "components" will continue to be pre-installed by default,
but a new `components` variable allows them to be disabled and
managed as "addons", components you apply after cluster creation
and manage on a rolling basis. For some of these, we may provide
Terraform modules to aide in managing these components.
```
module "cluster" {
# defaults
components = {
enable = true
coredns = {
enable = true
}
kube_proxy = {
enable = true
}
# Only the CNI set in var.networking will be installed
flannel = {
enable = true
}
calico = {
enable = true
}
cilium = {
enable = true
}
}
}
```
An earlier variable `install_container_networking = true/false` has
been removed, since it can now be achieved with this more extensible
and general components mechanism by setting the chosen networking
provider enable field to false.
2024-05-19 00:05:33 +02:00
|
|
|
flannel = optional(map(any))
|
|
|
|
calico = optional(map(any))
|
|
|
|
cilium = optional(map(any))
|
2024-05-13 06:03:40 +02:00
|
|
|
})
|
|
|
|
default = null
|
|
|
|
}
|