Initial commit

This commit is contained in:
2025-09-19 11:11:00 -05:00
commit 6f7160fc02
11 changed files with 1752 additions and 0 deletions

10
scripts/run-tests.sh Executable file
View 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
View 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}"