diff --git a/.github/workflows/run-test-cases.yml b/.github/workflows/run-test-cases.yml index 188205801..3b2229b06 100644 --- a/.github/workflows/run-test-cases.yml +++ b/.github/workflows/run-test-cases.yml @@ -103,34 +103,30 @@ jobs: fail-fast: false matrix: kube: - - runtime: MicroK8s-1.21 - version: 1.21/stable - - runtime: MicroK8s-1.22 - version: 1.22/stable - runtime: MicroK8s-1.23 version: 1.23/stable - runtime: MicroK8s-1.24 version: 1.24/stable - - runtime: K3s-1.21 - version: v1.21.5+k3s1 - - runtime: K3s-1.22 - version: v1.22.6+k3s1 + - runtime: MicroK8s-1.25 + version: 1.25/stable + - runtime: MicroK8s-1.26 + version: 1.26/stable - runtime: K3s-1.23 - version: v1.23.13+k3s1 + version: v1.23.15+k3s1 - runtime: K3s-1.24 - version: v1.24.6+k3s1 + version: v1.24.9+k3s1 - runtime: K3s-1.25 - version: v1.25.2+k3s1 - - runtime: Kubernetes-1.21 - version: 1.21.14-00 - - runtime: Kubernetes-1.22 - version: 1.22.14-00 + version: v1.25.5+k3s1 + - runtime: K3s-1.26 + version: v1.26.0+k3s1 - runtime: Kubernetes-1.23 - version: 1.23.11-00 + version: 1.23.15-00 - runtime: Kubernetes-1.24 - version: 1.24.5-00 + version: 1.24.9-00 - runtime: Kubernetes-1.25 - version: 1.25.1-00 + version: 1.25.5-00 + - runtime: Kubernetes-1.26 + version: 1.26.0-00 test: - case: end-to-end file: test/run-end-to-end.py @@ -177,7 +173,7 @@ jobs: sudo chmod +x install.sh ./install.sh server --kubelet-arg=eviction-hard="imagefs.available<1%,nodefs.available<1%" --kubelet-arg=eviction-minimum-reclaim="imagefs.available=1%,nodefs.available=1%" sudo addgroup k3s-admin - sudo adduser $USER k3s-admin + sudo adduser $USER k3s-admin sudo usermod -a -G k3s-admin $USER sudo chgrp k3s-admin /etc/rancher/k3s/k3s.yaml sudo chmod g+r /etc/rancher/k3s/k3s.yaml @@ -209,8 +205,10 @@ jobs: sudo apt-get install -y apt-transport-https ca-certificates curl sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list + sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list sudo apt-get update - sudo apt-get install -o Dpkg::Options::="--force-overwrite" -y --allow-downgrades kubelet=${{ matrix.kube.version }} kubeadm=${{ matrix.kube.version }} kubectl=${{ matrix.kube.version }} + sudo apt-get install -o Dpkg::Options::="--force-overwrite" -y --allow-downgrades kubelet=${{ matrix.kube.version }} kubeadm=${{ matrix.kube.version }} kubectl=${{ matrix.kube.version }} containerd.io kubectl version && echo "kubectl return code: $?" || echo "kubectl return code: $?" kubeadm version && echo "kubeadm return code: $?" || echo "kubeadm return code: $?" kubelet --version && echo "kubelet return code: $?" || echo "kubelet return code: $?" @@ -236,17 +234,17 @@ jobs: sudo chown $(id -u):$(id -g) $HOME/.kube/config kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml - # Kubernetes 1.25+ replaces the master label with control plane - if [ "${{ matrix.kube.version }}" == "1.25.1-00" ]; then - kubectl taint nodes --all node-role.kubernetes.io/control-plane- - else - kubectl taint nodes --all node-role.kubernetes.io/master- - fi - # Kubernetes 1.24 has both labels applicable, to be safe tainting both labels - if [ "${{ matrix.kube.version }}" == "1.24.5-00" ]; then + verlte() { [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] ; } + verlt() { [ "$1" = "$2" ] && return 1 || verlte $1 $2 ; } + # Kubernetes 1.24+ has control plane label + if verlte "1.24.0" "${{ matrix.kube.version }}" ; then kubectl taint nodes --all node-role.kubernetes.io/control-plane- fi + # Kubernetes before 1.25 has master label + if verlt "${{ matrix.kube.version }}" "1.25.0" ; then + kubectl taint nodes --all node-role.kubernetes.io/master- + fi echo '--set kubernetesDistro=k8s' > /tmp/k8s_distro_to_test.txt echo 'kubectl' > /tmp/runtime_cmd_to_test.txt @@ -266,11 +264,7 @@ jobs: - if: (startsWith(github.event_name, 'pull_request')) && (startsWith(matrix.kube.runtime, 'Kubernetes')) name: Import local agent and controller to Kubernetes run: | - sudo docker load --input agent.tar - sudo docker load --input controller.tar - sudo docker load --input webhook-configuration.tar - sudo docker image ls - # No longer are using docker for container runtime, need to load to containerd with ctr + # Need to load to containerd with ctr # -n allows kubernetes to see the image sudo ctr -n=k8s.io image import agent.tar sudo ctr -n=k8s.io image import controller.tar @@ -291,7 +285,7 @@ jobs: sudo cat ~/.kube/config sudo microk8s.enable rbac dns sudo sed -i 's/memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi/memory.available<25Mi,nodefs.available<50Mi,imagefs.available<50Mi/' /var/snap/microk8s/current/args/kubelet - sudo systemctl restart snap.microk8s.daemon-kubelet + sudo systemctl restart snap.microk8s.daemon-kubelite until sudo microk8s.status --wait-ready; do sleep 5s; echo "Try again"; done echo '--set kubernetesDistro=microk8s' > /tmp/k8s_distro_to_test.txt echo 'microk8s kubectl' > /tmp/runtime_cmd_to_test.txt