43 lines
968 B
Bash
Executable File
43 lines
968 B
Bash
Executable File
#!/bin/bash
|
|
|
|
source .env
|
|
|
|
export PROXMOX_VE_USERNAME=${PROXMOX_VE_USERNAME}
|
|
export PROXMOX_VE_PASSWORD=${PROXMOX_VE_PASSWORD}
|
|
|
|
confirm() {
|
|
local message="$1"
|
|
read -p "$message (y/n): " response
|
|
[[ "$response" == "y" ]]
|
|
}
|
|
|
|
tfplan=$(terraform plan -out=tfplan)
|
|
|
|
echo "$tfplan"
|
|
if confirm "Apply?"; then
|
|
terraform apply tfplan
|
|
fi
|
|
|
|
if confirm "Save kubeconfig?"; then
|
|
terraform output -raw kubeconfig > ~/.kube/${TALOS_CLUSTER_NAME}.yaml
|
|
fi
|
|
|
|
if confirm "Install Cilium?"; then
|
|
helm repo add cilium https://helm.cilium.io/
|
|
helm repo update
|
|
helm upgrade \
|
|
--kubeconfig ~/.kube/${TALOS_CLUSTER_NAME}.yaml \
|
|
--install \
|
|
cilium \
|
|
cilium/cilium \
|
|
--namespace kube-system \
|
|
--values cilium/values.yaml \
|
|
--set cluster.name=${TALOS_CLUSTER_NAME} \
|
|
--set cluster.id=1
|
|
fi
|
|
|
|
if confirm "Apply Cilium IP Pool and L2 Announcement Policy?"; then
|
|
kubectl apply -f cilium/ippool.yaml
|
|
kubectl apply -f cilium/l2-announcement-policy.yaml
|
|
fi
|