Updates service installs to not copy kustomize templates.

This commit is contained in:
2025-06-29 13:30:28 -07:00
parent ddac8775b1
commit 5579e1e3c0
19 changed files with 214 additions and 102 deletions

View File

@@ -1,6 +1,5 @@
.wildcloud
secrets.yaml
.wildcloud/cache
.bots/*/sessions
backup/
.working
.claude

View File

@@ -9,25 +9,52 @@ export PATH="$WC_HOME/bin:$PATH"
# Install kubectl
if ! command -v kubectl &> /dev/null; then
echo "Error: kubectl is not installed. Installing."
echo "Installing kubectl"
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
rm kubectl kubectl.sha256
echo "kubectl installed successfully."
fi
# Install talosctl
if ! command -v talosctl &> /dev/null; then
echo "Error: talosctl is not installed. Installing."
echo "Installing talosctl"
curl -sL https://talos.dev/install | sh
if [ $? -ne 0 ]; then
echo "Error installing talosctl. Please check the installation script."
exit 1
fi
echo "talosctl installed successfully."
fi
# Check if gomplate is installed
if ! command -v gomplate &> /dev/null; then
echo "Error: gomplate is not installed. Please install gomplate first."
echo "Visit: https://docs.gomplate.ca/installing/"
exit 1
echo "Installing gomplate"
curl -sSL https://github.com/hairyhenderson/gomplate/releases/latest/download/gomplate_linux-amd64 -o $HOME/.local/bin/gomplate
chmod +x $HOME/.local/bin/gomplate
echo "gomplate installed successfully."
fi
# Install kustomize
if ! command -v kustomize &> /dev/null; then
echo "Installing kustomize"
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
mv kustomize $HOME/.local/bin/
echo "kustomize installed successfully."
fi
## Install yq
if ! command -v yq &> /dev/null; then
echo "Installing yq"
VERSION=v4.45.4
BINARY=yq_linux_amd64
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - | tar xz
mv ${BINARY} $HOME/.local/bin/yq
chmod +x $HOME/.local/bin/yq
rm yq.1
echo "yq installed successfully."
fi
KUBECONFIG=~/.kube/config
@@ -37,13 +64,15 @@ export KUBECONFIG
CLUSTER_NAME=$(wild-config cluster.name)
if [ -z "${CLUSTER_NAME}" ] || [ "${CLUSTER_NAME}" = "null" ]; then
echo "Error: cluster.name not set in config.yaml"
exit 1
fi
# Only try to use the kubectl context if it exists
if kubectl config get-contexts "${CLUSTER_NAME}" >/dev/null 2>&1; then
kubectl config use-context "${CLUSTER_NAME}"
echo "Using Kubernetes context: ${CLUSTER_NAME}"
# else
# echo "Kubernetes context '${CLUSTER_NAME}' not found, skipping context switch"
else
KUBE_CONTEXT="admin@${CLUSTER_NAME}"
CURRENT_KUBE_CONTEXT=$(kubectl config current-context)
if [ "${CURRENT_KUBE_CONTEXT}" != "${KUBE_CONTEXT}" ]; then
if kubectl config get-contexts | grep -q "${KUBE_CONTEXT}"; then
echo "Switching to kubernetes context ${KUBE_CONTEXT}"
else
echo "WARNING: Context ${KUBE_CONTEXT} does not exist."
# kubectl config set-context "${KUBE_CONTEXT}" --cluster="${CLUSTER_NAME}" --user=admin
fi
fi
fi