Initial commit
This commit is contained in:
10
scripts/run-tests.sh
Executable file
10
scripts/run-tests.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
SELF=$(realpath "$0")
|
||||
|
||||
if [ -z "${KUBECONFIG}" ]; then
|
||||
KUBECONFIG="$("${SELF%/*}"/start-k3d.sh)"
|
||||
export KUBECONFIG
|
||||
fi
|
||||
|
||||
cargo test "$@"
|
||||
33
scripts/start-k3d.sh
Executable file
33
scripts/start-k3d.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
: ${CLUSTER_NAME:=krc-tests}
|
||||
: ${XDG_RUNTIME_DIR:=/run/user/$(id -u)}
|
||||
|
||||
: "${DOCKER_HOST=unix://${XDG_RUNTIME_DIR}/podman/podman.sock}"
|
||||
: "${DOCKER_SOCK=${XDG_RUNTIME_DIR}/podman/podman.sock}"
|
||||
export DOCKER_HOST DOCKER_SOCK
|
||||
|
||||
cluster_exists() {
|
||||
k3d cluster get "${CLUSTER_NAME}" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
create_cluster() {
|
||||
k3d cluster create "${CLUSTER_NAME}" \
|
||||
--k3s-arg '--kubelet-arg=feature-gates=KubeletInUserNamespace=true@server:*' \
|
||||
--kubeconfig-update-default=false \
|
||||
--kubeconfig-switch-context=false \
|
||||
--no-lb \
|
||||
>&2
|
||||
}
|
||||
|
||||
start_cluster() {
|
||||
k3d cluster start "${CLUSTER_NAME}" >&2
|
||||
}
|
||||
|
||||
if ! cluster_exists; then
|
||||
create_cluster
|
||||
else
|
||||
start_cluster
|
||||
fi
|
||||
|
||||
k3d kubeconfig write "${CLUSTER_NAME}"
|
||||
Reference in New Issue
Block a user