Skip to content

Commit de062bd

Browse files
authored
Merge pull request #4835 from techthumb/master
Multi node k8s test updates and related fixes
2 parents 10d0287 + 2e43252 commit de062bd

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

hack/bats/extras/k8s.bats

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ local_setup() {
4646
# kubeadm join ADDRESS --token TOKEN --discovery-token-ca-cert-hash DISCOVERY_TOKEN_CA_CERT_HASH
4747
read -ra words <<< "$join_command"
4848
assert_equal "${words[1]} ${words[3]} ${words[5]}" "join --token --discovery-token-ca-cert-hash"
49-
params=".param.url=\"https://${words[2]}\"|.param.token=\"${words[4]}\"|.param.discoveryTokenCaCertHash=\"${words[6]}\""
49+
params=".param.url=\"${words[2]}\"|.param.token=\"${words[4]}\"|.param.discoveryTokenCaCertHash=\"${words[6]}\""
5050
elif [[ $i -eq 0 && "${TEMPLATE}" == "k3s" ]]; then
5151
url=$(printf "https://lima-%s.internal:6443\n" "${NAME}-0")
5252
token=$(limactl shell "${NAME}-0" sudo cat /var/lib/rancher/k3s/server/node-token)
@@ -113,6 +113,7 @@ k() {
113113

114114
# bats test_tags=nodes:3
115115
@test 'Multi-node' {
116+
[ $(k get nodes -o jsonpath='{range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}{end}' | grep -c True) -eq 3 ]
116117
# Based on https://github.com/rootless-containers/usernetes/blob/gen2-v20250828.0/hack/test-smoke.sh
117118
k apply -f - <<EOF
118119
apiVersion: v1
@@ -147,6 +148,13 @@ spec:
147148
labels:
148149
run: dnstest
149150
spec:
151+
affinity:
152+
podAntiAffinity:
153+
requiredDuringSchedulingIgnoredDuringExecution:
154+
- labelSelector:
155+
matchLabels:
156+
run: dnstest
157+
topologyKey: kubernetes.io/hostname
150158
containers:
151159
- name: dnstest
152160
image: ${TEST_CONTAINER_IMAGES[nginx]}

templates/k8s.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# (The parameters for the start command printed here)
1919
#
2020
# $ limactl start --name k8s-1 --network lima:user-v2 template:k8s \
21-
# --set '.param.url="https://<ADDRESS_FROM_ABOVE>" | .param.token="<TOKEN_FROM_ABOVE>" | \
21+
# --set '.param.url="<ADDRESS_FROM_ABOVE>" | .param.token="<TOKEN_FROM_ABOVE>" | \
2222
# .param.discoveryTokenCaCertHash="<DISCOVERY_TOKEN_CA_CERT_HASH_FROM_ABOVE>"'
2323

2424
minimumLimaVersion: 2.0.0

0 commit comments

Comments
 (0)