1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/docs/perf-testing/pod.sh
shuting 8929bd72a1
chore: update perf docs for 1.12 (#10116)
* fix: update kwok installation

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* feat: create deployment

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* feat: create pod

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* chore: update commands

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* chore: update readme

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2024-04-29 13:09:44 +03:00

49 lines
1.1 KiB
Bash

#!/bin/bash
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
# read user input for count
echo "Enter the pod count:"
read count
echo "Enter the pod namespace:"
read namespace
echo "Creating namespace $namespace:"
kubectl create namespace $namespace
# iterate $count number of times
for (( i=1; i<=$count; i++ ))
do
# generate YAML configuration using heredoc with COUNT variable substitution
yaml=$(cat <<-END
apiVersion: v1
kind: Pod
metadata:
name: fake-pod-$i
namespace: $namespace
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: type
operator: In
values:
- kwok
# A taints was added to an automatically created Node.
# You can remove taints of Node or add this tolerations.
tolerations:
- key: "kwok.x-k8s.io/node"
operator: "Exists"
effect: "NoSchedule"
containers:
- name: fake-container
image: fake-image
END
)
# apply the generated configuration to Kubernetes cluster
echo "$yaml" | kubectl apply -f -
done