docs/demo/show-egress-ips.sh probes each healthy proxy from the discovery API against an IP-echo site; create-kubernetes-proxies.sh and create-gcp-proxies.sh bulk-create demo Proxies, the gcp one spreading them across randomly picked EU zones. Co-Authored-By: Claude <noreply@anthropic.com>
49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Demo: create N Managed proxies backed by the kubernetes-pod provider,
|
|
# named proxy-kubernetes-demo-1 .. proxy-kubernetes-demo-N. Pods share the
|
|
# cluster's egress IP — this exercises the full lifecycle, not distinct
|
|
# egress paths (use create-gcp-proxies.sh for that).
|
|
#
|
|
# Usage:
|
|
# ./create-kubernetes-proxies.sh <count>
|
|
#
|
|
# Optional environment:
|
|
# NAMESPACE namespace to create the proxies in (default: current context)
|
|
set -euo pipefail
|
|
|
|
if [ $# -ne 1 ] || ! [[ "$1" =~ ^[1-9][0-9]*$ ]]; then
|
|
echo "usage: $(basename "$0") <count> (positive integer)" >&2
|
|
exit 1
|
|
fi
|
|
count="$1"
|
|
|
|
if ! command -v kubectl &> /dev/null; then
|
|
echo "ERROR: kubectl is required but not installed" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ns_args=()
|
|
if [ -n "${NAMESPACE:-}" ]; then
|
|
ns_args=(-n "${NAMESPACE}")
|
|
fi
|
|
|
|
for i in $(seq 1 "${count}"); do
|
|
echo "Creating proxy-kubernetes-demo-${i} ..."
|
|
kubectl apply "${ns_args[@]}" -f - << EOF
|
|
apiVersion: crawl.example.com/v1alpha1
|
|
kind: Proxy
|
|
metadata:
|
|
name: proxy-kubernetes-demo-${i}
|
|
spec:
|
|
mode: Managed
|
|
provider: kubernetes
|
|
attributes:
|
|
geo: local
|
|
purpose: crawl
|
|
EOF
|
|
done
|
|
|
|
echo ""
|
|
echo "Created ${count} proxies. Watch them come up with:"
|
|
echo " kubectl get px ${ns_args[*]:-} -w"
|