From bb665683a8198195fb4cb07e64de6b4659d4aef5 Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Mon, 29 Apr 2024 16:14:13 +0100 Subject: [PATCH] Increase metallb useable ips (#584) The number of IPs available to metallb is currently really small (4) which means you can only create a small number of gateways (3, istio takes one) before it stops dishing out new IPs. These changes increase the number of ips to 16 and assumes the network will always give us a range allowing the use of all 256 ips, 0.0.0.[0-255] (This appears to be the case for kind networks created with podman(10.89.0.0/24) and docker(172.18.0.0/16)). Also adds an option to specify an offest (default is 0) when creating a kuadrant cluster with local-setup allowing multiple instances to be created using a different range of IPs. ``` make local-setup KIND_CLUSTER_NAME=kuadrant-local-1 SUBNET_OFFSET=0 make local-setup KIND_CLUSTER_NAME=kuadrant-local-2 SUBNET_OFFSET=1 ``` --- Makefile | 3 ++- utils/docker-network-ipaddresspool.sh | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 97ee65c55..257ac4628 100644 --- a/Makefile +++ b/Makefile @@ -424,11 +424,12 @@ deploy-dependencies: kustomize dependencies-manifests ## Deploy dependencies to kubectl -n "$(KUADRANT_NAMESPACE)" wait --timeout=300s --for=condition=Available deployments --all .PHONY: install-metallb +install-metallb: SUBNET_OFFSET=0 install-metallb: kustomize yq ## Installs the metallb load balancer allowing use of an LoadBalancer type with a gateway $(KUSTOMIZE) build config/metallb | kubectl apply -f - kubectl -n metallb-system wait --for=condition=Available deployments controller --timeout=300s kubectl -n metallb-system wait --for=condition=ready pod --selector=app=metallb --timeout=60s - ./utils/docker-network-ipaddresspool.sh kind $(YQ) | kubectl apply -n metallb-system -f - + ./utils/docker-network-ipaddresspool.sh kind $(YQ) ${SUBNET_OFFSET} | kubectl apply -n metallb-system -f - .PHONY: uninstall-metallb uninstall-metallb: $(KUSTOMIZE) diff --git a/utils/docker-network-ipaddresspool.sh b/utils/docker-network-ipaddresspool.sh index 364072c80..2e0b1b18f 100755 --- a/utils/docker-network-ipaddresspool.sh +++ b/utils/docker-network-ipaddresspool.sh @@ -10,6 +10,9 @@ set -euo pipefail networkName=$1 YQ="${2:-yq}" +offset=${3:-0} +cidr=28 +numIPs=16 ## Parse kind network subnet ## Take only IPv4 subnets, exclude IPv6 @@ -37,11 +40,17 @@ if [[ -z "$SUBNET" ]]; then exit 1 fi +network=$(echo $SUBNET | cut -d/ -f1) # shellcheck disable=SC2206 -subnetParts=(${SUBNET//./ }) -cidr="${subnetParts[0]}.${subnetParts[1]}.0.252/30" +octets=(${network//./ }) -cat <&2 + +cat <