|
#!/usr/bin/env bash |
|
# |
|
|
|
BACKEND="${1:-envoygw}" |
|
EXTRA_CONFIG="${EXTRA_CONFIG:-}" |
|
CLUSTER_NAME="${CLUSTER_NAME:-kind}" |
|
INSTALL_KUADRANT="${INSTALL_KUADRANT:-false}" |
|
|
|
create_kind() { |
|
kind create cluster --name=${CLUSTER_NAME} ${EXTRA_CONFIG} |
|
} |
|
|
|
deploy_crds() { |
|
kubectl get crd gateways.gateway.networking.k8s.io &> /dev/null || \ |
|
kubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.4.0/experimental-install.yaml |
|
} |
|
|
|
deploy_metallb() { |
|
# kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.15.2/config/manifests/metallb-native.yaml |
|
kubectl apply -f ./metallb-native.yaml |
|
kubectl wait --timeout=5m deploy -n metallb-system controller --for=condition=Available |
|
kubectl apply -f - <<EOF |
|
apiVersion: metallb.io/v1beta1 |
|
kind: IPAddressPool |
|
metadata: |
|
namespace: metallb-system |
|
name: kube-services |
|
spec: |
|
addresses: |
|
- 172.18.200.100-172.18.200.150 |
|
--- |
|
apiVersion: metallb.io/v1beta1 |
|
kind: L2Advertisement |
|
metadata: |
|
name: kube-services |
|
namespace: metallb-system |
|
spec: |
|
ipAddressPools: |
|
- kube-services |
|
EOF |
|
} |
|
|
|
|
|
case $BACKEND in |
|
# NONE deploys no backend, just a bare cluster with metallb and CRDs |
|
"none") |
|
create_kind |
|
deploy_crds |
|
deploy_metallb |
|
;; |
|
"cilium") |
|
EXTRA_CONFIG="--config=kind-cilium.yaml" |
|
create_kind |
|
deploy_crds |
|
helm install cilium --namespace kube-system --version 1.18.2 \ |
|
--set image.pullPolicy=IfNotPresent --set ipam.mode=kubernetes \ |
|
--set gatewayAPI.enabled=true --set nodePort.enabled=true \ |
|
cilium --repo https://helm.cilium.io |
|
kubectl wait --timeout=5m -n kube-system deployment/cilium-operator --for=condition=Available |
|
kubectl wait --timeout=5m -n kube-system deployment/coredns --for=condition=Available |
|
deploy_metallb |
|
;; |
|
"envoygw") |
|
create_kind |
|
deploy_metallb |
|
kubectl apply --server-side -f https://github.com/envoyproxy/gateway/releases/download/v1.5.0/install.yaml |
|
kubectl wait --timeout=5m -n envoy-gateway-system deployment/envoy-gateway --for=condition=Available |
|
kubectl apply -f https://github.com/envoyproxy/gateway/releases/download/v1.5.0/quickstart.yaml -n default |
|
;; |
|
"istio") |
|
create_kind |
|
deploy_metallb |
|
deploy_crds |
|
TAG=$(curl https://storage.googleapis.com/istio-build/dev/latest) |
|
wget -c https://storage.googleapis.com/istio-build/dev/$TAG/istioctl-$TAG-linux-amd64.tar.gz |
|
tar -xvf istioctl-$TAG-linux-amd64.tar.gz |
|
./istioctl install --set values.pilot.env.PILOT_ENABLE_ALPHA_GATEWAY_API=true --set values.pilot.env.ENABLE_GATEWAY_API_INFERENCE_EXTENSION=true --set profile=minimal --skip-confirmation |
|
;; |
|
"kgateway") |
|
create_kind |
|
deploy_metallb |
|
deploy_crds |
|
helm upgrade -i --create-namespace --namespace kgateway-system --version v2.1.0-rc.1 \ |
|
kgateway-crds oci://cr.kgateway.dev/kgateway-dev/charts/kgateway-crds \ |
|
--set controller.image.pullPolicy=Always |
|
helm upgrade -i --namespace kgateway-system --version v2.1.0-rc.1 \ |
|
kgateway oci://cr.kgateway.dev/kgateway-dev/charts/kgateway \ |
|
--set controller.image.pullPolicy=Always |
|
;; |
|
*) |
|
echo "Invalid backend" |
|
exit 1 |
|
;; |
|
esac |
|
|
|
if [ "${INSTALL_KUADRANT}" = "true" ]; then |
|
helm install kuadrant-operator kuadrant-operator --create-namespace --namespace kuadrant-system --repo https://kuadrant.io/helm-charts/ |
|
fi |