-
Notifications
You must be signed in to change notification settings - Fork 706
guestagent: k8s: use kubectl instead of client-go #4120
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
||
|
@@ -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"]="" | ||
|
@@ -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: | ||
|
@@ -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)" | ||
|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checking the connection makes sense only after the deployment is available. I would do this:
At this point the service is typically not available, but it should be in few seconds, so we can start checking every second. Since we wait separately for the deployment, we don't need to wait 3 minutes for the connection, maybe 30 seconds ie enough to detect broken port forwarding. Notes for the curl command:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in: |
||
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 | ||
|
Uh oh!
There was an error while loading. Please reload this page.