47 lines
1.4 KiB
Makefile
47 lines
1.4 KiB
Makefile
set fallback := true
|
|
|
|
export K8S_CONTEXT := env("K8S_CONTEXT", "")
|
|
export SERVER_IP := env("K3S_SERVER_IP","192.168.178.45")
|
|
export USER := env("K3S_USER","basti")
|
|
|
|
|
|
[private]
|
|
default:
|
|
@just --list --unsorted --list-submodules
|
|
|
|
|
|
install:
|
|
#!/bin/bash
|
|
set -euo pipefail
|
|
just env::check
|
|
|
|
METALLB_VERSION="v0.15.3"
|
|
|
|
username=$(gum input --prompt="SSH username: " --value="${USER}" --width=100)
|
|
context=""
|
|
if gum confirm "Update KUBECONFIG?"; then
|
|
context=$(
|
|
gum input --prompt="Context name: " --value="${K8S_CONTEXT}" --width=100
|
|
)
|
|
fi
|
|
|
|
if [ -n "${context}" ]; then
|
|
kubectl config use-context "${context}"
|
|
fi
|
|
|
|
kubectl apply -f "https://raw.githubusercontent.com/metallb/metallb/${METALLB_VERSION}/config/manifests/metallb-native.yaml"
|
|
gum spin --spinner dot --title "Waiting for MetalLB to be ready..." -- kubectl wait --namespace metallb-system --for=condition=available deployment --all --timeout=120s
|
|
echo "MetalLB ${METALLB_VERSION} installed successfully."
|
|
|
|
gomplate -f address-pool.gomplate.yaml | kubectl apply -f -
|
|
echo "Address pool configured."
|
|
|
|
kubectl apply -f advertisement.yaml
|
|
echo "Advertisement created."
|
|
|
|
uninstall:
|
|
#!/bin/bash
|
|
set -euo pipefail
|
|
just env::check
|
|
|
|
kubectl get namespace metallb-system &>/dev/null && kubectl delete ns metallb-system
|