Skip to content

Instantly share code, notes, and snippets.

@skonto
Created February 29, 2024 17:05
Show Gist options
  • Save skonto/188b2c45c5af449629caaa69a190392c to your computer and use it in GitHub Desktop.
Save skonto/188b2c45c5af449629caaa69a190392c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
NC=128
SC=128
SIZE=32K # in `head` format
generate_namespace_secrets() {
local ns=$1
for j in $(seq $SC)
do
encoded=$(head -c "$SIZE" /dev/urandom | base64 -w0)
cat <<EOF
---
apiVersion: v1
kind: Secret
metadata:
namespace: $ns
name: $ns-$j
data:
random.bin: $encoded
EOF
done
}
for i in $(seq $NC)
do
ns="test-random-secret$i"
oc create -f - <<EOF
apiVersion: v1
kind: Namespace
metadata:
name: $ns
EOF
generate_namespace_secrets "$ns" | oc create -f -
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment