Skip to content
Draft
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
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ jobs:
- archlinux.yaml
- opensuse.yaml
- docker.yaml
- k8s.yaml
- ../hack/test-templates/alpine-iso-9p-writable.yaml # Covers alpine-iso.yaml
- ../hack/test-templates/net-user-v2.yaml
- ../hack/test-templates/test-misc.yaml # TODO: merge net-user-v2 into test-misc
Expand Down Expand Up @@ -501,6 +502,9 @@ jobs:
template:
- default.yaml
steps:
- name: "Adjust LIMACTL_CREATE_ARGS"
# --cpus=1 is needed for running vz on GHA: https://github.com/lima-vm/lima/pull/1511#issuecomment-1574937888
run: echo "LIMACTL_CREATE_ARGS=${LIMACTL_CREATE_ARGS} --cpus 1 --memory 1" >>$GITHUB_ENV
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
Expand Down
29 changes: 24 additions & 5 deletions hack/test-templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ fi
INFO "Validating \"$FILE_HOST\""
limactl validate "$FILE_HOST"

# --cpus=1 is needed for running vz on GHA: https://github.com/lima-vm/lima/pull/1511#issuecomment-1574937888
LIMACTL_CREATE=(limactl --tty=false create --cpus=1 --memory=1)
LIMACTL_CREATE=(limactl --tty=false create)

CONTAINER_ENGINE="nerdctl"

Expand All @@ -45,6 +44,7 @@ declare -A CHECKS=(
["systemd-strict"]="1"
["mount-home"]="1"
["container-engine"]="1"
["k8s"]=""
["restart"]="1"
# snapshot tests are too flaky (especially with archlinux)
["snapshot-online"]=""
Expand All @@ -64,6 +64,12 @@ declare -A CHECKS=(
["ssh-over-vsock"]=""
)

clear_checks() {
for k in "${!CHECKS[@]}"; do
CHECKS["$k"]=""
done
}

case "$NAME" in
"default")
# CI failure:
Expand All @@ -77,9 +83,10 @@ case "$NAME" in
CHECKS["container-engine"]=
[ "$NAME" = "alpine-iso-9p-writable" ] && CHECKS["mount-path-with-spaces"]="1"
;;
"k3s")
ERROR "File \"$FILE\" is not testable with this script"
exit 1
"k0s" | "k3s" | "k8s")
# Disable all checks except k8s
clear_checks
CHECKS["k8s"]="1"
;;
"fedora")
WARNING "Relaxing systemd tests for fedora (For avoiding CI failure)"
Expand Down Expand Up @@ -432,6 +439,18 @@ if [[ -n ${CHECKS["container-engine"]} ]]; then
fi
fi

if [[ -n ${CHECKS["k8s"]} ]]; then
INFO "Testing Kubernetes"
set -x
limactl shell "$NAME" kubectl get nodes -o wide
limactl shell "$NAME" kubectl create deployment nginx --image="${nginx_image}"
limactl shell "$NAME" kubectl create service nodeport nginx --node-port=31080 --tcp=80:80
timeout 3m bash -euxc "until curl -f --retry 30 --retry-connrefused http://127.0.0.1:31080; do sleep 3; done"
limactl shell "$NAME" kubectl delete service nginx
limactl shell "$NAME" kubectl delete deployment nginx
set +x
fi

if [[ -n ${CHECKS["port-forwards"]} ]]; then
INFO "Testing port forwarding rules using netcat"
set -x
Expand Down
2 changes: 1 addition & 1 deletion templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Container orchestration:
- [`faasd`](./faasd.yaml): [Faasd](https://docs.openfaas.com/deployment/edge/)
- [`k0s`](./k0s.yaml): [k0s](https://k0sproject.io/) Zero Friction Kubernetes
- [`k3s`](./k3s.yaml): Kubernetes via k3s
- [`k8s`](./k8s.yaml): Kubernetes via kubeadm
- [`k8s`](./k8s.yaml): Kubernetes via kubeadm
- [`experimental/u7s`](./experimental/u7s.yaml): [Usernetes](https://github.com/rootless-containers/usernetes): Rootless Kubernetes

Optional feature enablers:
Expand Down