mirror of
https://github.com/lordmathis/dev-cluster.git
synced 2025-12-22 16:44:24 +00:00
Refactor MetalLB config job to create temporary YAML files for IPAddressPool and L2Advertisement
This commit is contained in:
@@ -37,7 +37,10 @@ spec:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOF | kubectl apply -f -
|
# Create a temporary file for the IPAddressPool
|
||||||
|
echo "Creating IPAddressPool with IP: $SERVER_IP/32"
|
||||||
|
|
||||||
|
cat > /tmp/ippool.yaml << EOF
|
||||||
apiVersion: metallb.io/v1beta1
|
apiVersion: metallb.io/v1beta1
|
||||||
kind: IPAddressPool
|
kind: IPAddressPool
|
||||||
metadata:
|
metadata:
|
||||||
@@ -45,10 +48,13 @@ spec:
|
|||||||
namespace: metallb-system
|
namespace: metallb-system
|
||||||
spec:
|
spec:
|
||||||
addresses:
|
addresses:
|
||||||
- ${SERVER_IP}/32
|
- "$SERVER_IP/32"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat <<EOF | kubectl apply -f -
|
kubectl apply -f /tmp/ippool.yaml
|
||||||
|
|
||||||
|
# Create the L2Advertisement
|
||||||
|
cat > /tmp/l2advert.yaml << EOF
|
||||||
apiVersion: metallb.io/v1beta1
|
apiVersion: metallb.io/v1beta1
|
||||||
kind: L2Advertisement
|
kind: L2Advertisement
|
||||||
metadata:
|
metadata:
|
||||||
@@ -59,6 +65,8 @@ spec:
|
|||||||
- first-pool
|
- first-pool
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
kubectl apply -f /tmp/l2advert.yaml
|
||||||
|
|
||||||
echo "MetalLB configured to use IP: $SERVER_IP"
|
echo "MetalLB configured to use IP: $SERVER_IP"
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user