Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YUNIKORN-2037] Testing the throughput of Yunikorn #724

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions deployments/kwok-perf-test/deploy-tool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

show_help() {
cat << EOF
Invalid option: -$OPTARG
Usage: $0 [-d] [-i <interval>] <deployment_count> <replicas_count>

Options:
-d, --delete Delete the specified number of deployments.
-i, --interval <interval> Set the interval between deployments in seconds.

Arguments:
<deployment_count> Number of deployments to create or delete (required).
<replicas_count> Number of replicas for each deployment (required).
EOF
}

deploy_deployments() {
for (( i=0; i<deployment_count; i++ )); do
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: sleep-deployment-$i
labels:
app: sleep
applicationId: "sleep-deployment-$i"
queue: root.default
spec:
replicas: $replicas_count
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
applicationId: "sleep-deployment-$i"
queue: root.default
spec:
containers:
- name: sleep300
image: "alpine:latest"
tolerations:
- key: "kwok.x-k8s.io/node"
operator: "Exists"
effect: "NoSchedule"
EOF
sleep "$interval"
done
}

delete_deployments(){
for (( i=0; i<deployment_count; i++ )); do
kubectl delete deploy/sleep-deployment-$i
done
}

# Default values
delete=false
interval=0

# Process command-line options
while getopts ":di:" opt; do
case $opt in
d)
delete=true
;;
i)
interval=$OPTARG
;;
\?)
show_help
exit 1
;;
:)
show_help
exit 1
;;
esac
done

# Shift the processed options out of the command-line arguments
shift $((OPTIND-1))

# Check if deployment count and replicas count are provided
if [ $# -ne 2 ]; then
show_help
exit 1
fi

# Assign provided values to variables
deployment_count=$1
replicas_count=$2

# Check if delete flag is set
if [ "$delete" = true ]; then
echo "Deleting $deployment_count deployments with $replicas_count replicas each."
delete_deployments
else
echo "Deploying $deployment_count deployments with $replicas_count replicas each."
deploy_deployments
fi

exit 0
76 changes: 76 additions & 0 deletions deployments/kwok-perf-test/kwok-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if [ $# -eq 0 ]; then
echo "Error: Please provide the number of nodes to create."
echo "Usage: $0 <number_of_nodes>"
exit 1
fi

KWOK_REPO=kubernetes-sigs/kwok
KWOK_LATEST_RELEASE=$(curl "https://api.github.com/repos/${KWOK_REPO}/releases/latest" | jq -r '.tag_name')
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/kwok.yaml"
kubectl apply -f "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/stage-fast.yaml"

for (( i=0;i<$1; i++))
do
kubectl apply -f - <<EOF
apiVersion: v1
kind: Node
metadata:
annotations:
node.alpha.kubernetes.io/ttl: "0"
kwok.x-k8s.io/node: fake
labels:
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/os: linux
kubernetes.io/arch: amd64
kubernetes.io/hostname: kwok-node-$i
kubernetes.io/os: linux
kubernetes.io/role: agent
node-role.kubernetes.io/agent: ""
type: kwok
name: kwok-node-$i
spec:
taints: # Avoid scheduling actual running pods to fake Node
- effect: NoSchedule
key: kwok.x-k8s.io/node
value: fake
status:
allocatable:
cpu: 32
memory: 256Gi
pods: 110
capacity:
cpu: 32
memory: 256Gi
pods: 110
nodeInfo:
architecture: amd64
bootID: ""
containerRuntimeVersion: ""
kernelVersion: ""
kubeProxyVersion: fake
kubeletVersion: fake
machineID: ""
operatingSystem: linux
osImage: ""
systemUUID: ""
phase: Running
EOF
done