Adds a test cloud home.

This commit is contained in:
2025-07-15 07:15:31 -07:00
parent 2401423976
commit bcf2bca715
5 changed files with 163 additions and 0 deletions

6
test/test-cloud/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
.wildcloud
secrets.yaml
.bots/*/sessions
backup/
.working
setup/cluster-nodes/generated/talosconfig

23
test/test-cloud/README.md Normal file
View File

@@ -0,0 +1,23 @@
# Your Wild Cloud
## One-time Setup
Congratulations! Everything you need for setting up and managing your wild-cloud is in this directory.
Just run:
```bash
wild-setup
```
## Using your wild-cloud
### Installing Wild Cloud apps
```bash
wild-apps-list
wild-app-fetch <app>
wild-app-config <app>
wild-app-deploy <app>
# Optional: Check in app templates.
```

View File

@@ -0,0 +1,48 @@
# My Wild Cloud Apps
This directory contains the definitions for _your_ wild-cloud apps. You can change them however you like. You should keep them all in git and make commits anytime you change something. Some `wild` commands will overwrite files in your app directory (like when you are updating apps, or updating your configuration) so you'll want to review any changes made to your files after using them using `git`.
## Usage
To list all available apps:
```bash
wild-cloud-app-list
```
### App Workflow
The Wild Cloud app workflow consists of three steps:
1. **Fetch** - Download raw app templates to cache
2. **Config** - Apply your local configuration to templates
3. **Deploy** - Deploy configured app to Kubernetes
### Commands
To fetch an app template to cache:
```bash
wild-app-fetch <app>
```
To apply your configuration to a cached app (automatically fetches if not cached):
```bash
wild-app-config <app>
```
To deploy a configured app to Kubernetes:
```bash
wild-app-deploy <app>
```
### Quick Setup
For a complete app setup and deployment:
```bash
wild-app-config <app> # Fetches if needed, then configures
wild-app-deploy <app> # Deploys to Kubernetes
```

View File

@@ -0,0 +1,8 @@
operator:
email: test@domain.tld
cloud:
baseDomain: domain.tld
domain: cloud.domain.tld
internalDomain: internal.cloud.domain.tld
cluster:
name: cloud-domain-tld

78
test/test-cloud/env.sh Normal file
View File

@@ -0,0 +1,78 @@
#!/bin/bash
# Set the WC_HOME environment variable to this script's directory.
# This variable is used consistently across the Wild Config scripts.
export WC_HOME="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
# Add bin to path first so wild-config is available
export PATH="$WC_HOME/bin:$PATH"
# Install kubectl
if ! command -v kubectl &> /dev/null; then
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 "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 "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
export KUBECONFIG
# Use cluster name as both talos and kubectl context name
CLUSTER_NAME=$(wild-config cluster.name)
if [ -z "${CLUSTER_NAME}" ] || [ "${CLUSTER_NAME}" = "null" ]; then
echo "Error: cluster.name not set in config.yaml"
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