From b058f370e23a3bb90525f35521a1738771bdf77c Mon Sep 17 00:00:00 2001 From: Khanh Pham Date: Wed, 4 Oct 2023 20:37:07 +0700 Subject: [PATCH] Support to customize `ndots` --- README.md | 1 + kubespray/k8s-cluster.yaml | 2 +- variables.tf | 6 ++++++ vm-kubespray-host.tf | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3fba6fb..92169d2 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ The project provides several Terraform variables that allow you to customize the | [location](#input\_location) | The city or region where the cluster is provisioned | `string` | `null` | no | | [cluster\_number](#input\_cluster\_number) | The instance count for the k8s cluster, to differentiate it from other clusters. Example: `00`, `01` | `string` | `"01"` | no | | [cluster\_domain](#input\_cluster\_domain) | The cluster domain name | `string` | `"local"` | no | +| [ndots](#input\_ndots) | Subdomains of DNS domain to be resolved via /etc/resolv.conf for hostnet pods | `number` | `2` | no | | [use\_legacy\_naming\_convention](#input\_use\_legacy\_naming\_convention) | A boolean value that indicates whether to use legacy naming convention for the VM and cluster name. If your cluster was provisioned using version <= 3.x, set it to `true` | `bool` | `false` | no | | [pm\_api\_url](#input\_pm\_api\_url) | The base URL for Proxmox VE API. See https://pve.proxmox.com/wiki/Proxmox_VE_API#API_URL | `string` | n/a | yes | | [pm\_api\_token\_id](#input\_pm\_api\_token\_id) | The token ID to access Proxmox VE API. | `string` | n/a | yes | diff --git a/kubespray/k8s-cluster.yaml b/kubespray/k8s-cluster.yaml index 02a2b6c..989119c 100644 --- a/kubespray/k8s-cluster.yaml +++ b/kubespray/k8s-cluster.yaml @@ -159,7 +159,7 @@ kube_encrypt_secret_data: false # Kubernetes cluster name, also will be used as DNS domain cluster_name: ${cluster_name} # Subdomains of DNS domain to be resolved via /etc/resolv.conf for hostnet pods -ndots: 2 +ndots: ${ndots} # dns_timeout: 2 # dns_attempts: 2 # Custom search domains to be added in addition to the default cluster search domains diff --git a/variables.tf b/variables.tf index fa4dfbb..9eca4a3 100644 --- a/variables.tf +++ b/variables.tf @@ -29,6 +29,12 @@ locals { cluster_fqdn = "${local.cluster_name}.${var.cluster_domain}" } +variable "ndots" { + type = number + description = "Subdomains of DNS domain to be resolved via /etc/resolv.conf for hostnet pods" + default = 2 +} + variable "use_legacy_naming_convention" { type = bool description = "A boolean value that indicates whether to use legacy naming convention for the VM and cluster name. If your cluster was provisioned using version <= 3.x, set it to `true`" diff --git a/vm-kubespray-host.tf b/vm-kubespray-host.tf index 27fd333..9662785 100644 --- a/vm-kubespray-host.tf +++ b/vm-kubespray-host.tf @@ -31,6 +31,7 @@ locals { kube_version = var.kube_version kube_network_plugin = var.kube_network_plugin cluster_name = local.cluster_fqdn + ndots = var.ndots enable_nodelocaldns = var.enable_nodelocaldns podsecuritypolicy_enabled = var.podsecuritypolicy_enabled persistent_volumes_enabled = var.persistent_volumes_enabled