mirror of
https://github.com/jbowdre/vsphere-k8s.git
synced 2024-11-25 17:12:17 +00:00
Compare commits
No commits in common. "0a699fb499b0bf469950f07ed918e4a150939be4" and "beb7a2fecae709aa9d73632e9fba87a1bbc65a06" have entirely different histories.
0a699fb499
...
beb7a2feca
4 changed files with 37 additions and 47 deletions
|
@ -20,6 +20,7 @@ vsphere_folder = "_Templates"
|
|||
vm_guest_os_language = "en_US"
|
||||
vm_guest_os_keyboard = "us"
|
||||
vm_guest_os_timezone = "America/Chicago"
|
||||
vm_guest_os_family = "linux"
|
||||
vm_guest_os_type = "ubuntu64Guest"
|
||||
|
||||
// Virtual Machine Hardware Settings
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
variable "vsphere_endpoint" {
|
||||
type = string
|
||||
description = "The fully qualified domain name or IP address of the vCenter Server instance. ('vcenter.lab.local')"
|
||||
description = "The fully qualified domain name or IP address of the vCenter Server instance. (e.g. 'sfo-w01-vc01.sfo.rainpole.io')"
|
||||
}
|
||||
|
||||
variable "vsphere_username" {
|
||||
type = string
|
||||
description = "The username to login to the vCenter Server instance. ('packer')"
|
||||
description = "The username to login to the vCenter Server instance. (e.g. 'svc-packer-vsphere@rainpole.io')"
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
|
@ -35,27 +35,27 @@ variable "vsphere_insecure_connection" {
|
|||
|
||||
variable "vsphere_datacenter" {
|
||||
type = string
|
||||
description = "The name of the target vSphere datacenter. ('Lab Datacenter')"
|
||||
description = "The name of the target vSphere datacenter. (e.g. 'sfo-w01-dc01')"
|
||||
}
|
||||
|
||||
variable "vsphere_cluster" {
|
||||
type = string
|
||||
description = "The name of the target vSphere cluster. ('cluster-01')"
|
||||
description = "The name of the target vSphere cluster. (e.g. 'sfo-w01-cl01')"
|
||||
}
|
||||
|
||||
variable "vsphere_datastore" {
|
||||
type = string
|
||||
description = "The name of the target vSphere datastore. ('datastore-01')"
|
||||
description = "The name of the target vSphere datastore. (e.g. 'sfo-w01-cl01-vsan01')"
|
||||
}
|
||||
|
||||
variable "vsphere_network" {
|
||||
type = string
|
||||
description = "The name of the target vSphere network. ('network-192.168.1.0')"
|
||||
description = "The name of the target vSphere network segment. (e.g. 'sfo-w01-dhcp')"
|
||||
}
|
||||
|
||||
variable "vsphere_folder" {
|
||||
type = string
|
||||
description = "The name of the target vSphere folder. ('_Templates')"
|
||||
description = "The name of the target vSphere cluster. (e.g. 'sfo-w01-fd-templates')"
|
||||
}
|
||||
|
||||
// Virtual Machine Settings
|
||||
|
@ -83,31 +83,36 @@ variable "vm_guest_os_timezone" {
|
|||
default = "UTC"
|
||||
}
|
||||
|
||||
variable "vm_guest_os_family" {
|
||||
type = string
|
||||
description = "The guest operating system family. Used for naming. (e.g. 'linux')"
|
||||
}
|
||||
|
||||
variable "vm_guest_os_type" {
|
||||
type = string
|
||||
description = "The guest operating system type. ('ubuntu64Guest')"
|
||||
description = "The guest operating system type, also know as guestid. (e.g. 'ubuntu64Guest')"
|
||||
}
|
||||
|
||||
variable "vm_firmware" {
|
||||
type = string
|
||||
description = "The virtual machine firmware. ('efi-secure'. 'efi', or 'bios')"
|
||||
description = "The virtual machine firmware. (e.g. 'efi-secure'. 'efi', or 'bios')"
|
||||
default = "efi-secure"
|
||||
}
|
||||
|
||||
variable "vm_cdrom_type" {
|
||||
type = string
|
||||
description = "The virtual machine CD-ROM type. ('sata', or 'ide')"
|
||||
description = "The virtual machine CD-ROM type. (e.g. 'sata', or 'ide')"
|
||||
default = "sata"
|
||||
}
|
||||
|
||||
variable "vm_cpu_count" {
|
||||
type = number
|
||||
description = "The number of virtual CPUs. ('2')"
|
||||
description = "The number of virtual CPUs. (e.g. '2')"
|
||||
}
|
||||
|
||||
variable "vm_cpu_cores" {
|
||||
type = number
|
||||
description = "The number of virtual CPUs cores per socket. ('1')"
|
||||
description = "The number of virtual CPUs cores per socket. (e.g. '1')"
|
||||
}
|
||||
|
||||
variable "vm_cpu_hot_add" {
|
||||
|
@ -118,7 +123,7 @@ variable "vm_cpu_hot_add" {
|
|||
|
||||
variable "vm_mem_size" {
|
||||
type = number
|
||||
description = "The size for the virtual memory in MB. ('2048')"
|
||||
description = "The size for the virtual memory in MB. (e.g. '2048')"
|
||||
}
|
||||
|
||||
variable "vm_mem_hot_add" {
|
||||
|
@ -129,13 +134,13 @@ variable "vm_mem_hot_add" {
|
|||
|
||||
variable "vm_disk_size" {
|
||||
type = number
|
||||
description = "The size for the virtual disk in MB. ('61440' = 60GB)"
|
||||
description = "The size for the virtual disk in MB. (e.g. '61440' = 60GB)"
|
||||
default = 61440
|
||||
}
|
||||
|
||||
variable "vm_disk_controller_type" {
|
||||
type = list(string)
|
||||
description = "The virtual disk controller types in sequence. ('pvscsi')"
|
||||
description = "The virtual disk controller types in sequence. (e.g. 'pvscsi')"
|
||||
default = ["pvscsi"]
|
||||
}
|
||||
|
||||
|
@ -153,7 +158,7 @@ variable "vm_disk_eagerly_scrub" {
|
|||
|
||||
variable "vm_network_card" {
|
||||
type = string
|
||||
description = "The virtual network card type. ('vmxnet3' or 'e1000e')"
|
||||
description = "The virtual network card type. (e.g. 'vmxnet3' or 'e1000e')"
|
||||
default = "vmxnet3"
|
||||
}
|
||||
|
||||
|
@ -184,7 +189,7 @@ variable "common_template_conversion" {
|
|||
|
||||
variable "common_content_library_name" {
|
||||
type = string
|
||||
description = "The name of the target vSphere content library, if used. ('Lab-CL')"
|
||||
description = "The name of the target vSphere content library, if used. (e.g. 'sfo-w01-cl01-lib01')"
|
||||
default = null
|
||||
}
|
||||
|
||||
|
@ -243,27 +248,27 @@ variable "common_ovf_export_path" {
|
|||
|
||||
variable "common_iso_datastore" {
|
||||
type = string
|
||||
description = "The name of the source vSphere datastore for ISO images. ('datastore-iso-01')"
|
||||
description = "The name of the source vSphere datastore for ISO images. (e.g. 'sfo-w01-cl01-nfs01')"
|
||||
}
|
||||
|
||||
variable "iso_url" {
|
||||
type = string
|
||||
description = "The URL source of the ISO image. ('https://releases.ubuntu.com/20.04.5/ubuntu-20.04.5-live-server-amd64.iso')"
|
||||
description = "The URL source of the ISO image. (e.g. 'https://artifactory.rainpole.io/.../os.iso')"
|
||||
}
|
||||
|
||||
variable "iso_path" {
|
||||
type = string
|
||||
description = "The path on the source vSphere datastore for ISO image. ('ISOs/Linux')"
|
||||
description = "The path on the source vSphere datastore for ISO image. (e.g. 'iso/linux/ubuntu')"
|
||||
}
|
||||
|
||||
variable "iso_file" {
|
||||
type = string
|
||||
description = "The file name of the ISO image used by the vendor. ('ubuntu-20.04.5-live-server-amd64.iso')"
|
||||
description = "The file name of the ISO image used by the vendor. (e.g. 'ubuntu-<version>-live-server-amd64.iso')"
|
||||
}
|
||||
|
||||
variable "iso_checksum_type" {
|
||||
type = string
|
||||
description = "The checksum algorithm used by the vendor. ('sha256')"
|
||||
description = "The checksum algorithm used by the vendor. (e.g. 'sha256')"
|
||||
}
|
||||
|
||||
variable "iso_checksum_value" {
|
||||
|
@ -281,7 +286,7 @@ variable "cd_label" {
|
|||
|
||||
variable "vm_boot_order" {
|
||||
type = string
|
||||
description = "The boot order for virtual machines devices. ('disk,cdrom')"
|
||||
description = "The boot order for virtual machines devices. (e.g. 'disk,cdrom')"
|
||||
default = "disk,cdrom"
|
||||
}
|
||||
|
||||
|
@ -316,7 +321,7 @@ variable "common_shutdown_timeout" {
|
|||
|
||||
variable "build_username" {
|
||||
type = string
|
||||
description = "The username to login to the guest operating system. ('admin')"
|
||||
description = "The username to login to the guest operating system. (e.g. 'rainpole')"
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
|
|
|
@ -63,33 +63,17 @@ EOF
|
|||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo ">> Waiting up to 10 minutes for all control-plane nodes to be Ready..."
|
||||
python3 -m http.server &
|
||||
PROC_ID=$!
|
||||
attempts_max=60
|
||||
attempt=0
|
||||
until [ "$(kubectl get nodes | grep -c ' control-plane ')" -eq "${K8S_CONTROLPLANE_COUNT}" ]; do
|
||||
if [ ${attempt} -eq ${attempts_max} ]; then
|
||||
echo ">> [ERROR] Timeout waiting for control-plane nodes to join! <<"
|
||||
exit 1
|
||||
fi
|
||||
attempt=$((attempt+1))
|
||||
sleep 10
|
||||
done
|
||||
echo ">> Continuing after $((attempt*10)) seconds."
|
||||
touch .k8s-controlplane-success
|
||||
echo ">> Waiting up to 10 minutes for all worker nodes to be Ready..."
|
||||
attempts_max=60
|
||||
echo ">> Waiting up to 15 minutes for all nodes to be Ready..."
|
||||
attempts_max=90
|
||||
attempt=0
|
||||
until [ "$(kubectl get nodes | grep -c ' Ready ')" == "${K8S_NODE_COUNT}" ]; do
|
||||
if [ ${attempt} -eq ${attempts_max} ]; then
|
||||
echo ">> [ERROR] Timeout waiting for worker nodes to join! <<"
|
||||
echo ">> [ERROR] Timeout waiting for cluster online! <<"
|
||||
exit 1
|
||||
fi
|
||||
attempt=$((attempt+1))
|
||||
sleep 10
|
||||
done
|
||||
kill $PROC_ID
|
||||
echo ">> Continuing after $((attempt*10)) seconds."
|
||||
echo ">> Configuring vSphere Cloud Provider Interface..."
|
||||
cat << EOF | kubectl apply -f -
|
||||
|
@ -387,7 +371,7 @@ else
|
|||
attempts_max=6
|
||||
attempt=0
|
||||
until [ -f /etc/kubernetes/discovery.yaml ]; do
|
||||
wget "http://${K8S_CONTROLPLANE_VIP}:8000/discovery.yaml" 2>/dev/null
|
||||
scp -o StrictHostKeyChecking=no "${K8S_CONTROLPLANE_VIP}":discovery.yaml . 2>/dev/null
|
||||
sudo install -o root -g root -m 600 discovery.yaml /etc/kubernetes/discovery.yaml 2>/dev/null
|
||||
if [ ! -f /etc/kubernetes/discovery.yaml ]; then
|
||||
attempt=$((attempt+1))
|
||||
|
|
|
@ -17,7 +17,7 @@ echo ">> Continuing after $((attempt*10)) seconds."
|
|||
echo ">> Waiting up to 10 minutes for all control-plane nodes..."
|
||||
attempts_max=60
|
||||
attempt=0
|
||||
until "$(wget http://${K8S_CONTROLPLANE_VIP}:8000/.k8s-controlplane-success)" 2>/dev/null; do
|
||||
until [ "$(ssh -o StrictHostKeyChecking=no "${K8S_CONTROLPLANE_VIP}" kubectl get nodes | grep -c " control-plane ")" -eq "${K8S_CONTROLPLANE_COUNT}" ]; do
|
||||
if [ ${attempt} -eq ${attempts_max} ]; then
|
||||
echo ">> [ERROR] Timeout waiting for control-plane nodes! <<"
|
||||
exit 1
|
||||
|
@ -30,7 +30,7 @@ echo ">> Joining cluster..."
|
|||
attempts_max=6
|
||||
attempt=0
|
||||
until [ -f /etc/kubernetes/discovery.yaml ]; do
|
||||
wget "http://${K8S_CONTROLPLANE_VIP}:8000/discovery.yaml" 2>/dev/null
|
||||
scp -o StrictHostKeyChecking=no "${K8S_CONTROLPLANE_VIP}":discovery.yaml . 2>/dev/null
|
||||
sudo install -o root -g root -m 600 discovery.yaml /etc/kubernetes/discovery.yaml 2>/dev/null
|
||||
if [ ! -f /etc/kubernetes/discovery.yaml ]; then
|
||||
attempt=$((attempt+1))
|
||||
|
|
Loading…
Reference in a new issue