-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to repos to maintaned pkgs.k8s.io #657
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,8 @@ | |
case $facts['os']['family'] { | ||
'RedHat', 'CentOS': { | ||
class {'kubernetes': | ||
kubernetes_version => '1.22.0', | ||
kubernetes_package_version => '1.22.0', | ||
kubernetes_version => '1.28.2', | ||
kubernetes_package_version => '1.28.2-1.1', | ||
Comment on lines
+19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As 1.29.2 is already out by now this probably should get updated to that new version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, this is just version for tests. The point was to update the version, that is available in the new repos. We should definitely update the default version, because the current value is |
||
controller_address => "#{int_ipaddr1}:6443", | ||
container_runtime => 'docker', | ||
manage_docker => false, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,72 @@ | |
|
||
require 'spec_helper' | ||
describe 'kubernetes::repos', type: :class do | ||
context 'with Debian and default params' do | ||
let(:facts) do | ||
{ | ||
osfamily: 'Debian', # needed to run dependent tests from fixtures puppetlabs-apt | ||
kernel: 'Linux', | ||
os: { | ||
family: 'Debian', | ||
name: 'Ubuntu', | ||
release: { | ||
full: '22.04' | ||
}, | ||
distro: { | ||
codename: 'jammy' | ||
} | ||
} | ||
} | ||
end | ||
let(:params) do | ||
{ | ||
'container_runtime' => 'docker', | ||
'kubernetes_version' => '1.28.1', | ||
'kubernetes_apt_location' => '', | ||
'kubernetes_apt_release' => '', | ||
'kubernetes_apt_repos' => '', | ||
'kubernetes_key_id' => '', | ||
'kubernetes_key_source' => '', | ||
'kubernetes_yum_baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64', | ||
'kubernetes_yum_gpgkey' => 'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg', | ||
'docker_apt_location' => 'https://download.docker.com/linux/ubuntu', | ||
'docker_apt_release' => 'jammy', | ||
'docker_apt_repos' => 'main', | ||
'docker_yum_baseurl' => 'https://download.docker.com/linux/centos/7/x86_64/stable', | ||
'docker_yum_gpgkey' => 'https://download.docker.com/linux/centos/gpg', | ||
'docker_key_id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88', | ||
'docker_key_source' => 'https://download.docker.com/linux/ubuntu/gpg', | ||
'containerd_install_method' => 'archive', | ||
'create_repos' => true, | ||
'manage_docker' => true | ||
} | ||
end | ||
|
||
it { | ||
expect(subject).to contain_apt__source('kubernetes').with( | ||
ensure: 'present', | ||
location: 'https://pkgs.k8s.io/core:/stable:/v1.28/deb', | ||
release: '/', | ||
keyring: '/usr/share/keyrings/kubernetes-apt-keyring.gpg', | ||
) | ||
} | ||
|
||
it { | ||
expect(subject).to contain_file('/etc/apt/sources.list.d/kubernetes.list') | ||
.with_content(%r{^deb \[signed-by=/usr/share/keyrings/kubernetes-apt-keyring.gpg\] https://pkgs.k8s.io/core:/stable:/v1.28/deb /\s$}) | ||
} | ||
|
||
it { | ||
expect(subject).to contain_apt__source('docker').with( | ||
ensure: 'present', | ||
location: 'https://download.docker.com/linux/ubuntu', | ||
repos: 'main', | ||
release: 'jammy', | ||
key: { 'id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88', 'source' => 'https://download.docker.com/linux/ubuntu/gpg' }, | ||
) | ||
} | ||
end | ||
|
||
context 'with osfamily => Ubuntu and manage_docker => true' do | ||
let(:facts) do | ||
{ | ||
|
@@ -11,26 +77,27 @@ | |
family: 'Debian', | ||
name: 'Ubuntu', | ||
release: { | ||
full: '16.04' | ||
full: '22.04' | ||
}, | ||
distro: { | ||
codename: 'xenial' | ||
codename: 'jammy' | ||
} | ||
} | ||
} | ||
end | ||
let(:params) do | ||
{ | ||
'container_runtime' => 'docker', | ||
'kubernetes_apt_location' => 'http://apt.kubernetes.io', | ||
'kubernetes_apt_release' => 'kubernetes-xenial', | ||
'kubernetes_version' => '1.29.2', | ||
'kubernetes_apt_location' => 'http://myapt.example.org', | ||
'kubernetes_apt_release' => 'jammy', | ||
'kubernetes_apt_repos' => 'main', | ||
'kubernetes_key_id' => '54A647F9048D5688D7DA2ABE6A030B21BA07F4FB', | ||
'kubernetes_key_source' => 'https://packages.cloud.google.com/apt/doc/apt-key.gpg', | ||
'kubernetes_yum_baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64', | ||
'kubernetes_yum_gpgkey' => 'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg', | ||
'docker_apt_location' => 'https://download.docker.com/linux/ubuntu', | ||
'docker_apt_release' => 'xenial', | ||
'docker_apt_release' => 'jammy', | ||
'docker_apt_repos' => 'main', | ||
'docker_yum_baseurl' => 'https://download.docker.com/linux/centos/7/x86_64/stable', | ||
'docker_yum_gpgkey' => 'https://download.docker.com/linux/centos/gpg', | ||
|
@@ -45,9 +112,9 @@ | |
it { | ||
expect(subject).to contain_apt__source('kubernetes').with( | ||
ensure: 'present', | ||
location: 'http://apt.kubernetes.io', | ||
location: 'http://myapt.example.org', | ||
repos: 'main', | ||
release: 'kubernetes-xenial', | ||
release: 'jammy', | ||
key: { 'id' => '54A647F9048D5688D7DA2ABE6A030B21BA07F4FB', 'source' => 'https://packages.cloud.google.com/apt/doc/apt-key.gpg' }, | ||
) | ||
} | ||
|
@@ -57,7 +124,7 @@ | |
ensure: 'present', | ||
location: 'https://download.docker.com/linux/ubuntu', | ||
repos: 'main', | ||
release: 'xenial', | ||
release: 'jammy', | ||
key: { 'id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88', 'source' => 'https://download.docker.com/linux/ubuntu/gpg' }, | ||
) | ||
} | ||
|
@@ -72,17 +139,18 @@ | |
family: 'Debian', | ||
name: 'Ubuntu', | ||
release: { | ||
full: '16.04' | ||
full: '22.04' | ||
}, | ||
distro: { | ||
codename: 'xenial' | ||
codename: 'jammy' | ||
} | ||
} | ||
} | ||
end | ||
let(:params) do | ||
{ | ||
'container_runtime' => 'cri_containerd', | ||
'kubernetes_version' => '1.28.1', | ||
'kubernetes_apt_location' => 'http://apt.kubernetes.io', | ||
'kubernetes_apt_release' => 'kubernetes-xenial', | ||
'kubernetes_apt_repos' => 'main', | ||
|
@@ -124,6 +192,58 @@ | |
} | ||
end | ||
|
||
context 'with RedHat and default params' do | ||
let(:facts) do | ||
{ | ||
operatingsystem: 'RedHat', | ||
osfamily: 'RedHat', | ||
operatingsystemrelease: '7.0', | ||
kernel: 'Linux', | ||
os: { | ||
family: 'RedHat', | ||
name: 'RedHat', | ||
release: { | ||
full: '7.0' | ||
} | ||
} | ||
} | ||
end | ||
|
||
let(:params) do | ||
{ | ||
'container_runtime' => 'docker', | ||
'kubernetes_version' => '1.28.1', | ||
'kubernetes_apt_location' => '', | ||
'kubernetes_apt_release' => '', | ||
'kubernetes_apt_repos' => '', | ||
'kubernetes_key_id' => '', | ||
'kubernetes_key_source' => '', | ||
'kubernetes_yum_baseurl' => '', | ||
'kubernetes_yum_gpgkey' => '', | ||
'docker_apt_location' => 'https://download.docker.com/linux/ubuntu', | ||
'docker_apt_release' => 'xenial', | ||
'docker_apt_repos' => 'main', | ||
'docker_yum_baseurl' => 'https://download.docker.com/linux/centos/7/x86_64/stable', | ||
Comment on lines
+200
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above |
||
'docker_yum_gpgkey' => 'https://download.docker.com/linux/centos/gpg', | ||
'docker_key_id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88', | ||
'docker_key_source' => 'https://download.docker.com/linux/ubuntu/gpg', | ||
'containerd_install_method' => 'archive', | ||
'create_repos' => true, | ||
'manage_docker' => false | ||
} | ||
end | ||
|
||
it { is_expected.not_to contain_yumrepo('docker') } | ||
|
||
it { | ||
expect(subject).to contain_yumrepo('kubernetes').with( | ||
'enabled' => '1', | ||
'baseurl' => 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/', | ||
'gpgkey' => 'https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key', | ||
) | ||
} | ||
end | ||
|
||
context 'with osfamily => RedHat and manage_epel => true and manage_docker => false' do | ||
let(:facts) do | ||
{ | ||
|
@@ -144,6 +264,7 @@ | |
let(:params) do | ||
{ | ||
'container_runtime' => 'docker', | ||
'kubernetes_version' => '1.28.1', | ||
'kubernetes_apt_location' => 'http://apt.kubernetes.io', | ||
'kubernetes_apt_release' => 'kubernetes-xenial', | ||
'kubernetes_apt_repos' => 'main', | ||
|
@@ -165,7 +286,14 @@ | |
end | ||
|
||
it { is_expected.not_to contain_yumrepo('docker') } | ||
it { is_expected.to contain_yumrepo('kubernetes') } | ||
|
||
it { | ||
expect(subject).to contain_yumrepo('kubernetes').with( | ||
'enabled' => '1', | ||
'baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64', | ||
'gpgkey' => 'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg', | ||
) | ||
} | ||
end | ||
|
||
context 'with osfamily => RedHat and container_runtime => cri_containerd and containerd_install_method => package' do | ||
|
@@ -187,6 +315,7 @@ | |
|
||
let(:params) do | ||
{ | ||
'kubernetes_version' => '1.28.1', | ||
'container_runtime' => 'cri_containerd', | ||
'kubernetes_apt_location' => 'http://apt.kubernetes.io', | ||
'kubernetes_apt_release' => 'kubernetes-xenial', | ||
|
@@ -196,7 +325,7 @@ | |
'kubernetes_yum_baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64', | ||
'kubernetes_yum_gpgkey' => 'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg', | ||
'docker_apt_location' => 'https://download.docker.com/linux/ubuntu', | ||
'docker_apt_release' => 'xenial', | ||
'docker_apt_release' => 'jammy', | ||
'docker_apt_repos' => 'main', | ||
'docker_yum_baseurl' => 'https://download.docker.com/linux/centos/7/x86_64/stable', | ||
'docker_yum_gpgkey' => 'https://download.docker.com/linux/centos/gpg', | ||
|
@@ -209,6 +338,13 @@ | |
end | ||
|
||
it { is_expected.to contain_yumrepo('docker') } | ||
it { is_expected.to contain_yumrepo('kubernetes') } | ||
|
||
it { | ||
expect(subject).to contain_yumrepo('kubernetes').with( | ||
'enabled' => '1', | ||
'baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64', | ||
'gpgkey' => 'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg', | ||
) | ||
} | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The support for modern keyrings has been released in
puppetlabs-apt
since three month now in version9.2
. Version9.4
is also already out. To me, it would make sense to switch toapt::keyring
, but if you would like to keep it like this for compatibility for now this would also be fine for me.The most important for me would be that this PR finally get's merged and there is a release of
puppetlabs-kubernetes
that has useful, modern defaults and works with the newest version of Kubernetes out of the box.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I wrote earlier, it would be very nice to switch to modern
apt::keyring
. But we should make incremental changes. Adding dependency onpuppetlabs-apt >= 9.2.0
means effectively bumping dependency onpuppetlabs-stdlib
from>= 4.25.0
to>= 9.0.0
. This is rather huge step for the mankind, especially done in a single innocent PR called "Swich repos...".Depending on puppet code base setup this might mean upgrading many (10 or 40) modules just because of this minor change. I would prefer to release this "old but working version" as a
8.1.0
version. And then change module dependencies in separate PR, while bumping the module version e.g. to9.0.0
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in #681, the actual
puppetlabs/stdlib
requirement is currently>= 8.4.0
. So the change wouldn't be that huge.