From 30a11a7a4027ed50ae808b51484a5981a841a97b Mon Sep 17 00:00:00 2001 From: Sam Morrison Date: Mon, 15 Jan 2024 11:54:28 +1100 Subject: [PATCH] Support new location for apt repo Node this is a cherry pick of certain parts of https://github.com/puppetlabs/puppetlabs-kubernetes/pull/657 This is stalled due to yum issues and so doing this quick fix for now to get us going. Once above is merged we can switch back to upstream. (cherry picked from commit 07acbc13d6ce622daaacb9af02250b1eda84c431) Change-Id: I452a7e087cda5bb0089b5faa7b14c6c633ed1497 --- manifests/init.pp | 2 +- manifests/repos.pp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 303a75e9..deb983b9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -604,7 +604,7 @@ String $kubernetes_version = '1.10.2', String $kubernetes_cluster_name = 'kubernetes', String $kubernetes_package_version = $facts['os']['family'] ? { - 'Debian' => "${kubernetes_version}-00", + 'Debian' => "${kubernetes_version}-1.1", 'RedHat' => $kubernetes::kubernetes_version, }, String $container_runtime = 'docker', diff --git a/manifests/repos.pp b/manifests/repos.pp index b6fbc63f..98ff3100 100644 --- a/manifests/repos.pp +++ b/manifests/repos.pp @@ -3,6 +3,8 @@ # @param container_runtime # This is the runtime that the Kubernetes cluster will use. # It can only be set to "cri_containerd" or "docker". Defaults to cri_containerd +# @param kubernetes_version +# The version of Kubernetes. Defaults to 1.10.2 # @param kubernetes_apt_location # The APT repo URL for the Kubernetes packages. Defaults to https://apt.kubernetes.io # @param kubernetes_apt_release @@ -40,6 +42,7 @@ # class kubernetes::repos ( String $container_runtime = $kubernetes::container_runtime, + Optional[String] $kubernetes_version = $kubernetes::kubernetes_version, Optional[String] $kubernetes_apt_location = $kubernetes::kubernetes_apt_location, Optional[String] $kubernetes_apt_release = $kubernetes::kubernetes_apt_release, Optional[String] $kubernetes_apt_repos = $kubernetes::kubernetes_apt_repos, @@ -60,16 +63,18 @@ ) { if $create_repos { + $parts = split($kubernetes_version, '[.]') + $minor_version = "${parts[0]}.${parts[1]}" case $facts['os']['family'] { 'Debian': { $codename = fact('os.distro.codename') apt::source { 'kubernetes': - location => pick($kubernetes_apt_location,'https://apt.kubernetes.io'), - repos => pick($kubernetes_apt_repos,'main'), - release => pick($kubernetes_apt_release,'kubernetes-xenial'), + location => pick($kubernetes_apt_location,"https://pkgs.k8s.io/core:/stable:/v${minor_version}/deb"), + repos => '', + release => pick($kubernetes_apt_release,'/'), key => { - 'id' => pick($kubernetes_key_id,'A362B822F6DEDC652817EA46B53DC80D13EDEF05'), - 'source' => pick($kubernetes_key_source,'https://packages.cloud.google.com/apt/doc/apt-key.gpg'), + 'id' => pick($kubernetes_key_id,'DE15B14486CD377B9E876E1A234654DA9A296436'), + 'source' => pick($kubernetes_key_source,"https://pkgs.k8s.io/core:/stable:/v${minor_version}/deb/Release.key"), }, }