Skip to content

Commit

Permalink
Add support to customize the cluster name
Browse files Browse the repository at this point in the history
  • Loading branch information
khanh-ph committed Sep 24, 2023
1 parent dd766f0 commit c90b3d8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ The project provides several Terraform variables that allow you to customize the
| <a name="input_kubespray_image"></a> [kubespray\_image](#input\_kubespray\_image) | n/a | `string` | `"khanhphhub/kubespray:v2.22.0"` | no |
| <a name="input_kube_version"></a> [kube\_version](#input\_kube\_version) | Kubernetes version | `string` | `"v1.24.6"` | no |
| <a name="input_kube_network_plugin"></a> [kube\_network\_plugin](#input\_kube\_network\_plugin) | Choose network plugin (cilium, calico, kube-ovn, weave or flannel. Use cni for generic cni plugin) | `string` | `"calico"` | no |
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Kubernetes cluster name, also will be used as DNS domain | `string` | `""` | no |
| <a name="input_enable_nodelocaldns"></a> [enable\_nodelocaldns](#input\_enable\_nodelocaldns) | Enable nodelocal dns cache | `bool` | `false` | no |
| <a name="input_podsecuritypolicy_enabled"></a> [podsecuritypolicy\_enabled](#input\_podsecuritypolicy\_enabled) | pod security policy (RBAC must be enabled either by having 'RBAC' in authorization\_modes or kubeadm enabled) | `bool` | `false` | no |
| <a name="input_persistent_volumes_enabled"></a> [persistent\_volumes\_enabled](#input\_persistent\_volumes\_enabled) | Add Persistent Volumes Storage Class for corresponding cloud provider (supported: in-tree OpenStack, Cinder CSI, AWS EBS CSI, Azure Disk CSI, GCP Persistent Disk CSI) | `bool` | `false` | no |
Expand Down
2 changes: 1 addition & 1 deletion kubespray/k8s-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ kube_encrypt_secret_data: false

# DNS configuration.
# Kubernetes cluster name, also will be used as DNS domain
cluster_name: cluster.local
cluster_name: ${cluster_name}
# Subdomains of DNS domain to be resolved via /etc/resolv.conf for hostnet pods
ndots: 2
# dns_timeout: 2
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ variable "kube_network_plugin" {
description = "Choose network plugin (cilium, calico, kube-ovn, weave or flannel. Use cni for generic cni plugin)"
default = "calico"
}
variable "cluster_name" {
type = string
description = "Kubernetes cluster name, also will be used as DNS domain"
default = ""
}
variable "enable_nodelocaldns" {
type = bool
description = "Enable nodelocal dns cache"
Expand Down
1 change: 1 addition & 0 deletions vm-kubespray-host.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ locals {
{
kube_version = var.kube_version
kube_network_plugin = var.kube_network_plugin
cluster_name = var.cluster_name != "" ? var.cluster_name : "proxmox-k8s-${var.env_name}.local"
enable_nodelocaldns = var.enable_nodelocaldns
podsecuritypolicy_enabled = var.podsecuritypolicy_enabled
persistent_volumes_enabled = var.persistent_volumes_enabled
Expand Down

0 comments on commit c90b3d8

Please sign in to comment.