From 981ea22514a37dccd0545b86919932deddd8df6d Mon Sep 17 00:00:00 2001 From: Jean-Benoit Paux <9682558+jbpaux@users.noreply.github.com> Date: Tue, 12 Sep 2023 14:14:54 +0200 Subject: [PATCH] chore(e2e): upgrade k8s version & repo (#658) * chore(e2e): upgrade k8s versions Signed-off-by: jbpaux <9682558+jbpaux@users.noreply.github.com> * chore(e2e): change to pkgs.k8s.io repo and clean Signed-off-by: jbpaux <9682558+jbpaux@users.noreply.github.com> chore(e2e): clean old keys Signed-off-by: jbpaux <9682558+jbpaux@users.noreply.github.com> * chore(e2e): update k8s version to match new format Signed-off-by: jbpaux <9682558+jbpaux@users.noreply.github.com> --------- Signed-off-by: jbpaux <9682558+jbpaux@users.noreply.github.com> --- .github/workflows/run-test-cases.yml | 39 ++++++++++++---------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/run-test-cases.yml b/.github/workflows/run-test-cases.yml index 7643886f3..b6699f4c1 100644 --- a/.github/workflows/run-test-cases.yml +++ b/.github/workflows/run-test-cases.yml @@ -129,30 +129,30 @@ jobs: fail-fast: false matrix: kube: - - runtime: microk8s - version: 1.24/stable - runtime: microk8s version: 1.25/stable - runtime: microk8s version: 1.26/stable - runtime: microk8s version: 1.27/stable + - runtime: microk8s + version: 1.28/stable - runtime: k3s - version: v1.24.13+k3s1 + version: v1.25.13+k3s1 - runtime: k3s - version: v1.25.9+k3s1 + version: v1.26.8+k3s1 - runtime: k3s - version: v1.26.4+k3s1 + version: v1.27.5+k3s1 - runtime: k3s - version: v1.27.1+k3s1 + version: v1.28.1+k3s1 - runtime: k8s - version: 1.24.13-00 + version: 1.25.13 - runtime: k8s - version: 1.25.9-00 + version: 1.26.8 - runtime: k8s - version: 1.26.4-00 + version: 1.27.5 - runtime: k8s - version: 1.27.1-00 + version: 1.28.1 steps: - name: Checkout the head commit of the branch @@ -201,14 +201,15 @@ jobs: - if: startsWith(matrix.kube.runtime, 'k8s') name: Install Kubernetes run: | + SHORTVERSION=$(cut -d '.' -f 1,2 <<< "${{ matrix.kube.version }}") sudo apt-get update -y sudo apt-get install -y apt-transport-https ca-certificates curl - sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://dl.k8s.io/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 + curl -fsSL https://pkgs.k8s.io/core:/stable:/v${SHORTVERSION}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${SHORTVERSION}/deb/ /" | 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 }} containerd.io + 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: $?" @@ -238,15 +239,9 @@ jobs: 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 - + # Remove control plane label + kubectl taint nodes --all node-role.kubernetes.io/control-plane- + until kubectl get node ${HOSTNAME,,} -o jsonpath='{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status}' | grep 'Ready=True'; do echo "waiting for kubernetes to become ready"; sleep 10; done - if: startsWith(matrix.kube.runtime, 'k8s')