Updates service installs to not copy kustomize templates.
This commit is contained in:
@@ -9,9 +9,12 @@ fi
|
||||
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
|
||||
CERT_MANAGER_DIR="${CLUSTER_SETUP_DIR}/cert-manager"
|
||||
|
||||
# Process templates with wild-compile-template-dir
|
||||
echo "Processing cert-manager templates..."
|
||||
wild-compile-template-dir --clean ${CERT_MANAGER_DIR}/kustomize.template ${CERT_MANAGER_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled cert-manager templates..."
|
||||
if [ ! -d "${CERT_MANAGER_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Setting up cert-manager..."
|
||||
|
||||
|
@@ -11,18 +11,17 @@ COREDNS_DIR="${CLUSTER_SETUP_DIR}/coredns"
|
||||
|
||||
echo "Setting up CoreDNS for k3s..."
|
||||
|
||||
# Process templates with wild-compile-template-dir
|
||||
echo "Processing CoreDNS templates..."
|
||||
wild-compile-template-dir --clean ${COREDNS_DIR}/kustomize.template ${COREDNS_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled CoreDNS templates..."
|
||||
if [ ! -d "${COREDNS_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apply the k3s-compatible custom DNS override (k3s will preserve this)
|
||||
echo "Applying CoreDNS custom override configuration..."
|
||||
kubectl apply -f "${COREDNS_DIR}/kustomize/coredns-custom-config.yaml"
|
||||
|
||||
# Apply the LoadBalancer service for external access to CoreDNS
|
||||
echo "Applying CoreDNS service configuration..."
|
||||
kubectl apply -f "${COREDNS_DIR}/kustomize/coredns-lb-service.yaml"
|
||||
|
||||
# Restart CoreDNS pods to apply the changes
|
||||
echo "Restarting CoreDNS pods to apply changes..."
|
||||
kubectl rollout restart deployment/coredns -n kube-system
|
||||
|
@@ -14,7 +14,7 @@ data:
|
||||
reload
|
||||
template IN A {
|
||||
match (.*)\.{{ .cloud.internalDomain | strings.ReplaceAll "." "\\." }}\.
|
||||
answer "{{`{{"{{ .Name }}"}}`}} 60 IN A {{ .cluster.loadBalancerIp }}"
|
||||
answer "{{`{{ .Name }}`}} 60 IN A {{ .cluster.loadBalancerIp }}"
|
||||
}
|
||||
template IN AAAA {
|
||||
match (.*)\.{{ .cloud.internalDomain | strings.ReplaceAll "." "\\." }}\.
|
||||
|
@@ -1,23 +0,0 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: coredns-lb
|
||||
namespace: kube-system
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- name: dns
|
||||
port: 53
|
||||
protocol: UDP
|
||||
targetPort: 53
|
||||
- name: dns-tcp
|
||||
port: 53
|
||||
protocol: TCP
|
||||
targetPort: 53
|
||||
- name: metrics
|
||||
port: 9153
|
||||
protocol: TCP
|
||||
targetPort: 9153
|
||||
selector:
|
||||
k8s-app: kube-dns
|
@@ -11,9 +11,12 @@ DOCKER_REGISTRY_DIR="${CLUSTER_SETUP_DIR}/docker-registry"
|
||||
|
||||
echo "Setting up Docker Registry..."
|
||||
|
||||
# Process templates with wild-compile-template-dir
|
||||
echo "Processing Docker Registry templates..."
|
||||
wild-compile-template-dir --clean ${DOCKER_REGISTRY_DIR}/kustomize.template ${DOCKER_REGISTRY_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled Docker Registry templates..."
|
||||
if [ ! -d "${DOCKER_REGISTRY_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apply the docker registry manifests using kustomize
|
||||
kubectl apply -k "${DOCKER_REGISTRY_DIR}/kustomize"
|
||||
|
@@ -9,9 +9,12 @@ fi
|
||||
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
|
||||
EXTERNALDNS_DIR="${CLUSTER_SETUP_DIR}/externaldns"
|
||||
|
||||
# Process templates with wild-compile-template-dir
|
||||
echo "Processing ExternalDNS templates..."
|
||||
wild-compile-template-dir --clean ${EXTERNALDNS_DIR}/kustomize.template ${EXTERNALDNS_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled ExternalDNS templates..."
|
||||
if [ ! -d "${EXTERNALDNS_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Setting up ExternalDNS..."
|
||||
|
||||
|
@@ -11,9 +11,12 @@ KUBERNETES_DASHBOARD_DIR="${CLUSTER_SETUP_DIR}/kubernetes-dashboard"
|
||||
|
||||
echo "Setting up Kubernetes Dashboard..."
|
||||
|
||||
# Process templates with wild-compile-template-dir
|
||||
echo "Processing Dashboard templates..."
|
||||
wild-compile-template-dir --clean ${KUBERNETES_DASHBOARD_DIR}/kustomize.template ${KUBERNETES_DASHBOARD_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled Dashboard templates..."
|
||||
if [ ! -d "${KUBERNETES_DASHBOARD_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NAMESPACE="kubernetes-dashboard"
|
||||
|
||||
|
@@ -11,9 +11,12 @@ LONGHORN_DIR="${CLUSTER_SETUP_DIR}/longhorn"
|
||||
|
||||
echo "Setting up Longhorn..."
|
||||
|
||||
# Process templates with wild-compile-template-dir
|
||||
echo "Processing Longhorn templates..."
|
||||
wild-compile-template-dir --clean ${LONGHORN_DIR}/kustomize.template ${LONGHORN_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled Longhorn templates..."
|
||||
if [ ! -d "${LONGHORN_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apply Longhorn with kustomize to apply our customizations
|
||||
kubectl apply -k ${LONGHORN_DIR}/kustomize/
|
||||
|
@@ -11,9 +11,12 @@ METALLB_DIR="${CLUSTER_SETUP_DIR}/metallb"
|
||||
|
||||
echo "Setting up MetalLB..."
|
||||
|
||||
# Process templates with gomplate
|
||||
echo "Processing MetalLB templates..."
|
||||
wild-compile-template-dir --clean ${METALLB_DIR}/kustomize.template ${METALLB_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled MetalLB templates..."
|
||||
if [ ! -d "${METALLB_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Deploying MetalLB..."
|
||||
kubectl apply -k ${METALLB_DIR}/kustomize/installation
|
||||
|
@@ -12,9 +12,12 @@ NFS_DIR="${CLUSTER_SETUP_DIR}/nfs"
|
||||
|
||||
echo "Registering NFS server with Kubernetes cluster..."
|
||||
|
||||
# Process templates with wild-compile-template-dir
|
||||
echo "Processing NFS templates..."
|
||||
wild-compile-template-dir --clean ${NFS_DIR}/kustomize.template ${NFS_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled NFS templates..."
|
||||
if [ ! -d "${NFS_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get NFS configuration from config.yaml
|
||||
NFS_HOST=$(wild-config cloud.nfs.host) || exit 1
|
||||
|
@@ -24,9 +24,12 @@ kubectl wait --for condition=established crd/gatewayclasses.gateway.networking.k
|
||||
kubectl wait --for condition=established crd/ingressroutes.traefik.io --timeout=60s
|
||||
kubectl wait --for condition=established crd/middlewares.traefik.io --timeout=60s
|
||||
|
||||
# Process templates with wild-compile-template-dir
|
||||
echo "Processing Traefik templates..."
|
||||
wild-compile-template-dir --clean ${TRAEFIK_DIR}/kustomize.template ${TRAEFIK_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled Traefik templates..."
|
||||
if [ ! -d "${TRAEFIK_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apply Traefik using kustomize
|
||||
echo "Deploying Traefik..."
|
||||
|
@@ -14,7 +14,7 @@ metadata:
|
||||
app.kubernetes.io/name: traefik
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
loadBalancerIP: { { .cluster.loadBalancerIP } }
|
||||
loadBalancerIP: {{ .cluster.loadBalancerIp }}
|
||||
selector:
|
||||
app.kubernetes.io/instance: traefik-kube-system
|
||||
app.kubernetes.io/name: traefik
|
||||
|
@@ -11,9 +11,12 @@ UTILS_DIR="${CLUSTER_SETUP_DIR}/utils"
|
||||
|
||||
echo "Setting up cluster utilities..."
|
||||
|
||||
# Process templates with wild-compile-template-dir
|
||||
echo "Processing utils templates..."
|
||||
wild-compile-template-dir --clean ${UTILS_DIR}/kustomize.template ${UTILS_DIR}/kustomize
|
||||
# Templates should already be compiled by wild-cluster-services-generate
|
||||
echo "Using pre-compiled utils templates..."
|
||||
if [ ! -d "${UTILS_DIR}/kustomize" ]; then
|
||||
echo "Error: Compiled templates not found. Run 'wild-cluster-services-generate' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Applying utility manifests..."
|
||||
kubectl apply -f ${UTILS_DIR}/kustomize/
|
||||
|
3
setup/home-scaffold/.gitignore
vendored
3
setup/home-scaffold/.gitignore
vendored
@@ -1,6 +1,5 @@
|
||||
.wildcloud
|
||||
secrets.yaml
|
||||
.wildcloud/cache
|
||||
.bots/*/sessions
|
||||
backup/
|
||||
.working
|
||||
.claude
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user