Skip to content

Commit

Permalink
Allow setting metallb CIDR value for local env
Browse files Browse the repository at this point in the history
The default CIDR value (/28) allows for 16 ips to be assigned which is
fine for the majority of dev/test/demo needs. However, when trying to
test at scale it is useful to be able to create more Gateways on a
single cluster and therefore more IPs can be required.

Changes here allow the CIDR and number of IP values used by the local
setup script to be set as required, default is the same as before (/28 &
16 IPs).

```
make local-setup SUBNET_OFFSET=0 CIDR=26 NUM_IPS=64
```

Signed-off-by: Michael Nairn <[email protected]>
  • Loading branch information
mikenairn committed Jan 13, 2025
1 parent 4092c44 commit d0cd27d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions make/development-environments.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
$(KUSTOMIZE) build config/crd | kubectl delete -f -

.PHONY: install-metallb
install-metallb: SUBNET_OFFSET=1
install-metallb: SUBNET_OFFSET=0
install-metallb: CIDR=28
install-metallb: NUM_IPS=16
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) ${SUBNET_OFFSET} | kubectl apply -n metallb-system -f -
./utils/docker-network-ipaddresspool.sh kind $(YQ) ${SUBNET_OFFSET} ${CIDR} ${NUM_IPS} | kubectl apply -n metallb-system -f -

.PHONY: uninstall-metallb
uninstall-metallb: $(KUSTOMIZE)
Expand Down
4 changes: 2 additions & 2 deletions utils/docker-network-ipaddresspool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ set -euo pipefail
networkName=$1
YQ="${2:-yq}"
offset=${3:-0}
cidr=28
numIPs=16
cidr=${4:-28}
numIPs=${5:-16}

## Parse kind network subnet
## Take only IPv4 subnets, exclude IPv6
Expand Down

0 comments on commit d0cd27d

Please sign in to comment.