pre master

This commit is contained in:
Karim Naufal 2022-02-10 03:31:20 +01:00
parent e7f016fc59
commit 7a846f3a61
3 changed files with 11 additions and 11 deletions

View File

@ -53,7 +53,7 @@ resource "hcloud_server" "agents" {
command = <<-EOT command = <<-EOT
until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null
do do
echo "Waiting for ssh to be ready..." echo "Waiting for MicroOS to reboot and become available..."
sleep 2 sleep 2
done done
EOT EOT
@ -97,7 +97,6 @@ resource "hcloud_server" "agents" {
# Run the agent # Run the agent
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"set -ex",
# set the hostname in a persistent fashion # set the hostname in a persistent fashion
"hostnamectl set-hostname ${self.name}", "hostnamectl set-hostname ${self.name}",
# first we disable automatic reboot (after transactional updates), and configure the reboot method as kured # first we disable automatic reboot (after transactional updates), and configure the reboot method as kured
@ -105,9 +104,9 @@ resource "hcloud_server" "agents" {
# then we start k3s agent and join the cluster # then we start k3s agent and join the cluster
"systemctl enable k3s-server", "systemctl enable k3s-server",
<<-EOT <<-EOT
until systemctl status k3s-server > /dev/null until systemctl status k3s-agent > /dev/null
do do
systemctl start k3s-server systemctl start k3s-agent
echo "Starting k3s-agent and joining the cluster..." echo "Starting k3s-agent and joining the cluster..."
sleep 2 sleep 2
done done

View File

@ -51,7 +51,7 @@ resource "hcloud_server" "first_control_plane" {
command = <<-EOT command = <<-EOT
until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null
do do
echo "Waiting for ssh to be ready..." echo "Waiting for MicroOS to reboot and become available..."
sleep 2 sleep 2
done done
EOT EOT
@ -80,10 +80,10 @@ resource "hcloud_server" "first_control_plane" {
host = self.ipv4_address host = self.ipv4_address
} }
} }
# Run the first control plane # Run the first control plane
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"set -ex",
# set the hostname in a persistent fashion # set the hostname in a persistent fashion
"hostnamectl set-hostname ${self.name}", "hostnamectl set-hostname ${self.name}",
# first we disable automatic reboot (after transactional updates), and configure the reboot method as kured # first we disable automatic reboot (after transactional updates), and configure the reboot method as kured
@ -111,7 +111,6 @@ resource "hcloud_server" "first_control_plane" {
# Get the Kubeconfig, and wait for the node to be available # Get the Kubeconfig, and wait for the node to be available
provisioner "local-exec" { provisioner "local-exec" {
command = <<-EOT command = <<-EOT
set -ex
until ssh -q ${local.ssh_args} root@${self.ipv4_address} [[ -f /etc/rancher/k3s/k3s.yaml ]] until ssh -q ${local.ssh_args} root@${self.ipv4_address} [[ -f /etc/rancher/k3s/k3s.yaml ]]
do do
echo "Waiting for the k3s config file to be ready..." echo "Waiting for the k3s config file to be ready..."
@ -148,7 +147,10 @@ resource "hcloud_server" "first_control_plane" {
# Configure the Traefik ingress controller # Configure the Traefik ingress controller
provisioner "local-exec" { provisioner "local-exec" {
command = "kubectl apply -f ${local_file.traefik_config.filename} --kubeconfig ${path.module}/kubeconfig.yaml" command = <<-EOT
set -ex
kubectl apply -f ${local_file.traefik_config.filename} --kubeconfig ${path.module}/kubeconfig.yaml
EOT
} }
network { network {

View File

@ -52,7 +52,7 @@ resource "hcloud_server" "control_planes" {
command = <<-EOT command = <<-EOT
until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null
do do
echo "Waiting for ssh to be ready..." echo "Waiting for MicroOS to reboot and become available..."
sleep 2 sleep 2
done done
EOT EOT
@ -87,7 +87,6 @@ resource "hcloud_server" "control_planes" {
# Run an other control plane server # Run an other control plane server
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"set -ex",
# set the hostname in a persistent fashion # set the hostname in a persistent fashion
"hostnamectl set-hostname ${self.name}", "hostnamectl set-hostname ${self.name}",
# first we disable automatic reboot (after transactional updates), and configure the reboot method as kured # first we disable automatic reboot (after transactional updates), and configure the reboot method as kured
@ -98,7 +97,7 @@ resource "hcloud_server" "control_planes" {
until systemctl status k3s-server > /dev/null until systemctl status k3s-server > /dev/null
do do
systemctl start k3s-server systemctl start k3s-server
echo "Waiting on other 'learning' control planes, patience is the mother of virtues..." echo "Waiting on other 'learning' control planes, patience is the mother of all virtues..."
sleep 2 sleep 2
done done
EOT EOT