diff --git a/bootstrap/bootstrap.sh b/bootstrap/bootstrap.sh index e7cb1dcc..4140f6e8 100755 --- a/bootstrap/bootstrap.sh +++ b/bootstrap/bootstrap.sh @@ -1,25 +1,30 @@ #!/bin/sh -set -e +set -euo pipefail # Create ephemeral cluster kind create cluster \ --wait 60s \ - --config kind.yaml + --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ + --config ephemeral-cluster/kind.yaml # Install Sidero clusterctl init \ --bootstrap talos \ --control-plane talos \ --infrastructure sidero \ + --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ --config clusterctl.yaml kubectl wait pods \ + --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ --all \ --all-namespaces \ + --timeout 300s \ --for=condition=Ready # Apply server classes kubectl apply \ + --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ --filename serverclasses/ # Waker servers up @@ -29,12 +34,23 @@ wol '00:23:24:d1:f3:f0' # wol '00:23:24:e7:04:60' # Create cluster -export CONTROL_PLANE_ENDPOINT=$(kubectl get server -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') -clusterctl config cluster homelab \ +export CONTROL_PLANE_ENDPOINT=$(kubectl get server \ + --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ + --output jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') +clusterctl config cluster \ --infrastructure sidero \ - --config clusterctl.yaml > cluster/homelab.yaml + --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ + --config clusterctl.yaml \ + homelab > cluster/homelab.yaml kubectl apply \ + --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ --filename cluster/homelab.yaml # Get kube config -clusterctl get kubeconfig homelab > kubeconfig.yaml +clusterctl get kubeconfig \ + --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ + homelab > kubeconfig.yaml + +# Cleanup ephemeral cluster +# kind delete cluster --name bootstrap-cluster +# rm ephemeral-cluster/kind-kubeconfig.yaml diff --git a/bootstrap/kind.yaml b/bootstrap/ephemeral-cluster/kind.yaml similarity index 100% rename from bootstrap/kind.yaml rename to bootstrap/ephemeral-cluster/kind.yaml