Skip to content

Commit

Permalink
Support new location for apt repo
Browse files Browse the repository at this point in the history
Node this is a cherry pick of certain parts of
puppetlabs#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 07acbc1)
Change-Id: I452a7e087cda5bb0089b5faa7b14c6c633ed1497
  • Loading branch information
sorrison authored and waipeng committed May 28, 2024
1 parent fa3a2b4 commit 30a11a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
15 changes: 10 additions & 5 deletions manifests/repos.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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"),
},
}

Expand Down

0 comments on commit 30a11a7

Please sign in to comment.