Skip to content

Commit c9bd511

Browse files
committed
Change guest home directory to '/home/runner.guest'
1 parent fa347b6 commit c9bd511

5 files changed

Lines changed: 42 additions & 27 deletions

File tree

.github/workflows/main.yaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,3 @@ jobs:
3030
with:
3131
lima_template: ${{ matrix.lima_template }}
3232
container_engine: ${{ matrix.container_engine }}
33-
34-
# TODO: this test should create multiple instances of Usernetes on each of the hosts
35-
multi-node-custom-ports:
36-
name: "Multi node with custom service ports"
37-
uses: ./.github/workflows/reusable-multi-node.yaml
38-
with:
39-
lima_template: "template://ubuntu-24.04"
40-
container_engine: "docker"
41-
# Defaults to 6443
42-
kube_apiserver_port: "8080"
43-
# Defaults to 8472
44-
flannel_port: "9072"
45-
# Defaults to 10250
46-
kubelet_port: "20250"
47-
# Defaults to 2379
48-
etcd_port: "9090"

.github/workflows/reusable-single-node.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,3 @@ jobs:
8383
- run: make kubeconfig
8484
- run: kubectl taint nodes --all node-role.kubernetes.io/control-plane-
8585
- run: ./hack/test-smoke.sh
86-
- name: "Test data persistency after restarting the node"
87-
run: |
88-
make down
89-
make up
90-
sleep 30
91-
./hack/test-smoke.sh

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export PORT_KUBELET ?= 10250
77
export PORT_FLANNEL ?= 8472
88
export PORT_KUBE_APISERVER ?= 6443
99

10+
HERE := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
11+
1012
# HOSTNAME is the name of the physical host
1113
export HOSTNAME ?= $(shell hostname)
1214
# HOST_IP is the IP address of the physical host. Accessible from other hosts.
@@ -82,7 +84,7 @@ render: check-preflight
8284
.PHONY: up
8385
up: check-preflight
8486
# Podman creates cni files in a shared location, this ensures unique names that do not clobbed one another
85-
sed -i "s/default_network/$(HOSTNAME)/g" docker-compose.yaml
87+
sed -i "s/default_network/$(HOSTNAME)/g" $(HERE)/docker-compose.yaml
8688
$(COMPOSE) up --build -d
8789

8890
.PHONY: down
@@ -145,7 +147,7 @@ sync-external-ip:
145147
.PHONY: kubeadm-join
146148
kubeadm-join:
147149
# Our kernel is too old for usernetes, so we need this
148-
sed -i "s/--token/--ignore-preflight-errors=all --token/g" join-command
150+
sed -i "s/--token/--ignore-preflight-errors=all --token/g" $(HERE)/join-command
149151
$(NODE_SHELL) /bin/bash /usernetes/join-command
150152
@echo "# Run 'make sync-external-ip' on the control plane"
151153

hack/create-cluster-lima.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -eux -o pipefail
1111
: "${PORT_FLANNEL:=8472}"
1212
: "${PORT_KUBELET:=10250}"
1313

14-
guest_home="/home/${USER}.linux"
14+
guest_home="/home/runner.guest"
1515

1616
if [ "$(id -u)" -le 1000 ]; then
1717
# In --plain mode, UID has to be >= 1000 to populate subuids
@@ -49,7 +49,8 @@ done
4949
${LIMACTL} shell host0 ${SERVICE_PORTS} CONTAINER_ENGINE="${CONTAINER_ENGINE}" make -C "${guest_home}/usernetes" kubeadm-init install-flannel kubeconfig join-command
5050

5151
# Let host1 join the cluster
52-
${LIMACTL} copy host0:~/usernetes/join-command host1:~/usernetes/join-command
52+
${LIMACTL} copy host0:${guest_home}/usernetes/join-command ./join-command
53+
${LIMACTL} copy ./join-command host1:${guest_home}/usernetes/join-command
5354
${LIMACTL} shell host1 ${SERVICE_PORTS} CONTAINER_ENGINE="${CONTAINER_ENGINE}" make -C "${guest_home}/usernetes" kubeadm-join
5455
${LIMACTL} shell host0 ${SERVICE_PORTS} CONTAINER_ENGINE="${CONTAINER_ENGINE}" make -C "${guest_home}/usernetes" sync-external-ip
5556

hack/test-smoke.sh

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,50 @@ EOF
5656

5757
INFO "GET PODS"
5858
kubectl get pods
59+
kubectl get pods -n kube-system
5960
INFO "DESCRIBE PODS"
6061
kubectl describe pods
6162
for name in $(kubectl get pods -o json | jq -r .items[].metadata.name)
6263
do
6364
kubectl logs $name
65+
kubectl exec -it $name -- cat /etc/resolv.conf
6466
done
6567

68+
INFO "Patching CoreDNS to use 8.8.8.8"
69+
kubectl get configmap coredns -n kube-system -o yaml | \
70+
sed 's/forward . \/etc\/resolv.conf/forward . 8.8.8.8/' | \
71+
kubectl apply -f -
72+
73+
INFO "Restarting CoreDNS"
74+
kubectl delete pod -n kube-system -l k8s-app=kube-dns
75+
kubectl rollout status deployment coredns -n kube-system
76+
6677
INFO "Connecting to dnstest-{0,1,2}.dnstest.default.svc.cluster.local"
67-
kubectl run -i --rm --image=alpine --restart=Never dnstest-shell -- sh -exc 'for f in $(seq 0 2); do wget -O- http://dnstest-${f}.dnstest.default.svc.cluster.local; done'
78+
# kubectl run -i --rm --image=alpine --restart=Never dnstest-shell -- sh -exc 'for f in $(seq 0 2); do wget -O- http://dnstest-${f}.dnstest.default.svc.cluster.local; done'
79+
# kubectl run -i --rm --image=debian:bookworm-slim --restart=Never dnstest-shell -- sh -exc '
80+
# apt-get update && apt-get install -y wget;
81+
# for f in $(seq 0 2); do
82+
# wget -O- http://dnstest-${f}.dnstest.default.svc.cluster.local;
83+
# done'
84+
85+
COREDNS_IP=$(kubectl get pod -n kube-system -l k8s-app=kube-dns -o jsonpath='{.items[0].status.podIP}')
86+
INFO "CoreDNS Pod IP is: $COREDNS_IP"
87+
kubectl run -i --rm --image=busybox:1.28 --restart=Never dns-test -- nslookup google.com $COREDNS_IP
88+
89+
INFO "Connecting to dnstest-{0,1,2}.dnstest.default.svc.cluster.local"
90+
kubectl run -i --rm --image=busybox:1.28 --restart=Never dnstest-shell -- sh -exc '
91+
echo "--- Resolv.conf ---"
92+
cat /etc/resolv.conf
93+
94+
echo "--- Testing External DNS (google.com) ---"
95+
nslookup google.com || echo "External DNS Failed"
96+
97+
echo "--- Testing Internal DNS (dnstest-0) ---"
98+
nslookup dnstest-0.dnstest || echo "Internal DNS Failed"
6899
100+
for f in 0 1 2; do
101+
wget -qO- http://dnstest-${f}.dnstest.default.svc.cluster.local
102+
done'
69103
INFO "Deleting Service \"dnstest\""
70104
kubectl delete service dnstest
71105
INFO "Deleting StatefulSet \"dnstest\""

0 commit comments

Comments
 (0)