31 lines
717 B
Bash
31 lines
717 B
Bash
#!/usr/bin/env bash
|
|
#
|
|
set -euo pipefail
|
|
IFS=$'\n\t'
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
: ${cpu:="500m"}
|
|
: ${memory:="2Gi"}
|
|
|
|
overrides=""
|
|
if [ ! -z "${highmem:-}" ]; then
|
|
overrides=$(jq --compact-output '.' <<EOF
|
|
{
|
|
"spec": {
|
|
"tolerations": [
|
|
{
|
|
"key": "dedicated",
|
|
"operator": "Equal",
|
|
"value": "background-highmem",
|
|
"effect": "NoSchedule"
|
|
}
|
|
],
|
|
"nodeSelector": {"dedicated": "background-highmem"}
|
|
}
|
|
}
|
|
EOF
|
|
)
|
|
fi
|
|
|
|
exec kubectl run --rm -i -t --image alpine:3.13 --overrides="$overrides" --requests "cpu=$cpu,memory=$memory" --limits "cpu=$cpu,memory=$memory" --pod-running-timeout 10m "tom-$(uuidgen | cut -d '-' -f 1)" -- /bin/sh "$@"
|