Skip to content

Commit

Permalink
Merge pull request #87 from khanh-ph/release/4.1.0
Browse files Browse the repository at this point in the history
Release version 4.1.0
  • Loading branch information
khanh-ph authored Sep 26, 2023
2 parents b97e9d2 + bbd150f commit 74fe844
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 98 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,18 @@ The project provides several Terraform variables that allow you to customize the
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_env_name"></a> [env\_name](#input\_env\_name) | The stage of the development lifecycle for the k8s cluster. Example: `prod`, `dev`, `qa`, `stage`, `test` | `string` | `"test"` | no |
| <a name="input_location"></a> [location](#input\_location) | The city or region where the cluster is provisioned | `string` | `null` | no |
| <a name="input_cluster_number"></a> [cluster\_number](#input\_cluster\_number) | The instance count for the k8s cluster, to differentiate it from other clusters. Example: `00`, `01` | `string` | `"01"` | no |
| <a name="input_cluster_domain"></a> [cluster\_domain](#input\_cluster\_domain) | The cluster domain name | `string` | `"local"` | no |
| <a name="input_use_legacy_naming_convention"></a> [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 |
| <a name="input_pm_api_url"></a> [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 |
| <a name="input_pm_api_token_id"></a> [pm\_api\_token\_id](#input\_pm\_api\_token\_id) | The token ID to access Proxmox VE API. | `string` | n/a | yes |
| <a name="input_pm_api_token_secret"></a> [pm\_api\_token\_secret](#input\_pm\_api\_token\_secret) | The UUID/secret of the token defined in the variable `pm_api_token_id`. | `string` | n/a | yes |
| <a name="input_pm_tls_insecure"></a> [pm\_tls\_insecure](#input\_pm\_tls\_insecure) | Disable TLS verification while connecting to the Proxmox VE API server. | `bool` | n/a | yes |
| <a name="input_pm_host"></a> [pm\_host](#input\_pm\_host) | The name of Proxmox node where the VM is placed. | `string` | n/a | yes |
| <a name="input_pm_parallel"></a> [pm\_parallel](#input\_pm\_parallel) | The number of simultaneous Proxmox processes. E.g: creating resources. | `number` | `2` | no |
| <a name="input_pm_timeout"></a> [pm\_timeout](#input\_pm\_timeout) | Timeout value (seconds) for proxmox API calls. | `number` | `600` | no |
| <a name="input_env_name"></a> [env\_name](#input\_env\_name) | The stage of the development lifecycle for the k8s cluster. Example: `prod`, `dev`, `qa`, `stage`, `test` | `string` | `"test"` | no |
| <a name="input_location"></a> [location](#input\_location) | The city or region where the cluster is provisioned | `string` | `null` | no |
| <a name="input_cluster_number"></a> [cluster\_number](#input\_cluster\_number) | The instance count for the k8s cluster, to differentiate it from other clusters. Example: `00`, `01` | `string` | `"01"` | no |
| <a name="input_cluster_domain"></a> [cluster\_domain](#input\_cluster\_domain) | The cluster domain name | `string` | `"local"` | no |
| <a name="input_internal_net_name"></a> [internal\_net\_name](#input\_internal\_net\_name) | Name of the internal network bridge | `string` | `"vmbr1"` | no |
| <a name="input_internal_net_subnet_cidr"></a> [internal\_net\_subnet\_cidr](#input\_internal\_net\_subnet\_cidr) | CIDR of the internal network | `string` | `"10.0.1.0/24"` | no |
| <a name="input_ssh_private_key"></a> [ssh\_private\_key](#input\_ssh\_private\_key) | SSH private key in base64, will be used by Terraform client to connect to the VM after provisioning | `string` | n/a | yes |
Expand All @@ -90,7 +91,9 @@ The project provides several Terraform variables that allow you to customize the
| <a name="input_bastion_ssh_ip"></a> [bastion\_ssh\_ip](#input\_bastion\_ssh\_ip) | IP of the bastion host, could be either public IP or local network IP of the bastion host | `string` | `""` | no |
| <a name="input_bastion_ssh_user"></a> [bastion\_ssh\_user](#input\_bastion\_ssh\_user) | The user to authenticate to the bastion host | `string` | `"ubuntu"` | no |
| <a name="input_bastion_ssh_port"></a> [bastion\_ssh\_port](#input\_bastion\_ssh\_port) | The SSH port number on the bastion host | `number` | `22` | no |
| <a name="input_create_kubespray_host"></a> [create\_kubespray\_host](#input\_create\_kubespray\_host) | n/a | `bool` | `true` | no |
| <a name="input_vm_k8s_control_plane"></a> [vm\_k8s\_control\_plane](#input\_vm\_k8s\_control\_plane) | Control Plane VM specification | `object({ node_count = number, vcpus = number, memory = number, disk_size = number })` | <pre>{<br> "disk_size": 20,<br> "memory": 1536,<br> "node_count": 1,<br> "vcpus": 2<br>}</pre> | no |
| <a name="input_vm_k8s_worker"></a> [vm\_k8s\_worker](#input\_vm\_k8s\_worker) | Worker VM specification | `object({ node_count = number, vcpus = number, memory = number, disk_size = number })` | <pre>{<br> "disk_size": 20,<br> "memory": 2048,<br> "node_count": 2,<br> "vcpus": 2<br>}</pre> | no |
| <a name="input_create_kubespray_host"></a> [create\_kubespray\_host](#input\_create\_kubespray\_host) | Kubernetes settings ####################################################################### | `bool` | `true` | no |
| <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) | The network plugin to be installed on your cluster. Example: `cilium`, `calico`, `kube-ovn`, `weave` or `flannel` | `string` | `"calico"` | no |
Expand All @@ -101,9 +104,6 @@ The project provides several Terraform variables that allow you to customize the
| <a name="input_ingress_nginx_enabled"></a> [ingress\_nginx\_enabled](#input\_ingress\_nginx\_enabled) | A boolean value that indicates whether to enable Nginx ingress on your cluster | `bool` | `false` | no |
| <a name="input_argocd_enabled"></a> [argocd\_enabled](#input\_argocd\_enabled) | A boolean value that indicates whether to enable ArgoCD on your cluster | `bool` | `false` | no |
| <a name="input_argocd_version"></a> [argocd\_version](#input\_argocd\_version) | The ArgoCD version to be installed | `string` | `"v2.4.12"` | no |
| <a name="input_vm_k8s_control_plane"></a> [vm\_k8s\_control\_plane](#input\_vm\_k8s\_control\_plane) | Control Plane VM specification | `object({ node_count = number, vcpus = number, memory = number, disk_size = number })` | <pre>{<br> "disk_size": 20,<br> "memory": 1536,<br> "node_count": 1,<br> "vcpus": 2<br>}</pre> | no |
| <a name="input_vm_k8s_worker"></a> [vm\_k8s\_worker](#input\_vm\_k8s\_worker) | Worker VM specification | `object({ node_count = number, vcpus = number, memory = number, disk_size = number })` | <pre>{<br> "disk_size": 20,<br> "memory": 2048,<br> "node_count": 2,<br> "vcpus": 2<br>}</pre> | no |
| <a name="input_use_legacy_naming_convention"></a> [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 |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Blog posts
Expand Down
62 changes: 39 additions & 23 deletions example.tfvars
Original file line number Diff line number Diff line change
@@ -1,58 +1,74 @@
# Environment
########################################################################
## Replace `demo` with your desired environment name.
env_name = "demo"

env_name = "demo"
location = null
cluster_number = "01"
cluster_domain = "local"
# If using this project version >= 4.0.0 with a previously provisioned cluster,
# check this setting: https://github.com/khanh-ph/proxmox-kubernetes/releases/tag/4.0.0
use_legacy_naming_convention = false

# Proxmox VE
########################################################################
## Specify Proxmox VE API URL, token details, and Proxmox host where VM will be hosted.
## If you've not created an API token, please refer to this guide: https://registry.terraform.io/providers/Telmate/proxmox/2.9.14/docs
# Proxmox VE API details and VM hosting configuration
# API token guide: https://registry.terraform.io/providers/Telmate/proxmox/2.9.14/docs
pm_api_url = "https://your-proxmox-url/api"
pm_api_token_id = "your-api-token-id"
pm_api_token_secret = "your-api-token-secret"
pm_tls_insecure = false
pm_host = "your-proxmox-host"
pm_parallel = 2
pm_timeout = 600


# Internal Network
# Common infrastructure configurations
########################################################################
## Replace `vmbr1` with your bridge name dedicated to the Kubernetes internal network.
# Kubernetes internal network
internal_net_name = "vmbr1"
## Replace `10.0.1.0/24` with your internal network address and prefix length.
# Internal network CIDR
internal_net_subnet_cidr = "10.0.1.0/24"
# Base64 encoded keys for Kubernetes admin authentication
ssh_public_keys = "put-base64-encoded-public-keys-here"
# Caution: In production, follow https://developer.hashicorp.com/terraform/tutorials/configuration-language/sensitive-variables
# to protect the sensitive variable `ssh_private_key`
ssh_private_key = "put-base64-encoded-private-key-here"

# Default disk storage for the VMs. Uncomment the following line if needed
# vm_os_disk_storage = "local-lvm"

# Bastion Host
########################################################################
## Replace `192.168.1.131` with LAN IP/ public IP address of your bastion host.
bastion_ssh_port = 22
# Bastion host details. This is required for the Terraform client to
# connect to the Kubespray VM that will be placed into the internet network
bastion_ssh_ip = "192.168.1.131"
bastion_ssh_user = "ubuntu"


# SSH
########################################################################
## Specify base64 encoding of SSH keys for Kubernetes admin authentication.
ssh_public_keys = "put-base64-encoded-public-keys-here"
ssh_private_key = "put-base64-encoded-private-key-here"

bastion_ssh_port = 22

# VM specifications
########################################################################
# Replace `2` with the maximum cores that your Proxmox VE server can give to a VM.
# Maximum cores that your Proxmox VE server can give to a VM
vm_max_vcpus = 2
# Specify the VM specifications for the Kubernetes control plane.
# Control plane VM specifications
vm_k8s_control_plane = {
node_count = 1
vcpus = 2
memory = 2048
disk_size = 20
}
# Specify the VM specifications for the Kubernetes worker nodes.
# Worker nodes VM specifications
vm_k8s_worker = {
node_count = 3
vcpus = 2
memory = 3072
disk_size = 20
}

# Kubernetes settings
########################################################################
kube_version = "v1.24.6"
kube_network_plugin = "calico"
enable_nodelocaldns = false
podsecuritypolicy_enabled = false
persistent_volumes_enabled = false
helm_enabled = false
ingress_nginx_enabled = false
argocd_enabled = false
argocd_version = "v2.4.12"
121 changes: 54 additions & 67 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
#
# Environment
########################################################################
variable "env_name" {
type = string
description = "The stage of the development lifecycle for the k8s cluster. Example: `prod`, `dev`, `qa`, `stage`, `test`"
default = "test"
}

variable "location" {
type = string
description = "The city or region where the cluster is provisioned"
default = null
}

variable "cluster_number" {
type = string
description = "The instance count for the k8s cluster, to differentiate it from other clusters. Example: `00`, `01`"
default = "01"
}

variable "cluster_domain" {
type = string
description = "The cluster domain name"
default = "local"
}

locals {
cluster_name = var.location != null ? "k8s-${var.env_name}-${var.location}-${var.cluster_number}" : "k8s-${var.env_name}-${var.cluster_number}"
cluster_fqdn = "${local.cluster_name}.${var.cluster_domain}"
}

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`"
default = false
}

# Proxmox VE
#
########################################################################
variable "pm_api_url" {
type = string
description = "The base URL for Proxmox VE API. See https://pve.proxmox.com/wiki/Proxmox_VE_API#API_URL"
Expand Down Expand Up @@ -35,43 +71,8 @@ variable "pm_timeout" {
default = 600
}

#
# Environment
#

variable "env_name" {
type = string
description = "The stage of the development lifecycle for the k8s cluster. Example: `prod`, `dev`, `qa`, `stage`, `test`"
default = "test"
}

variable "location" {
type = string
description = "The city or region where the cluster is provisioned"
default = null
}

variable "cluster_number" {
type = string
description = "The instance count for the k8s cluster, to differentiate it from other clusters. Example: `00`, `01`"
default = "01"
}

variable "cluster_domain" {
type = string
description = "The cluster domain name"
default = "local"
}

locals {
cluster_name = var.location != null ? "k8s-${var.env_name}-${var.location}-${var.cluster_number}" : "k8s-${var.env_name}-${var.cluster_number}"
cluster_fqdn = "${local.cluster_name}.${var.cluster_domain}"
}

#
# Common infrastructure
#

########################################################################
variable "internal_net_name" {
type = string
description = "Name of the internal network bridge"
Expand Down Expand Up @@ -147,10 +148,6 @@ variable "vm_ubuntu_tmpl_name" {
default = "ubuntu-2204"
}

#
# Bastion host
#

variable "bastion_ssh_ip" {
type = string
description = "IP of the bastion host, could be either public IP or local network IP of the bastion host"
Expand All @@ -169,10 +166,22 @@ variable "bastion_ssh_port" {
default = 22
}

#
# Kubesray options
#
# Kuberentes VM specifications for Kubernetes nodes
########################################################################
variable "vm_k8s_control_plane" {
type = object({ node_count = number, vcpus = number, memory = number, disk_size = number })
description = "Control Plane VM specification"
default = { node_count = 1, vcpus = 2, memory = 1536, disk_size = 20 }
}

variable "vm_k8s_worker" {
type = object({ node_count = number, vcpus = number, memory = number, disk_size = number })
description = "Worker VM specification"
default = { node_count = 2, vcpus = 2, memory = 2048, disk_size = 20 }
}

# Kubernetes settings
########################################################################
variable "create_kubespray_host" {
type = bool
default = true
Expand Down Expand Up @@ -230,26 +239,4 @@ variable "argocd_version" {
default = "v2.4.12"
}

#
# VM specifications for Kubernetes nodes
#
variable "vm_k8s_control_plane" {
type = object({ node_count = number, vcpus = number, memory = number, disk_size = number })
description = "Control Plane VM specification"
default = { node_count = 1, vcpus = 2, memory = 1536, disk_size = 20 }
}

variable "vm_k8s_worker" {
type = object({ node_count = number, vcpus = number, memory = number, disk_size = number })
description = "Worker VM specification"
default = { node_count = 2, vcpus = 2, memory = 2048, disk_size = 20 }
}

#
# Others
#
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`"
default = false
}

0 comments on commit 74fe844

Please sign in to comment.