Full cloud setup test run #1 fixes.

This commit is contained in:
2025-09-02 02:53:52 -07:00
parent 61460b63a3
commit af60d0c744
15 changed files with 242 additions and 424 deletions

View File

@@ -84,7 +84,7 @@ prompt_with_default() {
if [ -n "${default}" ]; then
printf "%s [default: %s]: " "${prompt}" "${default}" >&2
else
printf "%s [default: empty]: " "${prompt}" >&2
printf "%s: " "${prompt}" >&2
fi
read -r result
if [ -z "${result}" ]; then
@@ -109,16 +109,18 @@ prompt_if_unset_config() {
local prompt="$2"
local default="$3"
local current_value
current_value=$(wild-config "${config_path}")
if [ -z "${current_value}" ] || [ "${current_value}" = "null" ]; then
# Check if key exists first to avoid error messages
if wild-config --check "${config_path}"; then
# Key exists, get its value
local current_value
current_value=$(wild-config "${config_path}")
print_info "Using existing ${config_path} = ${current_value}"
else
# Key doesn't exist, prompt for it
local new_value
new_value=$(prompt_with_default "${prompt}" "${default}" "")
wild-config-set "${config_path}" "${new_value}"
print_info "Set ${config_path} = ${new_value}"
else
print_info "Using existing ${config_path} = ${current_value}"
fi
}
@@ -128,16 +130,16 @@ prompt_if_unset_secret() {
local prompt="$2"
local default="$3"
local current_value
current_value=$(wild-secret "${secret_path}")
if [ -z "${current_value}" ] || [ "${current_value}" = "null" ]; then
# Check if key exists first to avoid error messages
if wild-secret --check "${secret_path}"; then
# Key exists, we don't show the value for security
print_info "Using existing secret ${secret_path}"
else
# Key doesn't exist, prompt for it
local new_value
new_value=$(prompt_with_default "${prompt}" "${default}" "")
wild-secret-set "${secret_path}" "${new_value}"
print_info "Set secret ${secret_path}"
else
print_info "Using existing secret ${secret_path}"
fi
}
@@ -168,7 +170,7 @@ init_wild_env() {
if [ -z "${WC_ROOT}" ]; then
echo "ERROR: WC_ROOT is not set."
exit 1
else
fi
# Check if WC_ROOT is a valid directory
if [ ! -d "${WC_ROOT}" ]; then
@@ -187,6 +189,33 @@ init_wild_env() {
echo "ERROR: This command must be run from within a wildcloud home directory."
exit 1
fi
# Check kubectl
if ! command -v kubectl &> /dev/null; then
echo "Error: kubectl is not installed. Please run $WC_ROOT/scripts/install-wild-cloud-dependencies.sh."
fi
# Check talosctl
if ! command -v talosctl &> /dev/null; then
echo "Error: talosctl is not installed. Please run $WC_ROOT/scripts/install-wild-cloud-dependencies.sh."
fi
# Check gomplate
if ! command -v gomplate &> /dev/null; then
echo "Error: gomplate is not installed. Please run $WC_ROOT/scripts/install-wild-cloud-dependencies.sh."
exit 1
fi
# Check yq
if ! command -v yq &> /dev/null; then
echo "Error: yq is not installed. Please run $WC_ROOT/scripts/install-wild-cloud-dependencies.sh."
exit 1
fi
# Check restic
if ! command -v restic &> /dev/null; then
echo "Error: restic is not installed. Please run $WC_ROOT/scripts/install-wild-cloud-dependencies.sh."
exit 1
fi
}

View File

@@ -1,5 +1,14 @@
#!/bin/bash
# Install kubectl
if ! command -v kubectl &> /dev/null; then
echo "Error: kubectl is not installed. Installing."
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
fi
# Install gomplate
if command -v gomplate &> /dev/null; then
echo "gomplate is already installed."