feat: env INSTALL_LONGHORN
Add Ansible playbooks for Longhorn, MetalLB, and Traefik installation conditional on presence of INSTALL_LONGHORN=true
This commit is contained in:
parent
80f4e5a53b
commit
8faa97a8bb
6 changed files with 129 additions and 44 deletions
|
|
@ -12,24 +12,31 @@ if ! kubectl get deployment -n metallb-system controller &>/dev/null; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Wait for MetalLB components to be ready
|
||||
echo "Waiting for MetalLB components to be ready..."
|
||||
kubectl wait --namespace metallb-system \
|
||||
--for=condition=ready pod \
|
||||
--selector=app=metallb \
|
||||
--timeout=90s
|
||||
echo "Waiting for MetalLB pods to be in 'Running' state..."
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
|
||||
while [ $RETRY -lt $MAX_RETRIES ]; do
|
||||
NOT_READY_PODS=$(kubectl -n metallb-system get pods --no-headers | grep -v 'Running' | wc -l)
|
||||
if [ "$NOT_READY_PODS" -eq 0 ]; then
|
||||
echo "All MetalLB pods are running."
|
||||
break
|
||||
else
|
||||
echo "$NOT_READY_PODS MetalLB pods are not ready yet. Waiting..."
|
||||
RETRY=$((RETRY + 1))
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$NOT_READY_PODS" -ne 0 ]; then
|
||||
echo "Failed to get all MetalLB pods running after $MAX_RETRIES attempts."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
echo "MetalLB is already installed."
|
||||
fi
|
||||
|
||||
# Wait for the webhook service to be ready
|
||||
echo "Waiting for MetalLB webhook service to be ready..."
|
||||
kubectl wait --namespace metallb-system \
|
||||
--for=condition=ready pod \
|
||||
--selector=component=webhook \
|
||||
--timeout=90s
|
||||
|
||||
# Check if the IPAddressPool already exists
|
||||
if ! kubectl get ipaddresspool -n metallb-system default &>/dev/null; then
|
||||
echo "Creating MetalLB IPAddressPool..."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue