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
until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null
do
echo "Waiting for ssh to be ready..."
echo "Waiting for MicroOS to reboot and become available..."
sleep 2
done
EOT
@ -97,7 +97,6 @@ resource "hcloud_server" "agents" {
# Run the agent
provisioner "remote-exec" {
inline = [
"set -ex",
# set the hostname in a persistent fashion
"hostnamectl set-hostname ${self.name}",
# 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
"systemctl enable k3s-server",
<<-EOT
until systemctl status k3s-server > /dev/null
until systemctl status k3s-agent > /dev/null
do
systemctl start k3s-server
systemctl start k3s-agent
echo "Starting k3s-agent and joining the cluster..."
sleep 2
done

View File

@ -51,7 +51,7 @@ resource "hcloud_server" "first_control_plane" {
command = <<-EOT
until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null
do
echo "Waiting for ssh to be ready..."
echo "Waiting for MicroOS to reboot and become available..."
sleep 2
done
EOT
@ -80,10 +80,10 @@ resource "hcloud_server" "first_control_plane" {
host = self.ipv4_address
}
}
# Run the first control plane
provisioner "remote-exec" {
inline = [
"set -ex",
# set the hostname in a persistent fashion
"hostnamectl set-hostname ${self.name}",
# 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
provisioner "local-exec" {
command = <<-EOT
set -ex
until ssh -q ${local.ssh_args} root@${self.ipv4_address} [[ -f /etc/rancher/k3s/k3s.yaml ]]
do
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
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 {

View File

@ -52,7 +52,7 @@ resource "hcloud_server" "control_planes" {
command = <<-EOT
until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null
do
echo "Waiting for ssh to be ready..."
echo "Waiting for MicroOS to reboot and become available..."
sleep 2
done
EOT
@ -87,7 +87,6 @@ resource "hcloud_server" "control_planes" {
# Run an other control plane server
provisioner "remote-exec" {
inline = [
"set -ex",
# set the hostname in a persistent fashion
"hostnamectl set-hostname ${self.name}",
# 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
do
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
done
EOT