Local high-scale harness (scripts/scale/) using kwok to simulate large clusters with near-zero compute: fake nodes report huge capacity and fake pods reach Running instantly. - up/down: create/delete the kwok cluster (docker runtime) - load: 20 nodes, 20 namespaces, 10,000 pods (+ rs/svc/cm/secrets), tunable via KRUST_* env vars (total = NAMESPACES * DEPLOYS_PER_NS * REPLICAS) - contexts: generate a 20-context kubeconfig (distinct default namespaces) to exercise multi-context / warm-context paths against one apiserver - churn: rolling deployment restarts at a configurable rate - gitignore the generated kubeconfig (embeds kwok cluster certs) Used to capture the stable-release performance baselines. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
1.3 KiB
Bash
Executable File
31 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Generate a self-contained kubeconfig with KRUST_SCALE_CONTEXTS contexts, all pointing
|
|
# at the kwok apiserver but with distinct default namespaces. This exercises krust's
|
|
# multi-context tab handling, per-context client init, and warm-context retention without
|
|
# needing many real clusters.
|
|
#
|
|
# Point krust at it: cargo run -- --kubeconfig scripts/scale/kubeconfig-scale.yaml
|
|
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
|
|
|
require kubectl
|
|
require yq
|
|
|
|
base="$KRUST_SCALE_KUBECONFIG"
|
|
kubectl config view --raw --minify --context "$KRUST_SCALE_CONTEXT" > "$base"
|
|
|
|
cluster="$(yq '.clusters[0].name' "$base")"
|
|
user="$(yq '.users[0].name' "$base")"
|
|
[ -n "$cluster" ] && [ -n "$user" ] || { echo "could not read cluster/user from kwok config" >&2; exit 1; }
|
|
|
|
yq -i '.contexts = [] | .current-context = ""' "$base"
|
|
for ((i=0; i<KRUST_SCALE_CONTEXTS; i++)); do
|
|
ns="$(ns_name "$(( i % KRUST_NAMESPACES ))")"
|
|
name="$(printf 'scale-%02d' "$i")"
|
|
cl="$cluster" us="$user" nm="$name" ns="$ns" \
|
|
yq -i '.contexts += [{"name": strenv(nm), "context": {"cluster": strenv(cl), "user": strenv(us), "namespace": strenv(ns)}}]' "$base"
|
|
done
|
|
yq -i '.current-context = "scale-00"' "$base"
|
|
|
|
echo "wrote $base with $(yq '.contexts | length' "$base") contexts (cluster=$cluster)"
|
|
echo "run: cargo run -- --kubeconfig $base"
|