Skip to content

Commit

Permalink
Merge pull request #1112 from marquiz/devel/ubuntu-fixes
Browse files Browse the repository at this point in the history
e2e: fix kubernetes repo key import for older ubuntu and debian
  • Loading branch information
klihub authored Sep 6, 2024
2 parents b0e50e3 + c93a43c commit e75a047
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions demo/lib/distro.bash
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,18 @@ debian-install-k8s() {
_k8s=$COMMAND_OUTPUT
fi
echo "installing Kubernetes v${_k8s}"
vm-command "curl -fsSL https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/Release.key | sudo gpg --dearmor --batch --yes -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg" || \
vm-command "curl -fsSL https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/Release.key -o /tmp/Release.key" || \
command-error "failed to download Kubernetes v${_k8s} key"
vm-command "echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/ /' > /etc/apt/sources.list.d/kubernetes.list && apt update" || \
command-error "failed to add Kubernetes v${_k8s} repo"

if vm-command "command -v apt-key >/dev/null"; then
vm-command "sudo apt-key add /tmp/Release.key"
vm-command "echo 'deb https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/ /' > /etc/apt/sources.list.d/kubernetes.list && apt update" || \
command-error "failed to add Kubernetes v${_k8s} repo"
else
vm-command "sudo gpg --dearmor --batch --yes -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg /tmp/Release.key"
vm-command "echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/ /' > /etc/apt/sources.list.d/kubernetes.list && apt update" || \
command-error "failed to add Kubernetes v${_k8s} repo"
fi
debian-install-pkg "kubeadm" "kubelet" "kubectl"
}

Expand Down

0 comments on commit e75a047

Please sign in to comment.